Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Solved Qt 5.15.0 Android apk deployment failure

    Installation and Deployment
    apk qt 5.15 qt creator gradle
    2
    4
    1645
    Loading More Posts
    • 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.
    • M
      mujeek last edited by

      I can't execute the linked project on every Android device I have got.
      It's a simple "hello world" program which was written in a new installation of Qt 5.15.0 + Qt Creator 14.3.0 on macOS 10.15.6 Catalina.
      If I compile the project which Qt Creator automatically creates, apk creation fails with the following error:

      FAILURE: Build failed with an exception.

      • What went wrong:
        Could not initialize class org.codehaus.groovy.reflection.ReflectionCache

      apk is built without errors if I upgrade gradle to the latest version (6.6.1) by opening Projects/Build Android APK options and pushing "Create Templates" button. After Qt Creator adds a template, I open "gradle-wrapper.properties" and replace:

      distributionUrl=https://services.gradle.org/distributions/gradle-5.6.4-bin.zip

      with:

      distributionUrl=https://services.gradle.org/distributions/gradle-6.6.1-bin.zip

      Please, notice that I let Qt Creator download all sdk tools and sdkmanager update them to the latest version (ndk 21.1.6352462, Android SDK Platform-Tools 30.0.4, Android SDK Build-Tools 29.0.2, Android SDK Tools 2.1 and Android SDK Command-line Tools 2.1)

      When I launch this application (the outcome doesn't change if it happens through Qt Creator or directly on the device), the following notice is displayed:

      Your application encountered a fatal error and cannot continue.

      Please let me know if it happens on your devices too.
      If it doesn't happen, please show me your Qt 5.15.0 and Qt Creator 14.3.0 working setup, so that I can find what is wrong with my installation.

      Regards

      Test project

      M 1 Reply Last reply Reply Quote 0
      • M
        mujeek last edited by

        Thank to Qt Support who pointed out the failure cause, this issue is now solved for me.
        This deployment failure is due to the value that Qt Creator 14.3.0 puts in dropdown "Run" of AndroidManifest.xml editor.
        screenshot.png
        I left the original value "AndroidDeploy_arm64_v8a", but this value is wrong since Qt Loader can't find it in the APK.
        When I change it to "AndroidDeploy" my application starts.

        F 1 Reply Last reply Reply Quote 1
        • M
          mujeek @mujeek last edited by

          @mujeek
          Example project compiles under a new installation of Qt 5.15.0 + Qt Creator 14.3.0 on Windows 10, but it gives the same error:

          Your application encountered a fatal error and cannot continue

          when it runs on a real Android device.
          It seems that build host operating system doesn't matter.
          Here is what "Application Output" pane shows in Qt Creator 14.3.0 for Win when application is deployed and run on an Android 9 device:

          I t.androiddeplo: Late-enabling -Xcheck:jni
          W re-initialized>: type=1400 audit(0.0:4403): avc: denied { read } for name="u:object_r:mtk_amslog_prop:s0" dev="tmpfs" ino=1225 scontext=u:r:untrusted_app:s0:c101,c256,c512,c768 tcontext=u:object_r:mtk_amslog_prop:s0 tclass=file permissive=0
          E libc    : Access denied finding property "persist.vendor.sys.activitylog"
          W System  : ClassLoader referenced unknown path:
          D OpenGLRenderer: Skia GL Pipeline
          I QtCore  : Start
          I Qt      : qt started
          W System.err: java.lang.Exception:
          W System.err: 	at org.qtproject.qt5.android.bindings.QtLoader.loadApplication(QtLoader.java:268)
          W System.err: 	at org.qtproject.qt5.android.bindings.QtLoader.startApp(QtLoader.java:505)
          W System.err: 	at org.qtproject.qt5.android.bindings.QtActivityLoader.onCreate(QtActivityLoader.java:166)
          W System.err: 	at org.qtproject.qt5.android.bindings.QtActivity.onCreateHook(QtActivity.java:266)
          W System.err: 	at org.qtproject.qt5.android.bindings.QtActivity.onCreate(QtActivity.java:273)
          W System.err: 	at android.app.Activity.performCreate(Activity.java:7136)
          W System.err: 	at android.app.Activity.performCreate(Activity.java:7127)
          W System.err: 	at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1271)
          W System.err: 	at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2924)
          W System.err: 	at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3079)
          W System.err: 	at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:78)
          W System.err: 	at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108)
          W System.err: 	at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68)
          W System.err: 	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1836)
          W System.err: 	at android.os.Handler.dispatchMessage(Handler.java:106)
          W System.err: 	at android.os.Looper.loop(Looper.java:193)
          W System.err: 	at android.app.ActivityThread.main(ActivityThread.java:6702)
          W System.err: 	at java.lang.reflect.Method.invoke(Native Method)
          W System.err: 	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
          W System.err: 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:911)
          I SurfaceFactory: [static] sSurfaceFactory = com.mediatek.view.impl.SurfaceFactoryImpl@20319d4
          D ViewRootImpl[QtActivity]: hardware acceleration = true , fakeHwAccelerated = false, sRendererDisabled = false, forceHwAccelerated = false, sSystemRendererDisabled = false
          V PhoneWindow: DecorView setVisiblity: visibility = 4, Parent = null, this = DecorView@6b11ac3[]
          D ViewRootImpl[QtActivity]: hardware acceleration = true , fakeHwAccelerated = false, sRendererDisabled = false, forceHwAccelerated = false, sSystemRendererDisabled = false
          V PhoneWindow: DecorView setVisiblity: visibility = 0, Parent = android.view.ViewRootImpl@31a47be, this = DecorView@6b11ac3[QtActivity]
          D Surface : Surface::allocateBuffers(this=0x7752f58000)
          I ConfigStore: android::hardware::configstore::V1_0::ISurfaceFlingerConfigs::hasWideColorDisplay retrieved: 0
          I ConfigStore: android::hardware::configstore::V1_0::ISurfaceFlingerConfigs::hasHDRDisplay retrieved: 0
          I OpenGLRenderer: Initialized EGL, version 1.4
          D OpenGLRenderer: Swap behavior 2
          D Surface : Surface::connect(this=0x7752f58000,api=1)
          D Surface : Surface::allocateBuffers(this=0x7752f59000)
          D Surface : Surface::connect(this=0x7752f59000,api=1)
          E ion     : ioctl c0044901 failed with code -1: Invalid argument
          D Surface : Surface::disconnect(this=0x7752f58000,api=1)
          D View    : [Warning] assignParent to null: this = DecorView@9059096[QtActivity]
          V PhoneWindow: DecorView setVisiblity: visibility = 4, Parent = android.view.ViewRootImpl@31a47be, this = DecorView@6b11ac3[QtActivity]
          D Surface : Surface::disconnect(this=0x7752f59000,api=1)
          D View    : [Warning] assignParent to null: this = DecorView@6b11ac3[QtActivity]
          
          
          "org.qtproject.androiddeploy" died.
          
          
          1 Reply Last reply Reply Quote 0
          • M
            mujeek last edited by

            Thank to Qt Support who pointed out the failure cause, this issue is now solved for me.
            This deployment failure is due to the value that Qt Creator 14.3.0 puts in dropdown "Run" of AndroidManifest.xml editor.
            screenshot.png
            I left the original value "AndroidDeploy_arm64_v8a", but this value is wrong since Qt Loader can't find it in the APK.
            When I change it to "AndroidDeploy" my application starts.

            F 1 Reply Last reply Reply Quote 1
            • F
              FernandoT @mujeek last edited by

              @mujeek Thank u, I run into this error, and this fixed it. Not all heroes wear a cape.

              I'm using Qt Creator 4.14.0 and Qt 5.15.2

              1 Reply Last reply Reply Quote 0
              • First post
                Last post