UnsatisfiedLinkError libcrypto.so.1.0.0

时间:2019-05-08 20:36:17

标签: java android c++ qt shared-libraries

在较新的Android版本中,应用程序无法以UnsatisfiedLinkError异常启动。 似乎org.qtproject.qt5.android.QtNative.loadBundledLibraries正在尝试加载版本库,但无法加载!

由于我的app.shell.ShellActivity.onCreate()没有直接加载该库(如下所示,其中 system.load),我不知道如何解决该库加载失败。

public class ShellActivity extends QtActivity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);

    if (running) {
        Log.e(TAG, "An instance of this activity is already running!");
        setResult(-2);
        finish();
        System.exit(-2);
        return;
    }
    running = true;
}
}

该库是在.pro中配置的,如下所示,

app_android: contains(ANDROID_TARGET_ARCH,armeabi-v7a) {
LIBS += -L$$PWD/lib/android/ -lcrypto -lssl
ANDROID_EXTRA_LIBS = 
$$PWD/lib/android/libcrypto.so 
$$PWD/lib/android/libssl.so
}

CONFIG += app_android

请注意,该应用程序在其他较低的Android版本(已在4.4和5.1上测试)上运行良好,但在Android 9.0(Pie)上无法运行。

objdump output

libcrypto.so

file format elf32-little
NEEDED libdl.so
NEEDED libc.so
SONAME libcrypto.so

libapp.so

file format elf32-little

  NEEDED               libz.so
  NEEDED               libcrypto.so
  NEEDED               libssl.so
  NEEDED               libQt5Quick.so
  NEEDED               libQt5Multimedia.so
  NEEDED               libQt5Svg.so
  NEEDED               libQt5Widgets.so
  NEEDED               libQt5Gui.so
  NEEDED               libQt5Qml.so
  NEEDED               libQt5Network.so
  NEEDED               libQt5Sql.so
  NEEDED               libQt5SerialPort.so
  NEEDED               libQt5AndroidExtras.so
  NEEDED               libQt5Core.so
  NEEDED               libGLESv2.so
  NEEDED               libgnustl_shared.so
  NEEDED               liblog.so
  NEEDED               libdl.so
  NEEDED               libstdc++.so
  NEEDED               libm.so
  NEEDED               libc.so
  SONAME               libshell.so

堆栈跟踪如下所示。知道如何解决吗?

05-08 14:29:26.513 26065-26065/app.shell W/System: ClassLoader referenced unknown path:
05-08 14:29:26.704 26065-26065/app.shell W/System.err: java.lang.reflect.InvocationTargetException
05-08 14:29:26.705 26065-26065/app.shell W/System.err: at java.lang.reflect.Method.invoke(Native Method)
at org.qtproject.qt5.android.bindings.QtLoader.loadApplication(QtLoader.java:241)
at org.qtproject.qt5.android.bindings.QtLoader.startApp(QtLoader.java:676)
at org.qtproject.qt5.android.bindings.QtActivityLoader.onCreate(QtActivityLoader.java:183)
at org.qtproject.qt5.android.bindings.QtActivity.onCreateHook(QtActivity.java:266)
at org.qtproject.qt5.android.bindings.QtActivity.onCreate(QtActivity.java:273)
at app.shell.ShellActivity.onCreate(ShellActivity.java:41)
at android.app.Activity.performCreate(Activity.java:7326)
at android.app.Activity.performCreate(Activity.java:7317)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1271)
05-08 14:29:26.706 26065-26065/app.shell W/System.err: at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3066)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3229)
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:78)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1926)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:214)
at android.app.ActivityThread.main(ActivityThread.java:6981)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1445)
Caused by: java.lang.UnsatisfiedLinkError: dlopen failed: library "libcrypto.so.1.0.0" not found
at java.lang.Runtime.load0(Runtime.java:928)
at java.lang.System.load(System.java:1633)
at org.qtproject.qt5.android.QtNative.loadBundledLibraries(QtNative.java:209)
at org.qtproject.qt5.android.QtActivityDelegate.loadApplication(QtActivityDelegate.java:599)
... 22 more

SO处提出了一些解决方案,但这是用新的SONAME修补.so文件的方法。在这种情况下,我在小精灵内的SONAME是未版本化的。如果我编辑并添加版本,我想它会破坏已经在较旧的android版本上运行的应用程序,或者完全破坏.so加载/重定位。

有没有主意的原因,为什么没有版本更新的android会尝试加载版本控制的版本?

0 个答案:

没有答案