Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt Creator and other tools
  4. Testing Android APK with QtCreator fails with an error.
Forum Updated to NodeBB v4.3 + New Features

Testing Android APK with QtCreator fails with an error.

Scheduled Pinned Locked Moved Unsolved Qt Creator and other tools
29 Posts 4 Posters 396 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • SMF-QtS Offline
    SMF-QtS Offline
    SMF-Qt
    wrote last edited by
    #1

    I am trying to set up a Qt environment for Android.
    I started by building a test application manually see thread [https://forum.qt.io/topic/162514/building-qt-6.9.1-for-android-with-ssl-support.].
    I have now moved my test project to QtCreator and have made progress in as much as the application (both release and debug) compile and signed APK files have been produced.
    However when I try to test the package in QtCreator I get the following error report:

    09:40:30: No Android architecture (ABI) is set by the project.
    09:40:30: Error while building/deploying project QtTest (kit: arm-linux-android-elf-64bit)
    09:40:30: When executing step "Deploy to Android device"

    I did find an earlier post with a similar Issue [https://forum.qt.io/post/737665] but it was not resolved I think.

    I am looking to run the application in a emulator before I risk putting it on a physical phone or tablet.

    So my initial thinking is that my .pro file is missing some settings to set the Android ABI, I have added "ANDROID_ABIS = arm64-v8a" but this has made no difference.

    Any suggestions would be welcome.

    1 Reply Last reply
    0
    • SMF-QtS Offline
      SMF-QtS Offline
      SMF-Qt
      wrote last edited by
      #2

      I have also tried adding:

      ANDROID_ABI_VERSION = 31

      To the .pro file to no effect.

      1 Reply Last reply
      0
      • piervalliP Offline
        piervalliP Offline
        piervalli
        wrote last edited by
        #3

        What is version of Qt creator and Qt?
        QtTest (kit: arm-linux-android-elf-64bit)
        Abi should be armeabi-v7a, arm64-v8a, x86, x86_64.

        1 Reply Last reply
        0
        • piervalliP Offline
          piervalliP Offline
          piervalli
          wrote last edited by
          #4

          Personally I use Qt5 but there is the same filosofy, you don't need rebuild Qt for support for ssl, you need only the library
          https://github.com/KDAB/android_openssl
          In this there are the library of open ssl for Qt

          1 Reply Last reply
          0
          • SMF-QtS Offline
            SMF-QtS Offline
            SMF-Qt
            wrote last edited by
            #5

            When I introduce qtcreator I included the pre-built ssl for Qt.
            Here is a list of the relevant software versions I currently have available:
            Qt 6.9.1
            OpenJDK 22.0.2
            QtCreator 17.0.0
            SDK 19.0
            NDK 29.0.135998797
            Gradle 8.12

            1 Reply Last reply
            0
            • SMF-QtS Offline
              SMF-QtS Offline
              SMF-Qt
              wrote last edited by
              #6

              Question, why should the ABI include armeabi-v7a, arm64-v8a, x86, x86_64 when I am only interested in an arm64-v8a deployment?
              Thanks.

              1 Reply Last reply
              0
              • piervalliP Offline
                piervalliP Offline
                piervalli
                wrote last edited by
                #7

                you can include whatever you want. Google added many abi to support many hardware.arm64-v8a is for modern hardware.

                1 Reply Last reply
                0
                • SMF-QtS Offline
                  SMF-QtS Offline
                  SMF-Qt
                  wrote last edited by
                  #8

                  Ok, I have now been given the correct way to include ssl in my Qt6 build [https://forum.qt.io/topic/162514/building-qt-6.9.1-for-android-with-ssl-support.].

                  As part of that excercise I have changed some of the system packages specifically:
                  jdk-17.0.12 and NDK 27.2.12479018.

                  My android Qt build is in /opt/qt-android as before and if I run /opt/qt-android/bin/qmake6 against my QtTest.pro file and run make I get a arm64-v8a build.
                  If I try and build using qtcreator even though I think I have reconfigured it for the new jdk and ndk and have given it /opt/qt-android for the Qt environment it errors with:

                  14:52:44: No Qt version configured.
                  14:52:44: Error while building/deploying project QtTest (kit: Qt 6.9.1 (qt-6.9.1))
                  14:52:44: When executing step "qmake"

                  Obviously I have miss configured my QtCreator setup when I introduced these changes but I cannot see where, any suggestions are welcome.

                  SMF-QtS 1 Reply Last reply
                  0
                  • SMF-QtS SMF-Qt

                    Ok, I have now been given the correct way to include ssl in my Qt6 build [https://forum.qt.io/topic/162514/building-qt-6.9.1-for-android-with-ssl-support.].

                    As part of that excercise I have changed some of the system packages specifically:
                    jdk-17.0.12 and NDK 27.2.12479018.

                    My android Qt build is in /opt/qt-android as before and if I run /opt/qt-android/bin/qmake6 against my QtTest.pro file and run make I get a arm64-v8a build.
                    If I try and build using qtcreator even though I think I have reconfigured it for the new jdk and ndk and have given it /opt/qt-android for the Qt environment it errors with:

                    14:52:44: No Qt version configured.
                    14:52:44: Error while building/deploying project QtTest (kit: Qt 6.9.1 (qt-6.9.1))
                    14:52:44: When executing step "qmake"

                    Obviously I have miss configured my QtCreator setup when I introduced these changes but I cannot see where, any suggestions are welcome.

                    SMF-QtS Offline
                    SMF-QtS Offline
                    SMF-Qt
                    wrote last edited by
                    #9

                    @SMF-Qt

                    Going to answer my own question here, for other reasons I had to reboot my android system on re-entering qtcreator I found that my test application would compile however because of other problems I still cannot move forward see [https://forum.qt.io/topic/162567/update-on-android-15-new-page-size-memory-16kb] for one the other is that qtcreator won't talk to my test phone: (android studio does talk to the the test phone but won't download the APK file because of the 4k/16k issue)

                    18:01:15: The deployment AVD "TestPhone" cannot be started.
                    18:01:15: Error while building/deploying project QtWeather (kit: Android QtAndroid Clang arm64-v8a)
                    18:01:15: When executing step "Deploy to Android device"

                    Any help on ether would be good.

                    Thanks

                    1 Reply Last reply
                    0
                    • piervalliP Offline
                      piervalliP Offline
                      piervalli
                      wrote last edited by
                      #10

                      If you build APK without deploy, can you install with adb install app.apk?

                      SMF-QtS 1 Reply Last reply
                      0
                      • piervalliP piervalli

                        If you build APK without deploy, can you install with adb install app.apk?

                        SMF-QtS Offline
                        SMF-QtS Offline
                        SMF-Qt
                        wrote last edited by SMF-Qt
                        #11

                        @piervalli

                        Yes that seems to work:

                        /opt/android/sdk/platform-tools/adb install android-build-debug.apk

                        • daemon not running; starting now at tcp:5037
                        • daemon started successfully
                          Performing Streamed Install
                          Success
                        SMF-QtS 1 Reply Last reply
                        0
                        • SMF-QtS SMF-Qt

                          @piervalli

                          Yes that seems to work:

                          /opt/android/sdk/platform-tools/adb install android-build-debug.apk

                          • daemon not running; starting now at tcp:5037
                          • daemon started successfully
                            Performing Streamed Install
                            Success
                          SMF-QtS Offline
                          SMF-QtS Offline
                          SMF-Qt
                          wrote last edited by
                          #12

                          @SMF-Qt

                          I now have a new phone device in qtcreator and it gives me the option to use wifi for the connection.
                          The phone icon in the bottom left corner has a green blob on it with the identity SM-A065F(WIFI).

                          The debug session progresses a way further now but stops with the following error:

                          E/AndroidRuntime: FATAL EXCEPTION: qtMainLoopThread
                          E/AndroidRuntime: Process: org.qtproject.example.QtTest, PID: 21601
                          E/AndroidRuntime: java.lang.UnsatisfiedLinkError: dlopen failed: library "libssl_3.so" not found: needed by /data/app/~~p7huhxUk2n2nIc_1qxEgbQ==/org.qtproject.example.QtTest-rOiQXpwVmnydsevwxdlG2g==/base.apk!/lib/arm64-v8a/libQt6Network_arm64-v8a.so in namespace clns-4
                          E/AndroidRuntime: at java.lang.Runtime.loadLibrary0(Runtime.java:1090)
                          E/AndroidRuntime: at java.lang.Runtime.loadLibrary0(Runtime.java:1012)
                          E/AndroidRuntime: at java.lang.System.loadLibrary(System.java:1765)
                          E/AndroidRuntime: at org.qtproject.qt.android.QtLoader.loadLibraryHelper(QtLoader.java:478)
                          E/AndroidRuntime: at org.qtproject.qt.android.QtLoader.lambda$loadLibraries$1$org-qtproject-qt-android-QtLoader(QtLoader.java:554)
                          E/AndroidRuntime: at org.qtproject.qt.android.QtLoader$$ExternalSyntheticLambda0.run(D8$$SyntheticClass:0)
                          E/AndroidRuntime: at org.qtproject.qt.android.QtThread.lambda$run$0(QtThread.java:57)
                          E/AndroidRuntime: at org.qtproject.qt.android.QtThread$$ExternalSyntheticLambda0.run(D8$$SyntheticClass:0)
                          E/AndroidRuntime: at org.qtproject.qt.android.QtThread$1.run(QtThread.java:25)
                          E/AndroidRuntime: at java.lang.Thread.run(Thread.java:1119)
                          I/Process : Sending signal. PID: 21601 SIG: 9

                          Looks like I need to copy the ssl libraries to a place where they can be included in the project apk file.

                          SMF-QtS 1 Reply Last reply
                          0
                          • SMF-QtS SMF-Qt

                            @SMF-Qt

                            I now have a new phone device in qtcreator and it gives me the option to use wifi for the connection.
                            The phone icon in the bottom left corner has a green blob on it with the identity SM-A065F(WIFI).

                            The debug session progresses a way further now but stops with the following error:

                            E/AndroidRuntime: FATAL EXCEPTION: qtMainLoopThread
                            E/AndroidRuntime: Process: org.qtproject.example.QtTest, PID: 21601
                            E/AndroidRuntime: java.lang.UnsatisfiedLinkError: dlopen failed: library "libssl_3.so" not found: needed by /data/app/~~p7huhxUk2n2nIc_1qxEgbQ==/org.qtproject.example.QtTest-rOiQXpwVmnydsevwxdlG2g==/base.apk!/lib/arm64-v8a/libQt6Network_arm64-v8a.so in namespace clns-4
                            E/AndroidRuntime: at java.lang.Runtime.loadLibrary0(Runtime.java:1090)
                            E/AndroidRuntime: at java.lang.Runtime.loadLibrary0(Runtime.java:1012)
                            E/AndroidRuntime: at java.lang.System.loadLibrary(System.java:1765)
                            E/AndroidRuntime: at org.qtproject.qt.android.QtLoader.loadLibraryHelper(QtLoader.java:478)
                            E/AndroidRuntime: at org.qtproject.qt.android.QtLoader.lambda$loadLibraries$1$org-qtproject-qt-android-QtLoader(QtLoader.java:554)
                            E/AndroidRuntime: at org.qtproject.qt.android.QtLoader$$ExternalSyntheticLambda0.run(D8$$SyntheticClass:0)
                            E/AndroidRuntime: at org.qtproject.qt.android.QtThread.lambda$run$0(QtThread.java:57)
                            E/AndroidRuntime: at org.qtproject.qt.android.QtThread$$ExternalSyntheticLambda0.run(D8$$SyntheticClass:0)
                            E/AndroidRuntime: at org.qtproject.qt.android.QtThread$1.run(QtThread.java:25)
                            E/AndroidRuntime: at java.lang.Thread.run(Thread.java:1119)
                            I/Process : Sending signal. PID: 21601 SIG: 9

                            Looks like I need to copy the ssl libraries to a place where they can be included in the project apk file.

                            SMF-QtS Offline
                            SMF-QtS Offline
                            SMF-Qt
                            wrote last edited by
                            #13

                            @SMF-Qt

                            The ssl libraries are now in the /opt/qt-android/lib directory and the build, deploy and debug session progresses until:

                            0:23:29: The command "/opt/android/sdk/platform-tools/adb -s 192.168.0.50:5555 pull /system/bin/app_process64 /work/Qt-Android/QtTest-V1.1.5c/application/build/Android_QtAndroid_Clang_arm64_v8a-Debug/android-app-process/app_process" terminated with exit code 1.
                            10:23:29: Package deploy: Failed to pull "/system/bin/app_process64" to "/work/Qt-Android/QtTest-V1.1.5c/application/build/Android_QtAndroid_Clang_arm64_v8a-Debug/android-app-process/app_process".

                            Looks like I am missing a component of some sort but I don't know what, suggestions welcome.

                            thanks

                            1 Reply Last reply
                            0
                            • piervalliP Offline
                              piervalliP Offline
                              piervalli
                              wrote last edited by
                              #14

                              in the main put qputenv("QT_DEBUG_PLUGINS", QByteArray("1")); it shows the logs of plugins

                              int main(int argc, char *argv[])
                              {
                                  qputenv("QT_DEBUG_PLUGINS", QByteArray("1"));
                                 QGuiApplication app(argc, argv);
                                  QQmlApplicationEngine engine;
                              ....
                              }
                              
                              SMF-QtS 1 Reply Last reply
                              0
                              • piervalliP piervalli

                                in the main put qputenv("QT_DEBUG_PLUGINS", QByteArray("1")); it shows the logs of plugins

                                int main(int argc, char *argv[])
                                {
                                    qputenv("QT_DEBUG_PLUGINS", QByteArray("1"));
                                   QGuiApplication app(argc, argv);
                                    QQmlApplicationEngine engine;
                                ....
                                }
                                
                                SMF-QtS Offline
                                SMF-QtS Offline
                                SMF-Qt
                                wrote last edited by SMF-Qt
                                #15

                                @piervalli said in Testing Android APK with QtCreator fails with an error.:

                                qputenv("QT_DEBUG_PLUGINS", QByteArray("1"));

                                I added that call but no difference. I have a break point set on that line of code (it is the first executable line in my program) and it is not being reached.
                                I have checked that the Java is linking against my main (renaming it caused the build to fail with a missing symbol error).
                                When I start the debugger the phone shows a white screen with an android symbol on it and a message about waiting for the debugger it then closes after a few seconds.
                                The same symbol is present on my phones desktop which when clicked shows the white screen and android symbol briefly, sometimes there is a message about there being a bug in the app,

                                1 Reply Last reply
                                0
                                • piervalliP Offline
                                  piervalliP Offline
                                  piervalli
                                  wrote last edited by
                                  #16

                                  the variable QT_DEBUG_PLUGINS shows logs when Qt loads the libraries, it is useful app crash on startup. To checks it you should checks the log ex. adb logcat findstr "Qt" or similar

                                  SMF-QtS 1 Reply Last reply
                                  0
                                  • piervalliP piervalli

                                    the variable QT_DEBUG_PLUGINS shows logs when Qt loads the libraries, it is useful app crash on startup. To checks it you should checks the log ex. adb logcat findstr "Qt" or similar

                                    SMF-QtS Offline
                                    SMF-QtS Offline
                                    SMF-Qt
                                    wrote last edited by
                                    #17

                                    @piervalli

                                    A lot of data to look at, here are the last few lines that reference QtTest (edited to get passed spam filter), I could not see anything obviously when looking at the log overall.

                                    qt.core.plugin.factoryloader: looking at "libplugins_platforms_qtforandroid_arm64-v8a.so"
                                    qt.core.plugin.loader: Found metadata in lib /data/app/~~XIK_3oK5DKj4Pv2epcGJwQ==/org.qtproject.example.QtTest-z9izm4KcYpYvGHTt3ypwhw==/base.apk!/lib/arm64-v8a/libplugins_platforms_qtforandroid_arm64-v8a.so, metadata=
                                    qt.core.library: "/data/app/~~XIK_3oK5DKj4Pv2epcGJwQ==/org.qtproject.example.QtTest-z9izm4KcYpYvGHTt3ypwhw==/base.apk!/lib/arm64-v8a/libplugins_platforms_qtforandroid_arm64-v8a.so" loaded library
                                    qt.core.plugin.factoryloader: looking at "libplugins_styles_qandroidstyle_arm64-v8a.so"
                                    qt.core.plugin.loader: Found metadata in lib /data/app/~~XIK_3oK5DKj4Pv2epcGJwQ==/org.qtproject.example.QtTest-z9izm4KcYpYvGHTt3ypwhw==/base.apk!/lib/arm64-v8a/libplugins_styles_qandroidstyle_arm64-v8a.so, metadata=
                                    qt.core.plugin.factoryloader: looking at "libplugins_sqldrivers_qsqlite_arm64-v8a.so"
                                    qt.core.plugin.loader: Found metadata in lib /data/app/~~XIK_3oK5DKj4Pv2epcGJwQ==/org.qtproject.example.QtTest-z9izm4KcYpYvGHTt3ypwhw==/base.apk!/lib/arm64-v8a/libplugins_sqldrivers_qsqlite_arm64-v8a.so, metadata=
                                    qt.core.library: "/data/app/~~XIK_3oK5DKj4Pv2epcGJwQ==/org.qtproject.example.QtTest-z9izm4KcYpYvGHTt3ypwhw==/base.apk!/lib/arm64-v8a/libplugins_platforms_qtforandroid_arm64-v8a.so" unloaded library

                                    SMF-QtS 1 Reply Last reply
                                    0
                                    • SMF-QtS SMF-Qt

                                      @piervalli

                                      A lot of data to look at, here are the last few lines that reference QtTest (edited to get passed spam filter), I could not see anything obviously when looking at the log overall.

                                      qt.core.plugin.factoryloader: looking at "libplugins_platforms_qtforandroid_arm64-v8a.so"
                                      qt.core.plugin.loader: Found metadata in lib /data/app/~~XIK_3oK5DKj4Pv2epcGJwQ==/org.qtproject.example.QtTest-z9izm4KcYpYvGHTt3ypwhw==/base.apk!/lib/arm64-v8a/libplugins_platforms_qtforandroid_arm64-v8a.so, metadata=
                                      qt.core.library: "/data/app/~~XIK_3oK5DKj4Pv2epcGJwQ==/org.qtproject.example.QtTest-z9izm4KcYpYvGHTt3ypwhw==/base.apk!/lib/arm64-v8a/libplugins_platforms_qtforandroid_arm64-v8a.so" loaded library
                                      qt.core.plugin.factoryloader: looking at "libplugins_styles_qandroidstyle_arm64-v8a.so"
                                      qt.core.plugin.loader: Found metadata in lib /data/app/~~XIK_3oK5DKj4Pv2epcGJwQ==/org.qtproject.example.QtTest-z9izm4KcYpYvGHTt3ypwhw==/base.apk!/lib/arm64-v8a/libplugins_styles_qandroidstyle_arm64-v8a.so, metadata=
                                      qt.core.plugin.factoryloader: looking at "libplugins_sqldrivers_qsqlite_arm64-v8a.so"
                                      qt.core.plugin.loader: Found metadata in lib /data/app/~~XIK_3oK5DKj4Pv2epcGJwQ==/org.qtproject.example.QtTest-z9izm4KcYpYvGHTt3ypwhw==/base.apk!/lib/arm64-v8a/libplugins_sqldrivers_qsqlite_arm64-v8a.so, metadata=
                                      qt.core.library: "/data/app/~~XIK_3oK5DKj4Pv2epcGJwQ==/org.qtproject.example.QtTest-z9izm4KcYpYvGHTt3ypwhw==/base.apk!/lib/arm64-v8a/libplugins_platforms_qtforandroid_arm64-v8a.so" unloaded library

                                      SMF-QtS Offline
                                      SMF-QtS Offline
                                      SMF-Qt
                                      wrote last edited by
                                      #18

                                      @SMF-Qt

                                      This is the entry for the main QtTest library:

                                      nativeloader: Load /data/app/~~XIK_3oK5DKj4Pv2epcGJwQ==/org.qtproject.example.QtTest-z9izm4KcYpYvGHTt3ypwhw==/base.apk!/lib/arm64-v8a/libQtTest_arm64-v8a.so using class loader ns clns-4 (caller=/data/app/~~XIK_3oK5DKj4Pv2epcGJwQ==/org.qtproject.example.QtTest-z9izm4KcYpYvGHTt3ypwhw==/base.apk): ok

                                      SMF-QtS 1 Reply Last reply
                                      0
                                      • SMF-QtS SMF-Qt

                                        @SMF-Qt

                                        This is the entry for the main QtTest library:

                                        nativeloader: Load /data/app/~~XIK_3oK5DKj4Pv2epcGJwQ==/org.qtproject.example.QtTest-z9izm4KcYpYvGHTt3ypwhw==/base.apk!/lib/arm64-v8a/libQtTest_arm64-v8a.so using class loader ns clns-4 (caller=/data/app/~~XIK_3oK5DKj4Pv2epcGJwQ==/org.qtproject.example.QtTest-z9izm4KcYpYvGHTt3ypwhw==/base.apk): ok

                                        SMF-QtS Offline
                                        SMF-QtS Offline
                                        SMF-Qt
                                        wrote last edited by
                                        #19

                                        @SMF-Qt

                                        Running the adb command that is reported as failing outside of qtcreator reports what seems to be a permissions problem:

                                        adb -s 192.168.0.50:42175 pull /system/bin/app_process64 /work/Qt-Android/QtTest-V1.1.5c/application/build/Android_QtAndroid_Clang_arm64_v8a-Debug/android-app-process/app_process
                                        adb: error: failed to copy '/system/bin/app_process64' to '/work/Qt-Android/QtTest-V1.1.5c/application/build/Android_QtAndroid_Clang_arm64_v8a-Debug/android-app-process/app_process': remote open failed: Operation not permitted

                                        SMF-QtS 1 Reply Last reply
                                        0
                                        • SMF-QtS SMF-Qt

                                          @SMF-Qt

                                          Running the adb command that is reported as failing outside of qtcreator reports what seems to be a permissions problem:

                                          adb -s 192.168.0.50:42175 pull /system/bin/app_process64 /work/Qt-Android/QtTest-V1.1.5c/application/build/Android_QtAndroid_Clang_arm64_v8a-Debug/android-app-process/app_process
                                          adb: error: failed to copy '/system/bin/app_process64' to '/work/Qt-Android/QtTest-V1.1.5c/application/build/Android_QtAndroid_Clang_arm64_v8a-Debug/android-app-process/app_process': remote open failed: Operation not permitted

                                          SMF-QtS Offline
                                          SMF-QtS Offline
                                          SMF-Qt
                                          wrote last edited by SMF-Qt
                                          #20

                                          @SMF-Qt

                                          I don't know is it is relevant but if I try a Android Virtual Device (AVD) instead of a usb or wifi connected phone I get the following error:

                                          The deployment AVD "TestPhone" cannot be started.

                                          My thinking is if I deploy to a virtual phone device I might get a better perspective on my problem deploying to a real phone.

                                          Can the TestPhone AVD be started outside of QtCreator to test it ?

                                          The Icon shows a yellow blob while on the real phone (usb and WiFi) the blob on the icon is green.

                                          jsulmJ 1 Reply Last reply
                                          0

                                          • Login

                                          • Login or register to search.
                                          • First post
                                            Last post
                                          0
                                          • Categories
                                          • Recent
                                          • Tags
                                          • Popular
                                          • Users
                                          • Groups
                                          • Search
                                          • Get Qt Extensions
                                          • Unsolved