python-for-android icon indicating copy to clipboard operation
python-for-android copied to clipboard

build: add --android-target-sdk-version arg (defaults to android_api)

Open SomberNight opened this issue 3 years ago • 2 comments

Currently p4a has a variable named android_api (set by e.g. buildozer via the app.android.api config key). In AndroidManifest.xml, both compileSdkVersion and targetSdkVersion are set to android_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, while targetSdkVersion 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 than compileSdkVersion, as I am using an older NDK (r22b) that only supports compileSdkVersion<=30, but the google play store now requires targetSdkVersion>=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.

SomberNight avatar Oct 12 '22 16:10 SomberNight

I have a corresponding patch for buildozer to allow setting this in buildozer.spec, but will wait for feedback here first.

SomberNight avatar Oct 12 '22 16:10 SomberNight

bump

This would be great for extra flexibility

accumulator avatar Oct 31 '23 14:10 accumulator