Yes, you do need to add: LOCAL_LDLIBS := -llog
as the other answers/comments have specified, however the original question did not specify if he use the jni library as: LOCAL_JNI_SHARED_LIBRARIES
or as LOCAL_REQUIRED_MODULES
.
I can pretty much say for sure that he has it used it as: LOCAL_REQUIRED_MODULES
because of the LOCAL_EXPORT_LDLIBS := -llog
in the question... unless that was added after an edit.
If you use LOCAL_REQUIRED_MODULES
the shared library is installed in /system/lib instead of into the apk, because it is a required module. Therefore you will need to add LOCAL_LDLIBS := -L$(SYSROOT)/usr/lib -llog
instead of just LOCAL_LDLIBS := -llog
so that when the build system is building & linking the jni shared library, it will have the -llog
definitions in the correct place, available to be built under $OUT/root/system/lib
. Otherwise you will continue to get the same answer, even if you only add LOCAL_LDLIBS := -llog
.
So, those who commented that the -L
is not needed, and the other answer was correct, they were actually incorrect in this situation.