Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. "No target architecture defined in json file" error while building for Android
Forum Update on Monday, May 27th 2025

"No target architecture defined in json file" error while building for Android

Scheduled Pinned Locked Moved Solved Mobile and Embedded
cmakeandroid
3 Posts 2 Posters 773 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    Dmitriano
    wrote on 5 Dec 2021, 00:23 last edited by Dmitriano 12 May 2021, 00:35
    #1

    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 has architectures but not target-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

    see also https://forum.qt.io/topic/110544/no-target-architecture-defined-in-json-file-using-cmake-compile-for-android

    D 1 Reply Last reply 12 Dec 2021, 12:45
    0
    • D Dmitriano
      5 Dec 2021, 00:23

      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 has architectures but not target-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

      see also https://forum.qt.io/topic/110544/no-target-architecture-defined-in-json-file-using-cmake-compile-for-android

      D Offline
      D Offline
      Dmitriano
      wrote on 12 Dec 2021, 12:45 last edited by
      #2

      @Dmitriano this probably started to work when I updated build.gradle.

      A 1 Reply Last reply 18 Jan 2022, 19:53
      1
      • D Dmitriano
        12 Dec 2021, 12:45

        @Dmitriano this probably started to work when I updated build.gradle.

        A Offline
        A Offline
        AkshayFP
        wrote on 18 Jan 2022, 19:53 last edited by
        #3

        @Dmitriano How did you update the build.gradle

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved