Nick
Nick

Reputation: 949

Error when Including a library in NDK

I have the following code as my Android.mk in my project/jni folder. folder libA is in project/jni and it has a Android.mk. I included libA in jni/Android.mk

jni/Android.mk:

LOCAL_PATH := $(call my-dir) 
include $(LOCAL_PATH)/libA/Android.mk 
include $(CLEAR_VARS)
LOCAL_MODULE    := hello-jni
LOCAL_SRC_FILES := hello-jni.c
include $(BUILD_SHARED_LIBRARY)

I get this error

jni/Android.mk:16: jni: Permission denied
jni/Android.mk:16: /libA/Android.mk: No such file or directory
make: *** No rule to make target `/libA/Android.mk'.  Stop.

I tried solution given in this: No rule to make target NDK .But the same error showed up again. I'm unable to figure out why this is happening.

Upvotes: 2

Views: 859

Answers (2)

jaffa
jaffa

Reputation: 61

Makefile is a tricky thing. my-dir is changed when u call sub directories and such. But you can actually solve it without placing the source code in /jni file.

MY_PATH = $(call my-dir)
LOCAL_PATH = $(MY_PATH)

Call 2nd statement before any clear vars. Done!

Upvotes: 1

Nick
Nick

Reputation: 949

After doing some research instead of messing up with makefiles in different directories, I placed source code of library in /jni and compiled it from /jni/Android.mk and the problem is solved. I guess it is the easiest way to do this

Upvotes: 1

Related Questions