Qt6.7 Android: On app start crash with missing Java function
-
Hi!
I wrote a small app and tried to deploy it to my Android phone running Android 12(S). When the application starts it crashes immediately with the following error:
D CompatibilityChangeReporter: Compat change id reported: 171979766; UID 10616; state: ENABLED V GraphicsEnvironment: ANGLE Developer option for 'org.qtproject.theosys.theating' set to: 'default' V GraphicsEnvironment: App is not on the allowlist for updatable production driver. D LoadedApk: LoadedApk::makeApplication() appContext.mOpPackageName=org.qtproject.theosys.theating appContext.mBasePackageName=org.qtproject.theosys.theating D NetworkSecurityConfig: No Network Security Config specified, using platform default D NetworkSecurityConfig: No Network Security Config specified, using platform default D ActivityThread: handleBindApplication() -- D OpenGLRenderer: RenderThread::requireGlContext() D OpenGLRenderer: RenderThread::setGrContext() E heosys.theatin: Invalid ID 0x00000000. I DecorView: [INFO] isPopOver=false, config=true I DecorView: updateCaptionType >> DecorView@d5b6080[], isFloating=false, isApplication=true, hasWindowControllerCallback=true, hasWindowDecorCaption=false D DecorView: setCaptionType = 0, this = DecorView@d5b6080[] I DecorView: getCurrentDensityDpi: from real metrics. densityDpi=560 msg=resources_loaded I QtLoader: Sleeping for 3000ms, helping the native debugger to settle. Use the env QT_ANDROID_DEBUGGER_MAIN_THREAD_SLEEP_MS variable to change this value. E QtLoader: Can't find '/data/app/~~TkiedXB1f1n5B0Mq_2JIWg==/org.qtproject.theosys.theating-wpyScVQ3Yz4eIIP7qcKbPA==/lib/arm64/libtheating_null.so' E QtLoader: Loading main library failed I Dialog : mIsDeviceDefault = true, mIsSamsungBasicInteraction = false, isMetaDataInActivity = false I DecorView: [INFO] isPopOver=false, config=false I DecorView: updateCaptionType >> DecorView@449036b[], isFloating=true, isApplication=true, hasWindowControllerCallback=false, hasWindowDecorCaption=false D DecorView: setCaptionType = 0, this = DecorView@449036b[] D CompatibilityChangeReporter: Compat change id reported: 171228096; UID 10616; state: ENABLED D ScrollView: initGoToTop D ScrollView: initGoToTop I ViewRootImpl@d86d479[QtActivity]: setView = com.android.internal.policy.DecorView@449036b TM=true E heosys.theatin: No implementation found for void org.qtproject.qt.android.QtDisplayManager.handleOrientationChanged(int, int) (tried Java_org_qtproject_qt_android_QtDisplayManager_handleOrientationChanged and Java_org_qtproject_qt_android_QtDisplayManager_handleOrientationChanged__II) D AndroidRuntime: Shutting down VM E AndroidRuntime: FATAL EXCEPTION: main E AndroidRuntime: Process: org.qtproject.theosys.theating, PID: 3356 E AndroidRuntime: java.lang.UnsatisfiedLinkError: No implementation found for void org.qtproject.qt.android.QtDisplayManager.handleOrientationChanged(int, int) (tried Java_org_qtproject_qt_android_QtDisplayManager_handleOrientationChanged and Java_org_qtproject_qt_android_QtDisplayManager_handleOrientationChanged__II) E AndroidRuntime: at org.qtproject.qt.android.QtDisplayManager.handleOrientationChanged(Native Method) E AndroidRuntime: at org.qtproject.qt.android.QtDisplayManager.handleOrientationChanges(QtDisplayManager.java:106) E AndroidRuntime: at org.qtproject.qt.android.QtActivityDelegate.setUpLayout(QtActivityDelegate.java:116) E AndroidRuntime: at org.qtproject.qt.android.QtActivityDelegateBase.initMembers(QtActivityDelegateBase.java:135) E AndroidRuntime: at org.qtproject.qt.android.QtActivityDelegateBase.startNativeApplication(QtActivityDelegateBase.java:111) E AndroidRuntime: at org.qtproject.qt.android.QtActivityDelegate.startNativeApplication(QtActivityDelegate.java:38) E AndroidRuntime: at org.qtproject.qt.android.QtActivityBase.onCreate(QtActivityBase.java:106) E AndroidRuntime: at org.qtproject.qt.android.bindings.QtActivity.onCreate(QtActivity.java:16) E AndroidRuntime: at android.app.Activity.performCreate(Activity.java:8290) E AndroidRuntime: at android.app.Activity.performCreate(Activity.java:8270) E AndroidRuntime: at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1329) E AndroidRuntime: at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:4085) E AndroidRuntime: at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:4277) E AndroidRuntime: at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:103) E AndroidRuntime: at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135) E AndroidRuntime: at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95) E AndroidRuntime: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2443) E AndroidRuntime: at android.os.Handler.dispatchMessage(Handler.java:106) E AndroidRuntime: at android.os.Looper.loopOnce(Looper.java:226) E AndroidRuntime: at android.os.Looper.loop(Looper.java:313) E AndroidRuntime: at android.app.ActivityThread.main(ActivityThread.java:8751) E AndroidRuntime: at java.lang.reflect.Method.invoke(Native Method) E AndroidRuntime: at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:571) E AndroidRuntime: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1135) I Process : Sending signal. PID: 3356 SIG: 9
I tried to deploy this from my Mac as well as from my Linux workstation. The error is always the same.
When I deploy the same app to an Android emulator it works perfect. Does anybody know what I did wrong?
BTW: The app compiles and run successful on Linux and MacOS. I could even run it with WEBAssembly.
A.T.
-
@TheoSys You can run your app in your device from qt creator and may be able to see more info. Also show your settings for Android on Qt Creator.
Android 12 is already a bit old. My phone runs Android 14 now.
-
@JoeCFD Thanks for your reply.
In the meantime I found my error. It was the file android/res/values/libs.xml. After putting there the template, the error changed:I heosys.theatin: Late-enabling -Xcheck:jni E USNET : USNET: appName: org.qtproject.theosys.theating D ProcessState: Binder ioctl to enable oneway spam detection failed: Invalid argument D ActivityThread: setConscryptValidator D ActivityThread: setConscryptValidator - put I ActivityThread: Relaunch all activities: onCoreSettingsChange D ActivityThread: handleBindApplication()++ app=org.qtproject.theosys.theating D CompatibilityChangeReporter: Compat change id reported: 171979766; UID 10619; state: ENABLED V GraphicsEnvironment: ANGLE Developer option for 'org.qtproject.theosys.theating' set to: 'default' V GraphicsEnvironment: App is not on the allowlist for updatable production driver. D LoadedApk: LoadedApk::makeApplication() appContext.mOpPackageName=org.qtproject.theosys.theating appContext.mBasePackageName=org.qtproject.theosys.theating D NetworkSecurityConfig: No Network Security Config specified, using platform default D NetworkSecurityConfig: No Network Security Config specified, using platform default D ActivityThread: handleBindApplication() -- D OpenGLRenderer: RenderThread::requireGlContext() D OpenGLRenderer: RenderThread::setGrContext() E heosys.theatin: Invalid ID 0x00000000. I DecorView: [INFO] isPopOver=false, config=true I DecorView: updateCaptionType >> DecorView@d0ce714[], isFloating=false, isApplication=true, hasWindowControllerCallback=true, hasWindowDecorCaption=false D DecorView: setCaptionType = 0, this = DecorView@d0ce714[] I DecorView: getCurrentDensityDpi: from real metrics. densityDpi=560 msg=resources_loaded I QtLoader: Sleeping for 3000ms, helping the native debugger to settle. Use the env QT_ANDROID_DEBUGGER_MAIN_THREAD_SLEEP_MS variable to change this value. E AndroidRuntime: FATAL EXCEPTION: qtMainLoopThread E AndroidRuntime: Process: org.qtproject.theosys.theating, PID: 24319 E AndroidRuntime: java.lang.UnsatisfiedLinkError: dlopen failed: cannot locate symbol "_ZTVNSt6__ndk13pmr25monotonic_buffer_resourceE" referenced by "/data/app/~~pVM8LBXoSZx6hBD5_oSDPA==/org.qtproject.theosys.theating-ErikBBT6NvvxnHj__XDIwA==/lib/arm64/libQt6Core_arm64-v8a.so"... E AndroidRuntime: at java.lang.Runtime.load0(Runtime.java:929) E AndroidRuntime: at java.lang.System.load(System.java:1620) E AndroidRuntime: at org.qtproject.qt.android.QtLoader.loadLibraryHelper(QtLoader.java:476) E AndroidRuntime: at org.qtproject.qt.android.QtLoader.lambda$loadLibraries$1$org-qtproject-qt-android-QtLoader(QtLoader.java:549) E AndroidRuntime: at org.qtproject.qt.android.QtLoader$$ExternalSyntheticLambda1.run(Unknown Source:6) E AndroidRuntime: at org.qtproject.qt.android.QtThread.lambda$run$0(QtThread.java:57) E AndroidRuntime: at org.qtproject.qt.android.QtThread$$ExternalSyntheticLambda0.run(Unknown Source:4) E AndroidRuntime: at org.qtproject.qt.android.QtThread$1.run(QtThread.java:25) E AndroidRuntime: at java.lang.Thread.run(Thread.java:920) I Process : Sending signal. PID: 24319 SIG: 9 17:00:38: "org.qtproject.theosys.theating" died.
This is with Qt 6.7.0. I tried then with QT 6.6.2 and it worked! Looks like there is an error in Qt 6.7.0 for Android.
A.T.
-
-
@TheoSys said in Qt6.7 Android: On app start crash with missing Java function:
monotonic_buffer_resource
C++ std::pmr::monotonic_buffer_resource is not available for libQt6Core_arm64-v8a.so.
https://en.cppreference.com/w/cpp/memory/monotonic_buffer_resource
ldd /lib/arm64/libQt6Core_arm64-v8a.so to check its dependencies and add the miss lib to your build -
I had the same problem upgrading from 6.6 to 6.7, I resolved it by using the correct NDK (26.1.10909125), see https://doc.qt.io/qt-6/android-getting-started.html