android.star¶
Raise Android SDK levels and the Android Gradle Plugin version.
Google Play requires a recent targetSdk every year, which makes this a
fleet-wide change for anyone with several apps. Edits are line-based and
work on Groovy and Kotlin DSL build files and version catalogs.
| Function | What it does |
|---|---|
sdk_levels |
Reads the SDK levels every module's build file sets. |
set_sdk |
Raises the compile, target and min SDK levels, never lowering one. |
set_agp_version |
Moves the Android Gradle Plugin to a version. |
sdk_levels¶
Reads the SDK levels every module's build file sets.
Arguments
| Name | Description |
|---|---|
repo |
The repo passed to change(repo). |
Returns: A dict of build file path to a dict of compile, target and
min levels (as integers), for files that set any.
Example
set_sdk¶
Raises the compile, target and min SDK levels, never lowering one.
Covers compileSdk 34, compileSdkVersion 33, targetSdk = 34 and
minSdk(24) forms in every module, and compileSdk, targetSdk and
minSdk entries in a version catalog's [versions].
Arguments
| Name | Description |
|---|---|
repo |
The repo passed to change(repo). |
compile |
The compileSdk level to raise to, or None. |
target |
The targetSdk level to raise to, or None. |
min |
The minSdk level to raise to, or None. |
Returns: The list of paths that changed.
Example
Used in: android-target-sdk
set_agp_version¶
Moves the Android Gradle Plugin to a version.
A newer version already there is kept, so a campaign never lowers one.
Sets the com.android.* plugins wherever they are declared (plugin
blocks or a version catalog) and the
com.android.tools.build:gradle classpath of older builds. Upgrading AGP
often needs a newer Gradle wrapper too; see
gradle.set_wrapper_version.
Arguments
| Name | Description |
|---|---|
repo |
The repo passed to change(repo). |
version |
The AGP version, such as 8.7.2. |
Returns: The list of paths that changed.
Example