I added some new functionality in C and when I try to build it, it gives me the following error:
libnativehelper/include/nativehelper/JNIHelp.h:116: error: undefined reference to 'jniRegisterNativeMethods' error.
I have included jnihelp.h
in my C files.
Is this a makefile related issue or am I missing something?
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE_TAGS := optional
LOCAL_MODULE := newfile
LOCAL_SRC_FILES := newfile.cpp
include $(BUILD_SHARED_LIBRARY)
EDIT 6/5/14: I finally fixed it. Just thought I'd put all the info here in case someone else needs it.
undefined reference to 'jniRegisterNativeMethods'
error extern "C"
block. This was causing the UnsatisfiedLinkError. You need to go to parent folder where you have your build and dalvik binaries. Then from there you need to type:
build yourproj
(replace yourproj with folder you have your codes in it)
I found the issue was indeed in the makefile I looked around for other JNI implementations and added this to the makefile
LOCAL_SHARED_LIBRARIES := \
libandroid_runtime \
libandroidfw \
libnativehelper \
libRS \
libcutils \
libskia \
libutils
I have no idea what a few of the libraries in there are for, but I left them there and it compiled. Now I have a different issue. I get the 'Unsatified Link error' when I load the compiled library. Does anyone have an idea on this?
Edit: My compiled libraries are being transferred to the phone. I manually pushed them onto the /system/lib directory on the phone but I still get the 'UnsatisfiedLinkError'.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.