Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ndk-build,cargo-apk: Default target_sdk_version to 30 or lower #203

Merged
merged 1 commit into from
Nov 24, 2021

Conversation

MarijnS95
Copy link
Member

@MarijnS95 MarijnS95 commented Nov 22, 2021

Depends on #197

As discussed in 197 setting target_sdk_version to the "arbitrary" highest available SDK version is nonsense. This target version (unlike min_sdk_version which defines the least set of symbols that should be available) has real impact on the runtime of an application, in particular the compatibility or stringency of rules Android applies to your application. Certain APIs may not work at all or be heavily restricted on newer target versions because they are deemed too dangerous, and Android expects the user has tested their app against these limitations and is communicating this by setting target_sdk_version to that particular value. Hence this shouldn't change purely based on the environment, even for the default.

To retain some backwards compatibility with previous cargo-apk we set this to level 30 which is the least required by Google Play today, and exactly what users will have been targeting using NDK r22 (assuming the SDK for this platform was installed as well) since SDK version 31 support with NDK r23 only arrived just last week.

Thanks @hrydgard for bringing this to my attention!

@@ -1,5 +1,9 @@
# Unreleased

- **Breaking**: Default `target_sdk_version` to `29` or lower for more consistent
interaction with Android backwards compatibility and tighter rules:
Copy link
Member Author

@MarijnS95 MarijnS95 Nov 22, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not a fan of this wording, will see if I can come up with something better after a night's sleep.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated. @msiglreith what do you think?

@hrydgard
Copy link
Contributor

hrydgard commented Nov 23, 2021

I think you misread the page (which is because it's not properly updated), because it says:

Starting in August 2021, new apps will need to:

  • Target API level 30 (Android 11) or above and adjust for behavioral changes; except Wear OS apps, which must continue to target API level 28 or higher.

So the correct level to use by default is 30, not 29, since we are now after August. And yes, that does have scoped storage implications - it enforces it on Android 11 and 12, and you need to opt out to not get enforced on Android 10 as well.

@MarijnS95
Copy link
Member Author

Thanks for pointing that out. Indeed, that page literally starts out with:

New apps and app updates must target Android 10 (API level 29) or higher

Hence the confusion. Will update this.

@MarijnS95 MarijnS95 changed the title ndk-build,cargo-apk: Default target_sdk_version to 29 or lower ndk-build,cargo-apk: Default target_sdk_version to 30 or lower Nov 23, 2021
cargo-apk/README.md Outdated Show resolved Hide resolved
As discussed in [197] setting `target_sdk_version` to the "arbitrary"
highest available SDK version is nonsense.  This target version (unlike
`min_sdk_version` which defines the least set of symbols that should be
available) has real impact on the runtime of an application, in
particular the compatibility or stringency of rules Android applies to
your application.  Certain APIs may not work at all or be heavily
restricted on newer target versions because they are deemed too
dangerous, and Android expects the user has tested their app against
these limitations and is communicating this by setting
`target_sdk_version` to that particular value.  Hence this shouldn't
change purely based on the environment, even for the default.

To retain some backwards compatibility with previous `cargo-apk` we set
this to level 30 which is the least [required by Google Play] today, and
exactly what users will have been targeting using NDK r22 (assuming the
SDK for this `platform` was installed as well) since SDK version 31
support with NDK r23 only [arrived just last week].

[197]: #197 (comment)
[required by Google Play]: https://developer.android.com/distribute/best-practices/develop/target-sdk
[arrived just last week]: #189
@MarijnS95 MarijnS95 merged commit 240389f into master Nov 24, 2021
@MarijnS95 MarijnS95 deleted the target-sdk-version branch November 24, 2021 22:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants