UnsatisfiedLinkError: dlopen failed: cannot locate symbol “__aeabi_memcpy4” referenced by

匿名 (未验证) 提交于 2019-12-03 01:17:01

问题:

I've just updated from NDK 12.x to 13.x and now I'm getting the following crash:

Caused by: java.lang.UnsatisfiedLinkError: dlopen failed: cannot locate symbol "__aeabi_memcpy4" referenced by "/data/app/com.app.myapp-1/lib/arm/libJniBitmapOperationsLibrary.so"...   at java.lang.Runtime.loadLibrary(Runtime.java:372)   at java.lang.System.loadLibrary(System.java:1076)   at com.jni.bitmap_operations.JniBitmapHolder.<clinit>(JniBitmapHolder.java:11)   <...> 

The library I'm using is available here.

I've seen a few similar issues on SO to do with cannot locate symbol and all the suggestions were around setting APP_PLATFORM in the Application.mk file. My JNI library is part of the SDK so I don't have Application.mk file - only Android.mk. Also my target/min sdk didn't change recently. My Android.mk file is copied from the library and looks like this:

LOCAL_PATH := $(call my-dir)  #bitmap operations module include $(CLEAR_VARS)  LOCAL_MODULE    := JniBitmapOperationsLibrary LOCAL_SRC_FILES := JniBitmapOperationsLibrary.cpp LOCAL_LDLIBS := -llog LOCAL_LDFLAGS += -ljnigraphics  include $(BUILD_SHARED_LIBRARY) APP_OPTIM := debug LOCAL_CFLAGS := -g 

回答1:

Ok, I think I've figured out an answer with the help of JNI and Gradle in Android Studio and Android NDK : Getting java.lang.UnsatisfiedLinkError: dlopen failed: cannot locate symbol "signal" referenced by "libffmpeg.so"

The solution for me was to do the following:

1) add Application.mk file with the following:

APP_CFLAGS += -I$(LOCAL_PATH)   APP_ABI := all   APP_PLATFORM := android-19  

2) update my build.gradle to point at my Application.mk as apparently gradle creates its own version of Android.mk and defaults to the same api level as you have in compileSdkVersion not minSdkVersion.

With com.android.tools.build:gradle:2.2.0 this can be achieved by adding the following (for more details check out the JNI SO post mentioned above):

externalNativeBuild {     ndkBuild {         path 'src/main/jni/Application.mk'     } } 

Also, you probably don't need both steps one and two, but I've spent too much time on this already to verify



标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!