build: add --android-target-sdk-version arg (defaults to android_api) #2686
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Currently p4a has a variable named
android_api
(set by e.g. buildozer via theapp.android.api
config key). InAndroidManifest.xml
, bothcompileSdkVersion
andtargetSdkVersion
are set toandroid_api
.This PR allows setting the targetSdkVersion and compileSdkVersion independently, by adding a
--android-target-sdk-version
build arg.compileSdkVersion
is a compilation setting used by e.g. the NDK at build-time, whiletargetSdkVersion
is just a field to set in the manifest, only used at runtime (mainly in the Java world). (see e.g. https://stackoverflow.com/a/26694276 )note: my current use case is to set
targetSdkVersion
to higher thancompileSdkVersion
, as I am using an older NDK (r22b) that only supportscompileSdkVersion<=30
, but the google play store now requirestargetSdkVersion>=31
. Historically it has sometimes been the case that p4a was using an old NDK, and I had to use this trick once already a few years ago, for the same reason (but atm p4a is using a very new NDK, I am just having troubles rebasing my fork). Regardless, I believe setting the two parameters independently might have other use cases.