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 Solved Qt Creator and other tools
36 Posts 5 Posters 2.1k 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.
  • 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
              • SMF-QtS SMF-Qt

                @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 Offline
                jsulmJ Offline
                jsulm
                Lifetime Qt Champion
                wrote last edited by
                #21

                @SMF-Qt said in Testing Android APK with QtCreator fails with an error.:

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

                Yes, either from command line or from Android Studio.
                See https://developer.android.com/studio/run/emulator-commandline?hl=en

                https://forum.qt.io/topic/113070/qt-code-of-conduct

                SMF-QtS 1 Reply Last reply
                0
                • jsulmJ jsulm

                  @SMF-Qt said in Testing Android APK with QtCreator fails with an error.:

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

                  Yes, either from command line or from Android Studio.
                  See https://developer.android.com/studio/run/emulator-commandline?hl=en

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

                  @jsulm

                  Well looks like the idea of using a virtual phone in this case is a non starter:

                  root [ ~ ]# /opt/android/sdk/emulator/emulator -avd TestPhone
                  INFO | Android emulator version 35.6.11.0 (build_id 13610412) (CL:N/A)
                  INFO | Graphics backend: gfxstream
                  INFO | Found systemPath /opt/android/sdk/system-images/android-28/google_apis/arm64-v8a/
                  PANIC: Avd's CPU Architecture 'arm64' is not supported by the QEMU2 emulator on x86_64 host.

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

                    @jsulm

                    Well looks like the idea of using a virtual phone in this case is a non starter:

                    root [ ~ ]# /opt/android/sdk/emulator/emulator -avd TestPhone
                    INFO | Android emulator version 35.6.11.0 (build_id 13610412) (CL:N/A)
                    INFO | Graphics backend: gfxstream
                    INFO | Found systemPath /opt/android/sdk/system-images/android-28/google_apis/arm64-v8a/
                    PANIC: Avd's CPU Architecture 'arm64' is not supported by the QEMU2 emulator on x86_64 host.

                    jsulmJ Offline
                    jsulmJ Offline
                    jsulm
                    Lifetime Qt Champion
                    wrote last edited by
                    #23

                    @SMF-Qt said in Testing Android APK with QtCreator fails with an error.:

                    PANIC: Avd's CPU Architecture 'arm64' is not supported by the QEMU2 emulator on x86_64 host.

                    Create a x86_64 virtual device and deploy a x86_64 build of your app

                    https://forum.qt.io/topic/113070/qt-code-of-conduct

                    SMF-QtS 1 Reply Last reply
                    0
                    • jsulmJ jsulm

                      @SMF-Qt said in Testing Android APK with QtCreator fails with an error.:

                      PANIC: Avd's CPU Architecture 'arm64' is not supported by the QEMU2 emulator on x86_64 host.

                      Create a x86_64 virtual device and deploy a x86_64 build of your app

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

                      @jsulm

                      I could but I think this is a build issue, I think I need to find out more about this "app_process" file that is missing.
                      I ran strace on qtcreator and re-built the app and the only reference to "app_process" is a test for its existance which failed:

                      access("/work/Qt-Android/QtTest-V1.1.5c/application/build/Android_QtAndroid_Clang_arm64_v8a-Debug/android-app-process/app_process", F_OK) = -1 ENOENT (No such file or directory)

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

                        @jsulm

                        I could but I think this is a build issue, I think I need to find out more about this "app_process" file that is missing.
                        I ran strace on qtcreator and re-built the app and the only reference to "app_process" is a test for its existance which failed:

                        access("/work/Qt-Android/QtTest-V1.1.5c/application/build/Android_QtAndroid_Clang_arm64_v8a-Debug/android-app-process/app_process", F_OK) = -1 ENOENT (No such file or directory)

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

                        @SMF-Qt

                        According to Googles AI:

                        1. What is app_process?

                          app_process is a binary found in the /system/bin directory on Android devices. According to Stack Overflow, it's a device binary created by the full device build.

                        It's the entry point for starting a Java process within the Android runtime environment.
                        It's used to run applications, often those that need to interact with system-level services or bypass normal Android application lifecycle restrictions.
                        It can be used to execute JAR files or DEX files within a Dalvik/ART environment.
                        Essentially, it's how you can run custom Java code as a separate process on an Android device, outside the typical app sandbox.

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

                          @SMF-Qt

                          According to Googles AI:

                          1. What is app_process?

                            app_process is a binary found in the /system/bin directory on Android devices. According to Stack Overflow, it's a device binary created by the full device build.

                          It's the entry point for starting a Java process within the Android runtime environment.
                          It's used to run applications, often those that need to interact with system-level services or bypass normal Android application lifecycle restrictions.
                          It can be used to execute JAR files or DEX files within a Dalvik/ART environment.
                          Essentially, it's how you can run custom Java code as a separate process on an Android device, outside the typical app sandbox.

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

                          @SMF-Qt

                          So if I understand what adb and google are telling me the issue is that the operating system on my test phone is blocking adb's access to /system/bin/.

                          I wonder if this is a Samsung thing the test phone is a Samsung A06 ?

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

                            @SMF-Qt

                            So if I understand what adb and google are telling me the issue is that the operating system on my test phone is blocking adb's access to /system/bin/.

                            I wonder if this is a Samsung thing the test phone is a Samsung A06 ?

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

                            @SMF-Qt

                            Using adb shell I have found the adbd server on my test phone:

                            shell 26668 1 0 40:23 ? 00:04:49 adbd --root_seclabel=u:r:su:s0 --tim_seclabel=u:r:adbd_tradeinmode:s0

                            It is running as user shell which I think does not have read access to /system/bin.

                            So I think my next step is to root the Test Phone and see if that helps.

                            1 Reply Last reply
                            0
                            • cristian-adamC Online
                              cristian-adamC Online
                              cristian-adam
                              wrote last edited by
                              #28

                              The adb: error: failed to copy '/system/bin/app_process64' is something new with Android 15.

                              I have started seeing this issue with my Samsung Galaxy S23 with Android 15.

                              See this other report at https://forum.qt.io/topic/162537/qt-creator-android-15-adb.exe-pull-system-bin-app_process64-error

                              In my case native debugging with Android Studio doesn't work with the Galaxy S23. It does work with the Arm64 Emulator with Android 15.

                              I tested with a Samsung Galaxy S10e with Android 12, and everything worked fine with Qt Creator 17...

                              SMF-QtS 1 Reply Last reply
                              0
                              • cristian-adamC cristian-adam

                                The adb: error: failed to copy '/system/bin/app_process64' is something new with Android 15.

                                I have started seeing this issue with my Samsung Galaxy S23 with Android 15.

                                See this other report at https://forum.qt.io/topic/162537/qt-creator-android-15-adb.exe-pull-system-bin-app_process64-error

                                In my case native debugging with Android Studio doesn't work with the Galaxy S23. It does work with the Arm64 Emulator with Android 15.

                                I tested with a Samsung Galaxy S10e with Android 12, and everything worked fine with Qt Creator 17...

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

                                @cristian-adam

                                Thanks for the info, the Samsung A06 I am currently using has Android 14 currently installed.

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

                                  @cristian-adam

                                  Thanks for the info, the Samsung A06 I am currently using has Android 14 currently installed.

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

                                  @SMF-Qt

                                  I did not make any progress rooting my Test Phone (Samsung A06), however I tried an old HTC M9 running Android 7.0 and that did proceed past the adb pull request for "app_process" but failed because the APK package is too new for Android 7.0 (expected failure).

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

                                    @SMF-Qt

                                    I did not make any progress rooting my Test Phone (Samsung A06), however I tried an old HTC M9 running Android 7.0 and that did proceed past the adb pull request for "app_process" but failed because the APK package is too new for Android 7.0 (expected failure).

                                    cristian-adamC Online
                                    cristian-adamC Online
                                    cristian-adam
                                    wrote last edited by
                                    #31

                                    @SMF-Qt said in Testing Android APK with QtCreator fails with an error.:

                                    I did not make any progress rooting my Test Phone (Samsung A06), however I tried an old HTC M9 running Android 7.0 and that did proceed past the adb pull request for "app_process" but failed because the APK package is too new for Android 7.0 (expected failure).

                                    Android 9 is the minimum required for Qt for Android 6.9.

                                    According to Wikipedia you can get Android 11 for HTC One M9. The steps to do this unofficial upgrade are listed here. I have no idea how this would work.

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

                                      I think for now I am going to put arm64-v8a activities on hold as both hardware and emulated deployments have issues and try jsulm's suggestion of an X86_64 setup. I have already tested the X86_64 phone simulator outside of both qtcreator and Android Studio and it appears to function ok.

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

                                        I think for now I am going to put arm64-v8a activities on hold as both hardware and emulated deployments have issues and try jsulm's suggestion of an X86_64 setup. I have already tested the X86_64 phone simulator outside of both qtcreator and Android Studio and it appears to function ok.

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

                                        @SMF-Qt

                                        Ok thanks for the suggestions I now have a working X86_64 emulator and an X86_64 apk build that deploys to the emulated phone.

                                        My next problem is that the deployed app crashes on startup, but to investigate that I think I will start a new thread and come back to the arm64-v8a problems when my test application is more usable.

                                        ...
                                        Installing Android package to device.
                                        Running command "/opt/android/sdk/platform-tools/adb -s emulator-5554 install -r /work/Qt-Android/QtTest/application/build/Android_Qt_6_9_1_qt_androidX86_Clang_x86_64-Debug/android-build//build/outputs/apk/debug/android-build-debug.apk"
                                        Performing Streamed Install
                                        Success
                                        Android package built successfully in 0.572 ms.
                                        -- It can now be run from the selected device/emulator.
                                        -- File: /work/Qt-Android/QtTest/application/build/Android_Qt_6_9_1_qt_androidX86_Clang_x86_64-Debug/android-build//build/outputs/apk/debug/android-build-debug.apk
                                        14:18:06: The process "/opt/qt6/bin/androiddeployqt" exited normally.
                                        14:18:06: Package deploy: Running command "/opt/android/sdk/platform-tools/adb -s emulator-5554 pull /system/bin/app_process64 /work/Qt-Android/QtTest/application/build/Android_Qt_6_9_1_qt_androidX86_Clang_x86_64-Debug/android-app-process/app_process".
                                        14:18:06: Package deploy: Running command "/opt/android/sdk/platform-tools/adb -s emulator-5554 pull /system/bin/linker64 /work/Qt-Android/QtTest/application/build/Android_Qt_6_9_1_qt_androidX86_Clang_x86_64-Debug/android-app-process/linker64".
                                        14:18:06: Package deploy: Running command "/opt/android/sdk/platform-tools/adb -s emulator-5554 pull /system/lib64/libc.so /work/Qt-Android/QtTest/application/build/Android_Qt_6_9_1_qt_androidX86_Clang_x86_64-Debug/android-app-process/libc.so".
                                        14:18:06: Elapsed time: 00:05.

                                        1 Reply Last reply
                                        0
                                        • SMF-QtS SMF-Qt referenced this topic
                                        • D Offline
                                          D Offline
                                          danish777
                                          Banned
                                          wrote last edited by
                                          #34

                                          Thanks for sharing the detailed steps — it looks like you're almost there. The error about the missing ABI usually means QtCreator isn’t detecting the correct architecture for deployment. Adding ```
                                          ANDROID_ABIS = arm64-v8a

                                          
                                          Double-check that the Kit you're using is actually set up with the correct Qt for Android version and the appropriate architecture. Also, make sure the NDK path is correctly configured in the SDK settings — mismatches there can silently cause issues like this.
                                          
                                          Running on an emulator first is definitely a smart move. Hopefully with those tweaks, you'll be able to deploy without issues. Let us know how it goes!
                                          1 Reply Last reply
                                          0
                                          • SMF-QtS SMF-Qt referenced this topic

                                          • Login

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