Search code examples
androidqtqmllinker-errorsarmv7

A linking error when building APK files of QML apps


I use Qt 5.12 on a Windows 7 X64 machine and below is the Devices on Qt Creator 4.8:

enter image description here

As it's shown, SDK, NDK and JDK seem to be fine.

Through this path, I went to create a simple QML project called "test_1":

File => New File or Project => Application (template) => Qt Quick Application - Empty => The project name (Test_1) => (Build System) qmake => Minimal Required Qt Version 5.12 => Kits (Android X86, Arm7 and Desktop) => Finish

And here's the code:

import QtQuick 2.12
import QtQuick.Window 2.12

Window {
    visible: true
    width: 640
    height: 480
    title: qsTr("Hello QML World")
}

The SDK packages are also as follows:

enter image description here

Is there something faulty up to here?

Now testing the program using the kits:
Desktop: OK
Android X86 or Arm7 : Faild

Here's all contents of the Compile Output window in the red colour:

FAILURE: Build failed with an exception.

  • What went wrong: Execution failed for task ':processDebugResources'. Android resource linking failed Output: C:\Users\Abbasi\Desktop\Q_Apps\QML_Apps\Test_1\build-Test_1-Android_for_armeabi_v7a_Clang_Qt_5_12_0_for_Android_ARMv7-Debug\android-build\build\intermediates\merged_manifests\debug\processDebugManifest\merged\AndroidManifest.xml:39: 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]. error: failed processing manifest.

Command: C:\Users\Abbasi.gradle\caches\transforms-1\files-1.1\aapt2-3.2.0-4818971-windows.jar\83adb1c826b3da76392f22b7ff050e9c\aapt2-3.2.0-4818971-windows\aapt2.exe link -I\ C:\Users\Abbasi\AppData\Local\Android\sdk\platforms\android-21\android.jar\ --manifest\ C:\Users\Abbasi\Desktop\Q_Apps\QML_Apps\Test_1\build-Test_1-Android_for_armeabi_v7a_Clang_Qt_5_12_0_for_Android_ARMv7-Debug\android-build\build\intermediates\merged_manifests\debug\processDebugManifest\merged\AndroidManifest.xml\ -o\ C:\Users\Abbasi\Desktop\Q_Apps\QML_Apps\Test_1\build-Test_1-Android_for_armeabi_v7a_Clang_Qt_5_12_0_for_Android_ARMv7-Debug\android-build\build\intermediates\processed_res\debug\processDebugResources\out\resources-debug.ap_\ -R\ @C:\Users\Abbasi\Desktop\Q_Apps\QML_Apps\Test_1\build-Test_1-Android_for_armeabi_v7a_Clang_Qt_5_12_0_for_Android_ARMv7-Debug\android-build\build\intermediates\incremental\processDebugResources\resources-list-for-resources-debug.ap_.txt\ --auto-add-overlay\ --java\ C:\Users\Abbasi\Desktop\Q_Apps\QML_Apps\Test_1\build-Test_1-Android_for_armeabi_v7a_Clang_Qt_5_12_0_for_Android_ARMv7-Debug\android-build\build\generated\not_namespaced_r_class_sources\debug\processDebugResources\r\ --custom-package\ org.qtproject.example.Test_1\ -0\ apk\ --no-version-vectors Daemon: AAPT2 aapt2-3.2.0-4818971-windows Daemon #0 Output: C:\Users\Abbasi\Desktop\Q_Apps\QML_Apps\Test_1\build-Test_1-Android_for_armeabi_v7a_Clang_Qt_5_12_0_for_Android_ARMv7-Debug\android-build\build\intermediates\merged_manifests\debug\processDebugManifest\merged\AndroidManifest.xml:39: 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].

error: failed processing manifest. Command: C:\Users\Abbasi.gradle\caches\transforms-1\files-1.1\aapt2-3.2.0-4818971-windows.jar\83adb1c826b3da76392f22b7ff050e9c\aapt2-3.2.0-4818971-windows\aapt2.exe link -I\ C:\Users\Abbasi\AppData\Local\Android\sdk\platforms\android-21\android.jar\ --manifest\ C:\Users\Abbasi\Desktop\Q_Apps\QML_Apps\Test_1\build-Test_1-Android_for_armeabi_v7a_Clang_Qt_5_12_0_for_Android_ARMv7-Debug\android-build\build\intermediates\merged_manifests\debug\processDebugManifest\merged\AndroidManifest.xml\ -o\ C:\Users\Abbasi\Desktop\Q_Apps\QML_Apps\Test_1\build-Test_1-Android_for_armeabi_v7a_Clang_Qt_5_12_0_for_Android_ARMv7-Debug\android-build\build\intermediates\processed_res\debug\processDebugResources\out\resources-debug.ap_\ -R\ @C:\Users\Abbasi\Desktop\Q_Apps\QML_Apps\Test_1\build-Test_1-Android_for_armeabi_v7a_Clang_Qt_5_12_0_for_Android_ARMv7-Debug\android-build\build\intermediates\incremental\processDebugResources\resources-list-for-resources-debug.ap_.txt\ --auto-add-overlay\ --java\ C:\Users\Abbasi\Desktop\Q_Apps\QML_Apps\Test_1\build-Test_1-Android_for_armeabi_v7a_Clang_Qt_5_12_0_for_Android_ARMv7-Debug\android-build\build\generated\not_namespaced_r_class_sources\debug\processDebugResources\r\ --custom-package\ org.qtproject.example.Test_1\ -0\ apk\ --no-version-vectors Daemon: AAPT2 aapt2-3.2.0-4818971-windows Daemon #0

  • Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

  • Get more help at https://help.gradle.org

BUILD FAILED in 7s 14 actionable tasks: 1 executed, 13 up-to-date Building the android package failed! -- For more information, run this command with --verbose. 13:40:16: The process "C:\Qt\5.12.0\android_armv7\bin\androiddeployqt.exe" exited with code 14. Error while building/deploying project Test_1 (kit: Android for armeabi-v7a (Clang Qt 5.12.0 for Android ARMv7)) When executing step "Build Android APK"

I even went for android-ndk-r17c-windows-x86_64.zip and replaced it with NDK r18b, but no changes in the result!

What is the problem please? Isn't that related to the path I created the project? I think you, too, create Android apps using the Arm7 kit and building the application is part of its creation. So there must be some way to solve the problem. Agree? Would you help.


Solution

  • It seems that even tho the Qt documentation says API 21, it doesn't really work, I get the same manifest errors if I target API 21.

    Furthermore, the google market currently doesn't accept apps that target anything lower than API 26. And that is a fast moving target.

    This however doesn't mean you must limit yourself to devices that run Android 8 or above. You can specify the lower API limit in your manifest file.

    Activate the Android kit for your project, then go to the project settings, in the Build Steps, expand the Build Android APK pane, set the Android build SDK to andrid-28. Then further down, there is a button Create Templates - click that to generate an editable manifest file. After you click it, it will add an AndroidManiest.xml file to your project. Double click that to open it in the manifest editor, then set Minimum required SDK to 19, and the target SDK to 28.

    This also means that you really only need API 28, it seems that the APIs themselves are "reverse-compatible" with older versions, meaning you don't need API 19 to use it as a minimum required version. As long as you provide a lower minimum version, the app should work just fine even if it targets the latest version.