When running the ndk-build command I get the following error:
Android NDK: Could not find application project directory !
Android NDK: Please define the NDK_PROJECT_PATH variable to point to it.
The contents of my Android.mk file:
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := FRE
LOCAL_SRC_FILES := FlashRuntimeExtensions.so
include $(PREBUILT_SHARED_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := NativeQCAR
LOCAL_SRC_FILES := main.c
LOCAL_SHARED_LIBRARIES := FRE
include $(BUILD_SHARED_LIBRARY)
Adding the following line doesn't help:
NDK_PROJECT_PATH = C:/Users/Wessel/Dropbox/workspace/eclipse/NativeQ
I haven't found a single answer which is satisfactory for me, perhaps it depends whether you're trying to build an existing application, create a new one, or perhaps you are porting some existing native app. These guidelines work with android-ndk-r9b but should work with the last few releases
The makefile build-local.mk used by ndk-build will make some guesses about the location of the application makefile.
By default it seems the NDK is oriented towards having you stow your NDK application
Application.mk
andAndroid.mk
files under a sub-directory calledjni
. This works nicely, and you can just use the command line:If you don't want to have a
jni
sub-directory, for example, perhaps you're porting a linux command-line tool to Android, the following maybe appropriate for you:Create an empty
AndroidManifest.xml
fileNow create an
Application.mk
file with the following contents:Then create an
Android.mk
file, for example:To build the application use:
This is what I use,
cd
into the project directory and do:This worked for me. No environment variables and no setups. Go to the root directory where you unzipped ndk on command line and run ndk-build command:
A sample would look like this in my dev machine:
You need to specify 3 things.
These are needed to override the default values of the build script, which expects things to be in the jni folder.
When calling ndk-build use
In Application.mk add
Follow Below steps:
you should see something like
Done!!