"No target architecture defined in json file" error while building for Android
Solved
Mobile and Embedded
-
I have app app that successfully builds for Android and has
android { ANDROID_PACKAGE_SOURCE_DIR = $$PWD/platform/android }
in its .pro file.
But the same directive does not work with CMake:
if(ANDROID) set(ANDROID_PACKAGE_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/platform/android") endif()
when I compile the app for Android I get:
03:11:38: Running steps for project MyAppQt... 03:11:38: Starting: "E:\PFiles\cmake-3.19.1-win64-x64\bin\cmake.exe" --build E:/repos/examples/src/MyApp/build-MyAppQt-Android_Qt_6_2_0_android_Clang_x86_64-Debug --target all jom: parallel job execution disabled for Makefile [ 2%] Built target MyAppQt_lrelease [ 3%] Automatic MOC and UIC for target MyAppQt [ 3%] Built target MyAppQt_autogen [100%] Built target MyAppQt 03:11:39: The process "E:\PFiles\cmake-3.19.1-win64-x64\bin\cmake.exe" exited normally. 03:11:39: Starting: "E:\Qt\Qt6.2\windows\bin\androiddeployqt.exe" --input E:/repos/examples/src/MyApp/build-MyAppQt-Android_Qt_6_2_0_android_Clang_x86_64-Debug/android-MyAppQt-deployment-settings.json --output E:/repos/examples/src/MyApp/build-MyAppQt-Android_Qt_6_2_0_android_Clang_x86_64-Debug/android-build --android-platform android-30 --jdk "C:/Program Files/Java/jdk-11.0.11" --gradle No target architecture defined in json file. 03:11:39: The process "E:\Qt\Qt6.2\windows\bin\androiddeployqt.exe" exited with code 2. Error while building/deploying project MyAppQt (kit: Android Qt 6.2.0 (android) Clang x86_64) When executing step "Build Android APK" 03:11:39: Elapsed time: 00:01.
In
android-LinesGameQt-deployment-settings.json
I have this:{ "_description": "This file is generated by QtCreator to be read by androiddeployqt and should not be modified by hand.", "application-binary": "E:/repos/examples/src/MyApp/build-MyAppQt-Android_Qt_6_2_0_android_Clang_x86_64-Debug/libMyAppQt.so", "ndk": "C:/Users/D-Ef/AppData/Local/Android/Sdk/ndk/21.3.6528147", "ndk-host": "windows-x86_64", "qml-root-path": "E:/repos/examples/src/MyApp/MyAppQt", "qt": "E:/Qt/Qt6.2/android", "sdk": "C:/Users/D-Ef/AppData/Local/Android/Sdk", "stdcpp-path": "C:/Users/D-Ef/AppData/Local/Android/Sdk/ndk/21.3.6528147/toolchains/llvm/prebuilt/windows-x86_64/sysroot/usr/lib/x86_64-linux-android/libc++_shared.so", "target-architecture": "x86_64", "tool-prefix": "llvm", "toolchain-prefix": "llvm", "useLLVM": true }
With .pro file
android-LinesGameQt-deployment-settings.json
looks different and hasarchitectures
but nottarget-architecture
:{ "description": "This file is generated by qmake to be read by androiddeployqt and should not be modified by hand.", "qt": "E:/Qt/Qt6.2/android", "sdk": "C:/Users/D-Ef/AppData/Local/Android/Sdk", "sdkBuildToolsRevision": "30.0.3", "ndk": "C:/Users/D-Ef/AppData/Local/Android/Sdk/ndk/21.3.6528147", "toolchain-prefix": "llvm", "tool-prefix": "llvm", "ndk-host": "windows-x86_64", "architectures": {"x86_64":"x86_64-linux-android"}, "android-package-source-directory": "E:/repos/examples/src/MyApp/MyAppQt/platform/android", "android-min-sdk-version": "23", "android-target-sdk-version": "30", "qml-importscanner-binary": "E:/Qt/Qt6.2/windows/bin/qmlimportscanner", "rcc-binary": "E:/Qt/Qt6.2/windows/bin/rcc", "qml-root-path": "E:/repos/examples/src/MyApp/MyAppQt", "stdcpp-path": "C:/Users/D-Ef/AppData/Local/Android/Sdk/ndk/21.3.6528147/toolchains/llvm/prebuilt/windows-x86_64/sysroot/usr/lib", "qrcFiles": "E:/repos/examples/src/MyApp/MyAppQt/qml.qrc,E:/repos/examples/src/MyApp/MyAppQt/scene.qrc,E:/repos/examples/src/MyApp/MyAppQt/icons.qrc,E:/repos/examples/src/MyApp/build-MyAppQt-Android_Qt_6_2_0_android_Clang_x86_64-Debug/x86_64/qmake_qmake_immediate.qrc", "application-binary": "MyAppQt" }
My QT version is 6.2.
OS: Windows