After updating Qt to 6.7.1 from 6.6 I am no longer able to run any applications built for Android. Even the built-in Qt examples such as "sensorsshowcase" build fine, but then immediately freeze on startup. Occasionally I get the following error messages in the QtCreator application output pane when the application attempts to start:
I libc : SetHeapTaggingLevel: tag level set to 0
I sensorsshowcase: Late-enabling -Xcheck:jni
I sensorsshowcase: Using CollectorTypeCMC GC.
D CompatibilityChangeReporter: Compat change id reported: 171979766; UID 10270; state: ENABLED
D CompatibilityChangeReporter: Compat change id reported: 242716250; UID 10270; state: DISABLED
W ziparchive: Unable to open '/data/app/~~B-syU75y9wcmnJ0UIiDrcg==/org.qtproject.example.sensorsshowcase-QOuwM3qfB_eTUShCSyjgjw==/base.dm': No such file or directory
W ziparchive: Unable to open '/data/app/~~B-syU75y9wcmnJ0UIiDrcg==/org.qtproject.example.sensorsshowcase-QOuwM3qfB_eTUShCSyjgjw==/base.dm': No such file or directory
D nativeloader: Configuring clns-4 for other apk /data/app/~~B-syU75y9wcmnJ0UIiDrcg==/org.qtproject.example.sensorsshowcase-QOuwM3qfB_eTUShCSyjgjw==/base.apk. target_sdk_version=31, uses_libraries=, library_path=/data/app/~~B-syU75y9wcmnJ0UIiDrcg==/org.qtproject.example.sensorsshowcase-QOuwM3qfB_eTUShCSyjgjw==/lib/arm64:/data/app/~~B-syU75y9wcmnJ0UIiDrcg==/org.qtproject.example.sensorsshowcase-QOuwM3qfB_eTUShCSyjgjw==/base.apk!/lib/arm64-v8a, permitted_path=/data:/mnt/expand:/data/user/0/org.qtproject.example.sensorsshowcase
V GraphicsEnvironment: Currently set values for:
V GraphicsEnvironment: angle_gl_driver_selection_pkgs=[]
V GraphicsEnvironment: angle_gl_driver_selection_values=[]
V GraphicsEnvironment: Global.Settings values are invalid: number of packages: 0, number of values: 0
V GraphicsEnvironment: Neither updatable production driver nor prerelease driver is supported.
D AndroidRuntime: Shutting down VM
E AndroidRuntime: FATAL EXCEPTION: main
E AndroidRuntime: Process: org.qtproject.example.sensorsshowcase, PID: 10826
E AndroidRuntime: java.lang.RuntimeException: Unable to instantiate application org.qtproject.qt.android.bindings.QtApplication package org.qtproject.example.sensorsshowcase: java.lang.ClassNotFoundException: Didn't find class "org.qtproject.qt.android.bindings.QtApplication" on path: DexPathList[[zip file "/data/app/~~B-syU75y9wcmnJ0UIiDrcg==/org.qtproject.example.sensorsshowcase-QOuwM3qfB_eTUShCSyjgjw==/base.apk"],nativeLibraryDirectories=[/data/app/~~B-syU75y9wcmnJ0UIiDrcg==/org.qtproject.example.sensorsshowcase-QOuwM3qfB_eTUShCSyjgjw==/lib/arm64, /data/app/~~B-syU75y9wcmnJ0UIiDrcg==/org.qtproject.example.sensorsshowcase-QOuwM3qfB_eTUShCSyjgjw==/base.apk!/lib/arm64-v8a, /system/lib64, /system_ext/lib64]]
E AndroidRuntime: at android.app.LoadedApk.makeApplicationInner(LoadedApk.java:1474)
E AndroidRuntime: at android.app.LoadedApk.makeApplicationInner(LoadedApk.java:1399)
E AndroidRuntime: at android.app.ActivityThread.handleBindApplication(ActivityThread.java:7268)
E AndroidRuntime: at android.app.ActivityThread.-$$Nest$mhandleBindApplication(Unknown Source:0)
E AndroidRuntime: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2337)
E AndroidRuntime: at android.os.Handler.dispatchMessage(Handler.java:107)
E AndroidRuntime: at android.os.Looper.loopOnce(Looper.java:232)
E AndroidRuntime: at android.os.Looper.loop(Looper.java:317)
E AndroidRuntime: at android.app.ActivityThread.main(ActivityThread.java:8501)
E AndroidRuntime: at java.lang.reflect.Method.invoke(Native Method)
E AndroidRuntime: at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:552)
E AndroidRuntime: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:878)
E AndroidRuntime: Caused by: java.lang.ClassNotFoundException: Didn't find class "org.qtproject.qt.android.bindings.QtApplication" on path: DexPathList[[zip file "/data/app/~~B-syU75y9wcmnJ0UIiDrcg==/org.qtproject.example.sensorsshowcase-QOuwM3qfB_eTUShCSyjgjw==/base.apk"],nativeLibraryDirectories=[/data/app/~~B-syU75y9wcmnJ0UIiDrcg==/org.qtproject.example.sensorsshowcase-QOuwM3qfB_eTUShCSyjgjw==/lib/arm64, /data/app/~~B-syU75y9wcmnJ0UIiDrcg==/org.qtproject.example.sensorsshowcase-QOuwM3qfB_eTUShCSyjgjw==/base.apk!/lib/arm64-v8a, /system/lib64, /system_ext/lib64]]
E AndroidRuntime: at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:259)
E AndroidRuntime: at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
E AndroidRuntime: at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
E AndroidRuntime: at android.app.AppComponentFactory.instantiateApplication(AppComponentFactory.java:76)
E AndroidRuntime: at androidx.core.app.CoreComponentFactory.instantiateApplication(CoreComponentFactory.java:52)
E AndroidRuntime: at android.app.Instrumentation.newApplication(Instrumentation.java:1345)
E AndroidRuntime: at android.app.LoadedApk.makeApplicationInner(LoadedApk.java:1467)
E AndroidRuntime: ... 11 more
10:24:13:
"org.qtproject.example.sensorsshowcase" died.
I've tried updating my CMake settings as described in this post but have not been able to get anything working: https://bugreports.qt.io/browse/QTBUG-119059. I have setup my NDK as describe in the Qt documentation using Android 34 i.e.: https://doc.qt.io/qt-6/android-getting-started.html
sdkmanager "platform-tools" "platforms;android-34" "build-tools;34.0.0
sdkmanager "ndk;26.1.10909125"
I'm testing on a pixel 6a and building for arm64-v8a (on Windows). Any idea what I might be doing wrong?
The problem turned out to be an issue with my default gradle.properties file (C:\Users%username%.gradle\gradle.properties) containing the older androidNdkVersion=25.1.8937393 used by Qt 6.6.
I deleted the file and replaced it with the following and everything worked:
# Project-wide Gradle settings.
# For more details on how to configure your build environment visit
# http://www.gradle.org/docs/current/userguide/build_environment.html
# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
org.gradle.jvmargs=-Xmx1024m -XX:MaxMetaspaceSize=768m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
# Enable building projects in parallel
org.gradle.parallel=true
# Gradle caching allows reusing the build artifacts from a previous
# build with the same inputs. However, over time, the cache size will
# grow. Uncomment the following line to enable it.
#org.gradle.caching=true
#org.gradle.configuration-cache=true
# Allow AndroidX usage
android.useAndroidX=true
androidBuildToolsVersion=34.0.0
androidCompileSdkVersion=android-34
androidNdkVersion=26.1.10909125
buildDir=build
qt5AndroidDir=C:/Qt/6.7.1/android_arm64_v8a/./src/android/java
qtAndroidDir=C:/Qt/6.7.1/android_arm64_v8a/./src/android/java
qtMinSdkVersion=23
qtTargetAbiList=arm64-v8a
qtTargetSdkVersion=34