When I tried to deploy an Qt 5.13 app to Android recently, it gives out multiple errors.
1. Solve the “-lc++” Error
If you are using the Android ndk r20 or later, the stdlib++ is linked by default. You can solve it by simply adding the following line into the .pro file.
1 |
QMAKE_LFLAGS += -nostdlib++ |
2. Solve the “androiddeployqt exited with code 14” Error
When I tried to compile the Android apk for the Qt app. The arm64 compilation goes through without problem, but for armeabi_v7a version it gives out the following error:
1 |
androiddeployqt exited with code 14 |
Looking deeper into the compilation log, it is complaining about
1 |
/home/tipsarea/app/build-mower-app-Android_for_armeabi_v7a_Clang_Qt_5_13_0_for_Android_ARMv7-Debug/android-build/build/intermediates/merged_manifests/debug/processDebugManifest/merged/AndroidManifest.xml:42: AAPT: error: 'orientation|uiMode|screenLayout|screenSize|smallestScreenSize|layoutDirection|locale|fontScale|keyboard|keyboardHidden|navigation|mcc|mnc|density' is incompatible with attribute configChanges (attr) flags [locale=4, fontScale=1073741824, keyboard=16, keyboardHidden=32, layoutDirection=8192, mcc=1, mnc=2, navigation=64, orientation=128, screenLayout=256, screenSize=1024, smallestScreenSize=2048, touchscreen=8, uiMode=512]. |
The problem is that this merged AndroidManifest.xml file is generated by Qt itself. To overwrite it with the correct version, here is the solution: go to the build step for Android APK and “Create Template”.
After save the template in a specified location (eg. app/android), it will also automatically update the .pro file with the ANDROID_PACKAGE_SOURCE_DIR pointing to the saved template.
Note: the Android build SDK version (or API) is not critical here, whether you are using android-21, 26 or 28, it doesn’t matter.