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. Building Android CMake Projects
Forum Updated to NodeBB v4.3 + New Features

Building Android CMake Projects

Scheduled Pinned Locked Moved Unsolved Mobile and Embedded
2 Posts 2 Posters 502 Views 1 Watching
  • 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.
  • L Offline
    L Offline
    Larvae
    wrote on 2 May 2020, 11:20 last edited by
    #1

    Hi

    I'm working on a CMake based Android project and have some questions regarding the build process.

    1. I would like to know the relation between a native build and the Android SDK (not NDK). The SDK is selected in the "Build APK" step, not in the cmake configure/build steps. So the native libraries do not depend on them, and I thought the APK was just to call the native main function, which would make a higher SDK level useless.

    2. I would like to know how to build a CMake based project using the command line (e.g. for CI/CD). The CMake build step is easy, as I can just copy the Variables from QtCreator and call CMake directly. But how do I build the APK? How can I make an AAB from multiple builds? And if the SDK level is important, can I make an AAB for the same ABI but with different SDK levels?

    S 1 Reply Last reply 4 May 2020, 05:07
    0
    • L Larvae
      2 May 2020, 11:20

      Hi

      I'm working on a CMake based Android project and have some questions regarding the build process.

      1. I would like to know the relation between a native build and the Android SDK (not NDK). The SDK is selected in the "Build APK" step, not in the cmake configure/build steps. So the native libraries do not depend on them, and I thought the APK was just to call the native main function, which would make a higher SDK level useless.

      2. I would like to know how to build a CMake based project using the command line (e.g. for CI/CD). The CMake build step is easy, as I can just copy the Variables from QtCreator and call CMake directly. But how do I build the APK? How can I make an AAB from multiple builds? And if the SDK level is important, can I make an AAB for the same ABI but with different SDK levels?

      S Offline
      S Offline
      sierdzio
      Moderators
      wrote on 4 May 2020, 05:07 last edited by
      #2

      @Larvae said in Building Android CMake Projects:

      Hi

      I'm working on a CMake based Android project and have some questions regarding the build process.

      1. I would like to know the relation between a native build and the Android SDK (not NDK). The SDK is selected in the "Build APK" step, not in the cmake configure/build steps. So the native libraries do not depend on them, and I thought the APK was just to call the native main function, which would make a higher SDK level useless.

      SDK is required to build an .apk package and to properly run the Qt wrappers (QtActivity, gradle and all the other Java code).

      1. I would like to know how to build a CMake based project using the command line (e.g. for CI/CD). The CMake build step is easy, as I can just copy the Variables from QtCreator and call CMake directly. But how do I build the APK? How can I make an AAB from multiple builds? And if the SDK level is important, can I make an AAB for the same ABI but with different SDK levels?
      1. Build with cmake.
      2. Run androiddeployqt.
      3. Take the .apk from build dir.

      Possibly, since Qt 5.14, it's enough to run make apk to automatically run androiddeployqt (as in qmake), but I don't know.

      If you want to bundle multiple APKs - the process is the same, you just need to set more architectures when building with cmake. You can do it by setting ANDROID_BUILD_ABI_arm64-v8a, ANDROID_BUILD_ABI_armeabi-v7a, ANDROID_BUILD_ABI_x86 and ANDROID_BUILD_ABI_x86_64 options in cmake.

      (Z(:^

      1 Reply Last reply
      1

      1/2

      2 May 2020, 11:20

      • Login

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