Reputation: 115
I have a very simple test project. Basically one native c file under jni (jni is under the root of the project, in the same directory as 'src' 'res' etc). The make file is the basically the simplest:
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := native
LOCAL_SRC_FILES := native.c
include $(BUILD_SHARED_LIBRARY)
Error message is: make: * No rule to make target ` '/native.c'. needed by... Obviously ndk-build was trying to find the file under root. If I copy the file to the root '/' or if I specify the full path of 'native.c' in the make file, then things are ok.
I also tried to output $LOCAL_PATH by $(warning, '$(LOCAL_PATH)') and found no problem.
Upvotes: 2
Views: 2098
Reputation: 25396
Create Android.mk with the following content:
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := native
LOCAL_SRC_FILES := native.c
include $(BUILD_SHARED_LIBRARY)
Put native.c
in the same folder where your Android.mk is.
Run ndk-build
You will have the output as follows:
D:\12314\jni>ndk-build
"Compile thumb : native <= native.c
SharedLibrary : libnative.so
Install : libnative.so => libs/armeabi/libnative.so
Upvotes: 1