本文介绍了UnsatisfiedLinkError:dlopen失败:无法找到符号"__aeabi_memcpy4";被引用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚从NDK 12.x更新到13.x,现在出现以下崩溃:

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.

我已经看到与cannot locate symbol有关的一些类似问题,所有建议都围绕在Application.mk文件中设置APP_PLATFORM.我的JNI库是SDK的一部分,所以我没有Application.mk文件-只有Android.mk.我的目标/分钟sdk最近也没有更改.我的Android.mk文件是从库中复制的,看起来像这样:

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

推荐答案

好吧,我想我已经在和

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)使用以下命令添加Application.mk文件:

1) add Application.mk file with the following:

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

2)更新我的build.gradle以指向我的Application.mk,因为gradle显然创建了自己的Android.mk版本,并且默认为与compileSdkVersion中相同的api级别,而不是minSdkVersion.

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.

使用com.android.tools.build:gradle:2.2.0可以通过添加以下内容来实现(有关更多详细信息,请参见上面提到的JNI SO帖子):

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

这篇关于UnsatisfiedLinkError:dlopen失败:无法找到符号"__aeabi_memcpy4";被引用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-13 22:07