Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. QT 5.12.4 armv7 application not working if arm64 libs are present
QtWS25 Last Chance

QT 5.12.4 armv7 application not working if arm64 libs are present

Scheduled Pinned Locked Moved Solved Mobile and Embedded
11 Posts 4 Posters 3.7k Views
  • 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.
  • W Offline
    W Offline
    Wiru
    wrote on last edited by Wiru
    #1

    In preparation for google play 64 bit requirement I updated my project to include arm64-v8a libs.
    So now I have both armeabi-v7a and arm64-v8a folders inside Android/jni/ folder.

    I use Clang Qt 5.12.4 for Android ARMv7 and Clang Qt 5.12.4 for Android ARM64-v8a kits for it's respective builds.

    The issue now is that only the 64 bit version works. Even when I use armeabi-v7a for building, it ends up with the following errors trying to look for arm64:

    W System  : ClassLoader referenced unknown path:
    I Qt JAVA : Can't find '/data/app/com.myproject.test-VAF1p6T7dJCG1T41Wzsu-g==/lib/arm64/libc++_shared.so'
    I Qt JAVA : Can't find '/data/app/com.myproject.test-VAF1p6T7dJCG1T41Wzsu-g==/lib/arm64/libQt5Core.so'
    I Qt JAVA : Can't find '/data/app/com.myproject.test-VAF1p6T7dJCG1T41Wzsu-g==/lib/arm64/libQt5AndroidExtras.so'
    I Qt JAVA : Can't find '/data/app/com.myproject.test-VAF1p6T7dJCG1T41Wzsu-g==/lib/arm64/libQt5Gui.so'
    I Qt JAVA : Can't find '/data/app/com.myproject.test-VAF1p6T7dJCG1T41Wzsu-g==/lib/arm64/libQt5Network.so'
    I Qt JAVA : Can't find '/data/app/com.myproject.test-VAF1p6T7dJCG1T41Wzsu-g==/lib/arm64/libQt5Multimedia.so'
    I Qt JAVA : Can't find '/data/app/com.myproject.test-VAF1p6T7dJCG1T41Wzsu-g==/lib/arm64/libQt5Qml.so'
    I Qt JAVA : Can't find '/data/app/com.myproject.test-VAF1p6T7dJCG1T41Wzsu-g==/lib/arm64/libQt5Quick.so'
    I Qt JAVA : Can't find '/data/app/com.myproject.test-VAF1p6T7dJCG1T41Wzsu-g==/lib/arm64/libQt5QuickTemplates2.so'
    I Qt JAVA : Can't find '/data/app/com.myproject.test-VAF1p6T7dJCG1T41Wzsu-g==/lib/arm64/libQt5QuickControls2.so'
    I Qt JAVA : Can't find '/data/app/com.myproject.test-VAF1p6T7dJCG1T41Wzsu-g==/lib/arm64/libQt5WebSockets.so'
    I Qt JAVA : Can't find '/data/app/com.myproject.test-VAF1p6T7dJCG1T41Wzsu-g==/lib/arm64/libQt5MultimediaQuick.so'
    I Qt JAVA : Can't find '/data/app/com.myproject.test-VAF1p6T7dJCG1T41Wzsu-g==/lib/arm64/libQt5QuickParticles.so'
    I Qt JAVA : Can't find '/data/app/com.myproject.test-VAF1p6T7dJCG1T41Wzsu-g==/lib/arm64/libQt5MultimediaQuick.so'
    I Qt JAVA : Can't find '/data/app/com.myproject.test-VAF1p6T7dJCG1T41Wzsu-g==/lib/arm64/libQt5RemoteObjects.so'
    E AndroidRuntime: FATAL EXCEPTION: qtMainLoopThread
    E AndroidRuntime: Process: com.myproject.test, PID: 1406
    E AndroidRuntime: java.lang.UnsatisfiedLinkError: dlopen failed: file offset for the library "/data/data/com.myproject.test/qt-reserved-files/plugins/platforms/android/libqtforandroid.so" >= file size: 0 >= 0
    E AndroidRuntime: 	at java.lang.Runtime.load0(Runtime.java:928)
    E AndroidRuntime: 	at java.lang.System.load(System.java:1633)
    E AndroidRuntime: 	at org.qtproject.qt5.android.QtNative$2.run(QtNative.java:183)
    E AndroidRuntime: 	at org.qtproject.qt5.android.QtThread$2.run(QtThread.java:87)
    E AndroidRuntime: 	at org.qtproject.qt5.android.QtThread$1.run(QtThread.java:61)
    E AndroidRuntime: 	at java.lang.Thread.run(Thread.java:764)
    E MQSEventManagerDelegate: failed to get MQSService.
    

    All android files are handled by gradle, now I'm not well-versed with gradle, but I assume it should handle which abi to use based on the kit used to build?

    If I remove arm64-v8a from the filter the 32-bit app will work, but then the 64-bit one doesn't.
    build.gradle:

    android {
    ...
        defaultConfig {
            minSdkVersion 19
    
            ndk {
              abiFilters "armeabi-v7a", "arm64-v8a"
            }
        }
    
        sourceSets {
            main {
                manifest.srcFile 'AndroidManifest.xml'
                java.srcDirs = [qt5AndroidDir + '/src', 'src', 'java']
                aidl.srcDirs = [qt5AndroidDir + '/src', 'src', 'aidl']
                res.srcDirs = [qt5AndroidDir + '/res', 'res']
                resources.srcDirs = ['src']
                renderscript.srcDirs = ['src']
                assets.srcDirs = ['assets']
                jniLibs.srcDirs = ['libs', 'jni']
           }
        }
    ...
    }
    

    Has anyone encountered a similar issue or has any idea how to make it build only the libs for the kit I'm using?
    I don't really understand why it's looking for 64-bit libs when building with Clang Qt 5.12.4 for Android ARMv7.

    SDK Version: 26.1.1
    NDK Version: 19.2.5345600
    JDK version: jdk1.8.0_212

    J.HilkJ 1 Reply Last reply
    0
    • W Wiru

      In preparation for google play 64 bit requirement I updated my project to include arm64-v8a libs.
      So now I have both armeabi-v7a and arm64-v8a folders inside Android/jni/ folder.

      I use Clang Qt 5.12.4 for Android ARMv7 and Clang Qt 5.12.4 for Android ARM64-v8a kits for it's respective builds.

      The issue now is that only the 64 bit version works. Even when I use armeabi-v7a for building, it ends up with the following errors trying to look for arm64:

      W System  : ClassLoader referenced unknown path:
      I Qt JAVA : Can't find '/data/app/com.myproject.test-VAF1p6T7dJCG1T41Wzsu-g==/lib/arm64/libc++_shared.so'
      I Qt JAVA : Can't find '/data/app/com.myproject.test-VAF1p6T7dJCG1T41Wzsu-g==/lib/arm64/libQt5Core.so'
      I Qt JAVA : Can't find '/data/app/com.myproject.test-VAF1p6T7dJCG1T41Wzsu-g==/lib/arm64/libQt5AndroidExtras.so'
      I Qt JAVA : Can't find '/data/app/com.myproject.test-VAF1p6T7dJCG1T41Wzsu-g==/lib/arm64/libQt5Gui.so'
      I Qt JAVA : Can't find '/data/app/com.myproject.test-VAF1p6T7dJCG1T41Wzsu-g==/lib/arm64/libQt5Network.so'
      I Qt JAVA : Can't find '/data/app/com.myproject.test-VAF1p6T7dJCG1T41Wzsu-g==/lib/arm64/libQt5Multimedia.so'
      I Qt JAVA : Can't find '/data/app/com.myproject.test-VAF1p6T7dJCG1T41Wzsu-g==/lib/arm64/libQt5Qml.so'
      I Qt JAVA : Can't find '/data/app/com.myproject.test-VAF1p6T7dJCG1T41Wzsu-g==/lib/arm64/libQt5Quick.so'
      I Qt JAVA : Can't find '/data/app/com.myproject.test-VAF1p6T7dJCG1T41Wzsu-g==/lib/arm64/libQt5QuickTemplates2.so'
      I Qt JAVA : Can't find '/data/app/com.myproject.test-VAF1p6T7dJCG1T41Wzsu-g==/lib/arm64/libQt5QuickControls2.so'
      I Qt JAVA : Can't find '/data/app/com.myproject.test-VAF1p6T7dJCG1T41Wzsu-g==/lib/arm64/libQt5WebSockets.so'
      I Qt JAVA : Can't find '/data/app/com.myproject.test-VAF1p6T7dJCG1T41Wzsu-g==/lib/arm64/libQt5MultimediaQuick.so'
      I Qt JAVA : Can't find '/data/app/com.myproject.test-VAF1p6T7dJCG1T41Wzsu-g==/lib/arm64/libQt5QuickParticles.so'
      I Qt JAVA : Can't find '/data/app/com.myproject.test-VAF1p6T7dJCG1T41Wzsu-g==/lib/arm64/libQt5MultimediaQuick.so'
      I Qt JAVA : Can't find '/data/app/com.myproject.test-VAF1p6T7dJCG1T41Wzsu-g==/lib/arm64/libQt5RemoteObjects.so'
      E AndroidRuntime: FATAL EXCEPTION: qtMainLoopThread
      E AndroidRuntime: Process: com.myproject.test, PID: 1406
      E AndroidRuntime: java.lang.UnsatisfiedLinkError: dlopen failed: file offset for the library "/data/data/com.myproject.test/qt-reserved-files/plugins/platforms/android/libqtforandroid.so" >= file size: 0 >= 0
      E AndroidRuntime: 	at java.lang.Runtime.load0(Runtime.java:928)
      E AndroidRuntime: 	at java.lang.System.load(System.java:1633)
      E AndroidRuntime: 	at org.qtproject.qt5.android.QtNative$2.run(QtNative.java:183)
      E AndroidRuntime: 	at org.qtproject.qt5.android.QtThread$2.run(QtThread.java:87)
      E AndroidRuntime: 	at org.qtproject.qt5.android.QtThread$1.run(QtThread.java:61)
      E AndroidRuntime: 	at java.lang.Thread.run(Thread.java:764)
      E MQSEventManagerDelegate: failed to get MQSService.
      

      All android files are handled by gradle, now I'm not well-versed with gradle, but I assume it should handle which abi to use based on the kit used to build?

      If I remove arm64-v8a from the filter the 32-bit app will work, but then the 64-bit one doesn't.
      build.gradle:

      android {
      ...
          defaultConfig {
              minSdkVersion 19
      
              ndk {
                abiFilters "armeabi-v7a", "arm64-v8a"
              }
          }
      
          sourceSets {
              main {
                  manifest.srcFile 'AndroidManifest.xml'
                  java.srcDirs = [qt5AndroidDir + '/src', 'src', 'java']
                  aidl.srcDirs = [qt5AndroidDir + '/src', 'src', 'aidl']
                  res.srcDirs = [qt5AndroidDir + '/res', 'res']
                  resources.srcDirs = ['src']
                  renderscript.srcDirs = ['src']
                  assets.srcDirs = ['assets']
                  jniLibs.srcDirs = ['libs', 'jni']
             }
          }
      ...
      }
      

      Has anyone encountered a similar issue or has any idea how to make it build only the libs for the kit I'm using?
      I don't really understand why it's looking for 64-bit libs when building with Clang Qt 5.12.4 for Android ARMv7.

      SDK Version: 26.1.1
      NDK Version: 19.2.5345600
      JDK version: jdk1.8.0_212

      J.HilkJ Offline
      J.HilkJ Offline
      J.Hilk
      Moderators
      wrote on last edited by J.Hilk
      #2

      hi @Wiru
      as of right now Qt(Creator) does not support aab you have to build both APKs completely separately and manage them on in the play console

      for more information see here

      https://bugreports.qt.io/browse/QTBUG-68202


      Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


      Q: What's that?
      A: It's blue light.
      Q: What does it do?
      A: It turns blue.

      1 Reply Last reply
      0
      • W Offline
        W Offline
        Wiru
        wrote on last edited by Wiru
        #3

        @J-Hilk I'm not trying to make an aab, I would just want to build the apk depending on the kit I use.
        If I build with Clang Qt 5.12.4 for Android ARMv7 I want it to be only 32 bit, and for Clang Qt 5.12.4 for Android ARM64-v8a only 64 bit; I did some research regarding the aab support in Qt so I know it's not supported (I did read the linked bug report before, tho not in much detail as aab is not what I'm targeting at the moment), or do you mean it's an issue when both armeabi-v7a and arm64-v8a libs are present in a project?

        J.HilkJ 1 Reply Last reply
        0
        • W Wiru

          @J-Hilk I'm not trying to make an aab, I would just want to build the apk depending on the kit I use.
          If I build with Clang Qt 5.12.4 for Android ARMv7 I want it to be only 32 bit, and for Clang Qt 5.12.4 for Android ARM64-v8a only 64 bit; I did some research regarding the aab support in Qt so I know it's not supported (I did read the linked bug report before, tho not in much detail as aab is not what I'm targeting at the moment), or do you mean it's an issue when both armeabi-v7a and arm64-v8a libs are present in a project?

          J.HilkJ Offline
          J.HilkJ Offline
          J.Hilk
          Moderators
          wrote on last edited by
          #4

          @Wiru
          if you setup your project correctly, than you should have different gradle folders/files for each Qt version -> referencing both armeabi-v7a. and arm64-v8a is, imho wrong.

          did you manipulate the build.gradle file yourself, or is it the auto generated one?


          Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


          Q: What's that?
          A: It's blue light.
          Q: What does it do?
          A: It turns blue.

          W 1 Reply Last reply
          1
          • J.HilkJ J.Hilk

            @Wiru
            if you setup your project correctly, than you should have different gradle folders/files for each Qt version -> referencing both armeabi-v7a. and arm64-v8a is, imho wrong.

            did you manipulate the build.gradle file yourself, or is it the auto generated one?

            W Offline
            W Offline
            Wiru
            wrote on last edited by
            #5

            @J.Hilk
            It's a modified version of the auto generated one from before when only 32-bit was available, more or less I just added the filter and jniLibs.srcDirs = ['libs', 'jni'].

            I still don't quite understand why it's an issue to have both armeabi-v7a and arm64-v8a present in the same project, as soon as I added the arm64 the 32 bit app isn't working. A better question might be why is the Clang Qt 5.12.4 for Android ARMv7 even trying to look for 64 bit libs?

            In any case, is it possible to have 2 build.gradles in the same project and just use the right one for the build kit used? I'll also try to look more into this, thank you for the quick response.

            J.HilkJ 1 Reply Last reply
            0
            • W Wiru

              @J.Hilk
              It's a modified version of the auto generated one from before when only 32-bit was available, more or less I just added the filter and jniLibs.srcDirs = ['libs', 'jni'].

              I still don't quite understand why it's an issue to have both armeabi-v7a and arm64-v8a present in the same project, as soon as I added the arm64 the 32 bit app isn't working. A better question might be why is the Clang Qt 5.12.4 for Android ARMv7 even trying to look for 64 bit libs?

              In any case, is it possible to have 2 build.gradles in the same project and just use the right one for the build kit used? I'll also try to look more into this, thank you for the quick response.

              J.HilkJ Offline
              J.HilkJ Offline
              J.Hilk
              Moderators
              wrote on last edited by
              #6

              @Wiru said in QT 5.12.4 armv7 application not working if arm64 libs are present:

              In any case, is it possible to have 2 build.gradles in the same project and just use the right one for the build kit used?

              sure, if you wrap it accordingly, inside your pro file. it should work

              contains(ANDROID_TARGET_ARCH,armeabi-v7a) {
                 ANDROID_PACKAGE_SOURCE_DIR = \
                      $$PWD/android/v7
              }
              

              Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


              Q: What's that?
              A: It's blue light.
              Q: What does it do?
              A: It turns blue.

              W 1 Reply Last reply
              1
              • J.HilkJ J.Hilk

                @Wiru said in QT 5.12.4 armv7 application not working if arm64 libs are present:

                In any case, is it possible to have 2 build.gradles in the same project and just use the right one for the build kit used?

                sure, if you wrap it accordingly, inside your pro file. it should work

                contains(ANDROID_TARGET_ARCH,armeabi-v7a) {
                   ANDROID_PACKAGE_SOURCE_DIR = \
                        $$PWD/android/v7
                }
                
                W Offline
                W Offline
                Wiru
                wrote on last edited by Wiru
                #7

                @J.Hilk
                Is it enough to only have build.gradle inside $$PWD/android/v7 $$PWD/android/v8 ?
                I'm having trouble adjusting it correctly, since the build.gradle is now in a subfolder, all sources should start with ../ to look for them in the parent folder? If I do that it results in a empty app loading.

                Guess I'm doing something wrong could you please help with updating the paths as I'm not sure how it should look now.
                This is how it looked before:

                android {
                ...
                    defaultConfig {
                        minSdkVersion 19
                
                        ndk {
                          abiFilters "armeabi-v7a", "arm64-v8a"
                        }
                    }
                
                    sourceSets {
                        main {
                            manifest.srcFile 'AndroidManifest.xml'
                            java.srcDirs = [qt5AndroidDir + '/src', 'src', 'java']
                            aidl.srcDirs = [qt5AndroidDir + '/src', 'src', 'aidl']
                            res.srcDirs = [qt5AndroidDir + '/res', 'res']
                            resources.srcDirs = ['src']
                            renderscript.srcDirs = ['src']
                            assets.srcDirs = ['assets']
                            jniLibs.srcDirs = ['libs', 'jni']
                       }
                    }
                ...
                }
                

                I tried adding ../ to all paths, but with or without it, it just makes an empty application

                EDIT:
                Normal reasoning would say to have all android files inside the respective ANDROID_PACKAGE_SOURCE_DIR, but that would result in duplicating files that don't depend on abi, (assets, res, etc.), so I hope that's not the case and only build.gradle can be in a subfolder?

                EDIT 2:
                Managed to make a workaround for now, figured I could use the build path to check which abi is used and filter accordingly. It's silly, but it works.

                    defaultConfig {
                        minSdkVersion 19
                
                        ndk {
                            if(qt5AndroidDir.contains("android_armv7")) {
                                abiFilters "armeabi-v7a"
                            }
                
                            if(qt5AndroidDir.contains("android_arm64_v8a")) {
                                abiFilters "arm64-v8a"
                            }
                        }
                    }
                
                J.HilkJ 1 Reply Last reply
                2
                • W Wiru

                  @J.Hilk
                  Is it enough to only have build.gradle inside $$PWD/android/v7 $$PWD/android/v8 ?
                  I'm having trouble adjusting it correctly, since the build.gradle is now in a subfolder, all sources should start with ../ to look for them in the parent folder? If I do that it results in a empty app loading.

                  Guess I'm doing something wrong could you please help with updating the paths as I'm not sure how it should look now.
                  This is how it looked before:

                  android {
                  ...
                      defaultConfig {
                          minSdkVersion 19
                  
                          ndk {
                            abiFilters "armeabi-v7a", "arm64-v8a"
                          }
                      }
                  
                      sourceSets {
                          main {
                              manifest.srcFile 'AndroidManifest.xml'
                              java.srcDirs = [qt5AndroidDir + '/src', 'src', 'java']
                              aidl.srcDirs = [qt5AndroidDir + '/src', 'src', 'aidl']
                              res.srcDirs = [qt5AndroidDir + '/res', 'res']
                              resources.srcDirs = ['src']
                              renderscript.srcDirs = ['src']
                              assets.srcDirs = ['assets']
                              jniLibs.srcDirs = ['libs', 'jni']
                         }
                      }
                  ...
                  }
                  

                  I tried adding ../ to all paths, but with or without it, it just makes an empty application

                  EDIT:
                  Normal reasoning would say to have all android files inside the respective ANDROID_PACKAGE_SOURCE_DIR, but that would result in duplicating files that don't depend on abi, (assets, res, etc.), so I hope that's not the case and only build.gradle can be in a subfolder?

                  EDIT 2:
                  Managed to make a workaround for now, figured I could use the build path to check which abi is used and filter accordingly. It's silly, but it works.

                      defaultConfig {
                          minSdkVersion 19
                  
                          ndk {
                              if(qt5AndroidDir.contains("android_armv7")) {
                                  abiFilters "armeabi-v7a"
                              }
                  
                              if(qt5AndroidDir.contains("android_arm64_v8a")) {
                                  abiFilters "arm64-v8a"
                              }
                          }
                      }
                  
                  J.HilkJ Offline
                  J.HilkJ Offline
                  J.Hilk
                  Moderators
                  wrote on last edited by
                  #8

                  @Wiru said in QT 5.12.4 armv7 application not working if arm64 libs are present:

                  Normal reasoning would say to have all android files inside the respective ANDROID_PACKAGE_SOURCE_DIR, but that would result in duplicating files that don't depend on abi, (assets, res, etc.), so I hope that's not the case and only build.gradle can be in a subfolder?

                  that's how I do it. It's fine, I only have few native classes in my code but your solution may be better.

                  Where do you make that check exactly ?


                  Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


                  Q: What's that?
                  A: It's blue light.
                  Q: What does it do?
                  A: It turns blue.

                  W 1 Reply Last reply
                  0
                  • J.HilkJ J.Hilk

                    @Wiru said in QT 5.12.4 armv7 application not working if arm64 libs are present:

                    Normal reasoning would say to have all android files inside the respective ANDROID_PACKAGE_SOURCE_DIR, but that would result in duplicating files that don't depend on abi, (assets, res, etc.), so I hope that's not the case and only build.gradle can be in a subfolder?

                    that's how I do it. It's fine, I only have few native classes in my code but your solution may be better.

                    Where do you make that check exactly ?

                    W Offline
                    W Offline
                    Wiru
                    wrote on last edited by Wiru
                    #9

                    @J.Hilk
                    It's in build.gradle; the abiFilters go under

                    android {
                        defaultConfig {
                            ndk{
                                 abiFilters  ...
                    ...
                    

                    Works great with manual builds and default settings (since qt5AndroidDir is named based on the kit used) , for automated it might be a bit tricky if custom folder names are used, but as long as it contains the checked strings it should work.

                    C 1 Reply Last reply
                    1
                    • W Wiru

                      @J.Hilk
                      It's in build.gradle; the abiFilters go under

                      android {
                          defaultConfig {
                              ndk{
                                   abiFilters  ...
                      ...
                      

                      Works great with manual builds and default settings (since qt5AndroidDir is named based on the kit used) , for automated it might be a bit tricky if custom folder names are used, but as long as it contains the checked strings it should work.

                      C Offline
                      C Offline
                      Climax
                      wrote on last edited by
                      #10

                      @wiru Thanks this just saved me days of figuring out! Perhaps a documentation insert about this could prove useful?

                      T 1 Reply Last reply
                      1
                      • C Climax

                        @wiru Thanks this just saved me days of figuring out! Perhaps a documentation insert about this could prove useful?

                        T Offline
                        T Offline
                        Tom_H
                        wrote on last edited by
                        #11

                        @climax You do not need separate ANDROID_PACKAGE_SOURCE_DIRs for each architecture unless you are doing something custom on the java side. The error here was in using abiFilters in the gradle file. Remove that and it works fine. You can verify by picking any android example in Qt Creator and building for both architectures.

                        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