UnsatisfiedLinkError from qt5.android.QtNative.loadBundledLibraries on Android Pie



  • In newer Android versions, the application is failing to start with UnsatisfiedLinkError exception.
    It looks like the org.qtproject.qt5.android.QtNative.loadBundledLibraries is trying to load the versioned library but is not able to!

    Since my app.shell.ShellActivity.onCreate() is not loading the lib directly (shown below), I dont have any idea how to tackle this lib loading failure.

    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;
    }
    

    }

    The lib is configured in .pro as shown below,

    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
    

    Please note that the application is running fine in other lower android versions, (tested on 4.4, and 5.1) but failing on Android 9.0 (Pie).
    objdump output.
    file format elf32-little
    NEEDED libdl.so
    NEEDED libc.so
    SONAME libcrypto.so

    The stacktrace is as shown below. Any idea how to solve it?

    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



  • Ive always built my libs without versions, then linked with them directly.



  • Linking works..
    apk got created...
    App works perfectly in 4.4 (android-19) and 5.1 (android-21).
    But when i tested it on 9.0 (Android Pie), app crashed.

    So I guess org.qtproject.qt5.android.QtNative.loadBundledLibraries has something to do with library loading (versioned and non-versioned) in latest android versions (Atleast I know my app is crashing on Android Pie).


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.