Please nominate your Qt Champions for 2021! https://forum.qt.io/topic/132134/looking-for-the-2021-qt-champions

Android app crashes with UnsatifiedLinkError - which NDK/SDK to use?



  • I have inherited the code for an app, and am currently trying to build a working APK.

    I thought the build was working (generated a APK) but when running it on a VirtuallBox Android x86 emulator it crashed, indicating the issue was the build target was ARM, not x86.

    I looked closely at the scripts and there were a number of ANDROID_NDK variables in the shell script. I tried experimenting but I am unable to get the app to run . I tried the app on a Android tablet as well and it crashed there too.

    #!/bin/bash
    
    export ANDROID_NDK_ROOT=/opt/android-ndk/android-ndk-r19c
    export ANDROID_SDK_ROOT=/shared/DevTools/Android/SDK-r25.2.5
    
    export ANDROID_HOME=/usr/lib/android-sdk
    export ANDROID_NDK_HOST=linux-x86_64
    export ANDROID_NDK_PLATFORM=android-21
    export ANDROID_TARGET_PLATFORM=android-21
    
    export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64
    
    export ANDROID_NDK_TOOLCHAIN_VERSION=4.9
    export ANDROID_NDK_TOOLCHAIN_PREFIX=x86
    export ANDROID_NDK_TOOLS_PREFIX=x86
    
    export ANDROID_TARGET_ARCH=x86
    
    QT_AND_PATH=/opt/Qt5.12.3/5.12.3/android_x86/bin
    
    PACKAGE_NAME=MyApp
    
    BUILD_OUT=/tmpbuild/android-$PACKAGE_NAME
    
    OUTPUT_PATH=$BUILD_OUT/build/outputs/apk/release
    
    rm -rf $BUILD_OUT
    
    
    $QT_AND_PATH/qmake $PACKAGE_NAME.pro -r -spec android-clang "CONFIG+=release" DEFINES+= LIB_PATH=$DEPENDENCIES_PATH
    
    # make
    
    make -j $THREADS > /dev/null
    
    
    make install INSTALL_ROOT=$BUILD_OUT > /dev/null
    
    VB="--verbose"
    
    CERTFILE=/certs/MyAppe.keystore.2021
    PWD_KEYSTORE=MyPass2021
    PWD_KEY=MySKPass2021
    
    
    $QT_AND_PATH/androiddeployqt $VB --output $BUILD_OUT --input android-libMyApp.so-deployment-settings.json --deployment bundled --android-platform $ANDROID_TARGET_PLATFORM --gradle --sign $CERTFILE softoffice --storepass $PWD_KEYSTORE --keypass $PWD_KEY 
    

    When I install and run the app I get the following errors in logcat:

    "/data/app/com.MyCo.MyApp=xxxxxxxx==/lib/x86/libc++_shared.so" dynamic section header wast not found
    FATA EXCEPTION: qtMainLoopThread
    java.lang.UnsatisfiedLinkError: dlopen failed:"/data/app/com.MyCo.MyApp=xxxxxxxx==/lib/x86/libc++_shared.so" dynamic section header wast not found
    

    The APK unzip -l gives:

      Length      Date    Time    Name
    ---------  ---------- -----   ----
        10540  00-00-1980 00:00   AndroidManifest.xml
        16728  00-00-1980 00:00   assets/--Added-by-androiddeployqt--/qml/QtMultimedia/Video.qml
        65491  00-00-1980 00:00   assets/--Added-by-androiddeployqt--/qml/QtMultimedia/plugins.qmltypes
          135  00-00-1980 00:00   assets/--Added-by-androiddeployqt--/qml/QtMultimedia/qmldir
       198307  00-00-1980 00:00   assets/--Added-by-androiddeployqt--/qml/QtQuick.2/plugins.qmltypes
          106  00-00-1980 00:00   assets/--Added-by-androiddeployqt--/qml/QtQuick.2/qmldir
         2928  00-00-1980 00:00   assets/--Added-by-androiddeployqt--/qml/QtWebView/plugins.qmltypes
           95  00-00-1980 00:00   assets/--Added-by-androiddeployqt--/qml/QtWebView/qmldir
          824  00-00-1980 00:00   assets/--Added-by-androiddeployqt--/qt_cache_pregenerated_file_list
       211144  00-00-1980 00:00   classes.dex
     20166252  00-00-1980 00:00   lib/x86/libMyApp.so
       104312  00-00-1980 00:00   lib/x86/libQt5AndroidExtras.so
      6362324  00-00-1980 00:00   lib/x86/libQt5Core.so
      5659044  00-00-1980 00:00   lib/x86/libQt5Gui.so
       774908  00-00-1980 00:00   lib/x86/libQt5Multimedia.so
       107704  00-00-1980 00:00   lib/x86/libQt5MultimediaQuick.so
      1471036  00-00-1980 00:00   lib/x86/libQt5Network.so
       135212  00-00-1980 00:00   lib/x86/libQt5NetworkAuth.so
       339104  00-00-1980 00:00   lib/x86/libQt5PrintSupport.so
      4654944  00-00-1980 00:00   lib/x86/libQt5Qml.so
      4224308  00-00-1980 00:00   lib/x86/libQt5Quick.so
       489524  00-00-1980 00:00   lib/x86/libQt5QuickParticles.so
      2030824  00-00-1980 00:00   lib/x86/libQt5Script.so
       336888  00-00-1980 00:00   lib/x86/libQt5Svg.so
        69916  00-00-1980 00:00   lib/x86/libQt5WebView.so
      6077740  00-00-1980 00:00   lib/x86/libQt5Widgets.so
       251444  00-00-1980 00:00   lib/x86/libQt5Xml.so
       996828  00-00-1980 00:00   lib/x86/libc++_shared.so
        59576  00-00-1980 00:00   lib/x86/libplugins_audio_libqtaudio_opensles.so
        52116  00-00-1980 00:00   lib/x86/libplugins_bearer_libqandroidbearer.so
        30288  00-00-1980 00:00   lib/x86/libplugins_iconengines_libqsvgicon.so
        26040  00-00-1980 00:00   lib/x86/libplugins_imageformats_libqgif.so
        34828  00-00-1980 00:00   lib/x86/libplugins_imageformats_libqicns.so
        26116  00-00-1980 00:00   lib/x86/libplugins_imageformats_libqico.so
       403152  00-00-1980 00:00   lib/x86/libplugins_imageformats_libqjpeg.so
        17932  00-00-1980 00:00   lib/x86/libplugins_imageformats_libqsvg.so
        13720  00-00-1980 00:00   lib/x86/libplugins_imageformats_libqtga.so
       427980  00-00-1980 00:00   lib/x86/libplugins_imageformats_libqtiff.so
        13764  00-00-1980 00:00   lib/x86/libplugins_imageformats_libqwbmp.so
       657292  00-00-1980 00:00   lib/x86/libplugins_imageformats_libqwebp.so
       350016  00-00-1980 00:00   lib/x86/libplugins_mediaservice_libqtmedia_android.so
      1170648  00-00-1980 00:00   lib/x86/libplugins_platforms_android_libqtforandroid.so
        17868  00-00-1980 00:00   lib/x86/libplugins_playlistformats_libqtmultimedia_m3u.so
       151476  00-00-1980 00:00   lib/x86/libplugins_qmltooling_libqmldbg_debugger.so
        68208  00-00-1980 00:00   lib/x86/libplugins_qmltooling_libqmldbg_inspector.so
        13732  00-00-1980 00:00   lib/x86/libplugins_qmltooling_libqmldbg_local.so
        13796  00-00-1980 00:00   lib/x86/libplugins_qmltooling_libqmldbg_messages.so
        22144  00-00-1980 00:00   lib/x86/libplugins_qmltooling_libqmldbg_native.so
        45284  00-00-1980 00:00   lib/x86/libplugins_qmltooling_libqmldbg_nativedebugger.so
        80804  00-00-1980 00:00   lib/x86/libplugins_qmltooling_libqmldbg_preview.so
        63472  00-00-1980 00:00   lib/x86/libplugins_qmltooling_libqmldbg_profiler.so
        21968  00-00-1980 00:00   lib/x86/libplugins_qmltooling_libqmldbg_quickprofiler.so
        55388  00-00-1980 00:00   lib/x86/libplugins_qmltooling_libqmldbg_server.so
        13732  00-00-1980 00:00   lib/x86/libplugins_qmltooling_libqmldbg_tcp.so
        88320  00-00-1980 00:00   lib/x86/libplugins_styles_libqandroidstyle.so
        17896  00-00-1980 00:00   lib/x86/libplugins_video_videonode_libqtsgvideonode_android.so
        26500  00-00-1980 00:00   lib/x86/libplugins_webview_libqtwebview_android.so
       290664  00-00-1980 00:00   lib/x86/libqml_QtMultimedia_libdeclarative_multimedia.so
         9516  00-00-1980 00:00   lib/x86/libqml_QtQuick.2_libqtquick2plugin.so
        22124  00-00-1980 00:00   lib/x86/libqml_QtWebView_libdeclarative_webview.so
     43512412  00-00-1980 00:00   lib/x86/libvlc.so
        42026  00-00-1980 00:00   res/drawable-ldpi-v4/icon.png
          324  00-00-1980 00:00   res/layout/splash.xml
        15200  00-00-1980 00:00   resources.arsc
         6140  00-00-1980 00:00   META-INF/MYCO.SF
         1417  00-00-1980 00:00   META-INF/MYCO.RSA
         6094  00-00-1980 00:00   META-INF/MANIFEST.MF
    ---------                     -------
    102648583                     67 files
    
    

    Running aapt dump badging MyApp.apk gives:

    package: name='com.MyCo.MyApp' versionCode='1' versionName='4.0.2.900' platformBuildVersionName='4.0.2.900'
    install-location:'auto'
    sdkVersion:'16'
    targetSdkVersion:'29'
    uses-permission: name='android.permission.INTERNET'
    uses-permission: name='android.permission.WRITE_EXTERNAL_STORAGE'
    uses-permission: name='android.permission.ACCESS_NETWORK_STATE'
    uses-permission: name='android.permission.CAMERA'
    uses-permission: name='android.permission.RECORD_AUDIO'
    uses-permission: name='android.permission.ACCESS_FINE_LOCATION'
    uses-permission: name='android.permission.WRITE_EXTERNAL_STORAGE'
    uses-permission: name='android.permission.INTERNET'
    uses-permission: name='android.permission.READ_EXTERNAL_STORAGE'
    application-label:'MyApp'
    application-label-de:'MyApp'
    application-label-el:'MyApp'
    application-label-es:'MyApp'
    application-label-et:'MyApp'
    application-label-fa:'MyApp'
    application-label-fr:'MyApp'
    application-label-in:'MyApp'
    application-label-it:'MyApp'
    application-label-ja:'MyApp'
    application-label-ms:'MyApp'
    application-label-nb:'MyApp'
    application-label-nl:'MyApp'
    application-label-pl:'MyApp'
    application-label-pt-BR:'MyApp'
    application-label-ro:'MyApp'
    application-label-rs:'MyApp'
    application-label-ru:'MyApp'
    application-label-zh-CN:'MyApp'
    application-label-zh-TW:'MyApp'
    application-icon-120:'res/drawable-ldpi-v4/icon.png'
    application-icon-160:'res/drawable-ldpi-v4/icon.png'
    application: label='MyApp' icon='res/drawable-ldpi-v4/icon.png'
    launchable-activity: name='org.qtproject.qt5.android.bindings.QtActivity'  label='MyApp' icon=''
    uses-library-not-required:'com.sec.android.app.multiwindow'
    feature-group: label=''
      uses-gl-es: '0x20000'
      uses-feature-not-required: name='android.hardware.camera'
      uses-feature-not-required: name='android.hardware.camera.autofocus'
      uses-feature-not-required: name='android.hardware.microphone'
      uses-feature: name='android.hardware.faketouch'
      uses-implied-feature: name='android.hardware.faketouch' reason='default feature for all apps'
      uses-feature: name='android.hardware.location'
      uses-implied-feature: name='android.hardware.location' reason='requested android.permission.ACCESS_FINE_LOCATION permission'
    main
    supports-screens: 'small' 'normal' 'large' 'xlarge'
    supports-any-density: 'true'
    locales: '--_--' 'de' 'el' 'es' 'et' 'fa' 'fr' 'in' 'it' 'ja' 'ms' 'nb' 'nl' 'pl' 'pt-BR' 'ro' 'rs' 'ru' 'zh-CN' 'zh-TW'
    densities: '120' '160'
    native-code: 'x86'
    





Log in to reply