Android Minimum, Target, Build SDK and NDK platforms relations



  • Hey, I've been developing a mobile app in QT and recently I found out that there are problems on some Android 9 devices. I'd like to ask what are the rules or recommendations about the platform versions. I understand that Minimum SDK is the minimal supported android version, not sure about Target but I guess that it's the version for which the app is optimized most. So all versions higher than Minimum SDK are valid for this app or is the target one a Maximum limit too? Is the best practice to set the Target version to the highest one?

    Next thing is the Android build SDK, how does it relate to the manifest values? Should it be always the Minimum one? And what connection does the NDK Platform variable have to all of it? See the pictures below.

    Is there any rule to set the safest combination based on the Min/Target platforms?

    Everything worked just fine until I upgraded to Qt 5.14 where I had to get rid of API 16. Now the APP crashes on some devices and even cannot be installed. Weird thing is that everything works fine in Android simulator and on all my devices Android 8, 7 and 5.

    manifest.jpg
    projects.jpg

    Thanks and have a nice day!


  • Moderators

    @Hitokage said in Android Minimum, Target, Build SDK and NDK platforms relations:

    [...] So all versions higher than Minimum SDK are valid for this app or is the target one a Maximum limit too? Is the best practice to set the Target version to the highest one?

    This is described in Android documentation in detail, but in essence you are correct: set minimum version to the lowest your app should support (users with older Android systems won't be able to run the app). As for target SDK - here the recommendation is to use the highest available version. It does not limit the "maximum" OS version - when a new version of Android comes out, your app will still be able to run on it.

    Next thing is the Android build SDK, how does it relate to the manifest values? Should it be always the Minimum one?

    It should be as new as possible. SDK retains backward compatibility. The newer you go, the more bug fixes you get :-)

    Google tends to change the APIs a lot, though, so sometimes newest SDKs simply don't work with Qt. It sucks, but there is no way around it.

    And what connection does the NDK Platform variable have to all of it? See the pictures below.

    There is no connection. NDK is an entirely different thing.

    Is there any rule to set the safest combination based on the Min/Target platforms?

    No, these are not related at all. The rule for NDK is: check what Qt documentation for your particular version says, and use that version. NDK contains compilers, libraries, public headers (the "sysroot"), it is used to compile your Qt code into machine code for particular architecture. If you set different NDK platform, it will import different headers and libraries into the build. In most cases that does not matter, Qt can work with multiple NDK levels. But sometimes (especially with 3rd party libraries) only one specific NDK level works - others will throw compilation errors.

    Everything worked just fine until I upgraded to Qt 5.14 where I had to get rid of API 16. Now the APP crashes on some devices and even cannot be installed. Weird thing is that everything works fine in Android simulator and on all my devices Android 8, 7 and 5.

    ¯\_(ツ)_/¯ That's how it works, unfortunately. A good (but annoying!) rule about developing on Android is: don't update SDK, NDK or Qt unless you absolutely have to. If it works, don't touch it ;-)

    If the app crashes - check with debugger. Perhaps it is a bug in your code. Cannot be installed - lower the minimal SDK level.



  • Thank you so much @sierdzio for the answer. It's clear now!


Log in to reply