No target architecture defined in json file using cmake compile for Android
-
Hey I'm trying to compile an app for android using cmake. When I push the
build
button, theandroid_deployment_settings.json
file that is produced looks like as follows.{ "_description": "This file is generated by QtCreator to be read by androiddeployqt and should not be modified by hand.", "application-binary": "libmicrophone-app.so", "architectures": { }, "ndk": "/Users/hoff/Library/Android/sdk/ndk/20.1.5948944", "ndk-host": "darwin-x86_64", "qml-root-path": "/Users/hoff/swdev/microphone-app", "qt": "/Users/hoff/Qt/5.12.6/android_x86", "sdk": "/Users/hoff/Library/Android/sdk", "stdcpp-path": "/Users/hoff/Library/Android/sdk/ndk/20.1.5948944/toolchains/llvm/prebuilt/darwin-x86_64/sysroot/usr/lib/", "tool-prefix": "llvm", "toolchain-prefix": "llvm", "useLLVM": true }
Then I get an error,
No target architecture defined in json file.
Which makes sense, there is no architecture defined. Looking at another project, the json file looks different.
Other non-related project using qmake:
{ "description": "This file is generated by qmake to be read by androiddeployqt and should not be modified by hand.", "qt": "/Users/hoff/Qt/5.12.6/android_x86", "sdk": "/Users/hoff/Library/Android/sdk", "sdkBuildToolsRevision": "29.0.2", "ndk": "/Users/hoff/Library/Android/sdk/ndk/20.1.5948944", "toolchain-prefix": "llvm", "tool-prefix": "llvm", "toolchain-version": "4.9", "ndk-host": "darwin-x86_64", "target-architecture": "x86", "qml-root-path": "/Users/hoff/Qt/Examples/Qt-5.12.6/location/mapviewer", "stdcpp-path": "/Users/hoff/Library/Android/sdk/ndk/20.1.5948944/sources/cxx-stl/llvm-libc++/libs/x86/libc++_shared.so", "useLLVM": true, "application-binary": "/Users/hoff/Qt/Examples/Qt-5.12.6/location/build-mapviewer-Android_for_x86_Clang_Qt_5_12_6_for_Android_x86-Debug/libqml_location_mapviewer.so" }
You can see the
target_architecture
is set.So how do I define the target architecture of x86 for my cmake build?
-
Looks like by this blog that qt just isn't producing the correct
android_deployment_settings.json
https://martin.rpdev.net/2018/08/04/building-android-projects-with-qt-creator-and-cmake.html
Might have to do it manually for now.
-
I am currently having the same problem. This worked not too long ago though.
Also interesting:
When QtCreator runs the androiddeployqt executable, the error is a different one: "Cannot find application binary libTestApp.so"However, when I manually execute everything the way QtCreator does it (at least the way it shows it in [4 Compile Output]), I get the mentioned "No target architecture defined in json file" error.