New projects now use the Kotlin DSL (build.gradle.kts) by default for build
configuration. This offers a better editing experience than the Groovy DSL
(build.gradle) with syntax highlighting, code completion, and navigation to
declarations. Note that if you're using AGP 8.1 and the Kotlin DSL for build
configuration, you should use Gradle 8.1 for the best experience. To learn more,
see the Kotlin DSL migration guide.
Automatic per-app language support
Starting with Android Studio Giraffe Canary 7 and AGP 8.1.0-alpha07, you can
configure your app to support per-app language
preferences automatically. Based on your
project resources, the Android Gradle plugin generates the LocaleConfig file
and adds a reference to it in the final manifest file, so you no longer have to
do it manually. AGP uses the resources in the res folders of your app modules
and any library module dependencies to determine the locales to include in the
LocaleConfig file.
Note that the automatic per-app language feature supports apps that run Android
13 (API level 33) or higher. To use the feature, you must set
compileSdkVersion to 33 or higher. To configure per-app language preferences
for prior versions of Android, you still need to
use the APIs and in-app language pickers.
To enable automatic per-app language support, specify a default locale:
In the app module's res folder, create a new file called
resources.properties.
In the resources.properties file, set the default locale with
the unqualifiedResLocale label. To form the locale names, combine
the language code with the optional script and region codes, separating each
with a dash:
Language: Use the two- or three-letter
ISO 639-1
code.
For example if your default locale is American English:
unqualifiedResLocale=en-US
AGP adds this default locale and any
alternative locales
you've specified, using values-* directories in the res folder, to the
auto-generated LocaleConfig file.
Automatic per-app language support is off by default. To turn the feature on,
use the generateLocaleConfig setting in the androidResources {} block of the
module-level build.gradle.kts file (build.gradle file if you're using
Groovy):
Starting with AGP 8.1.0-alpha04, Android Lint contains bytecode targeting JVM
17. If you write custom lint checks, you need to compile with JDK 17 or higher
and specify jvmTarget = '17' in your Kotlin compiler options.
Starting with AGP 8.1.0-alpha10, you'll get a warning if you don't configure
native library compression using the DSL instead of the manifest. The
following guidance explains how to update your configuration to use the DSL. To
get help making these updates, use the AGP Upgrade Assistant
(Tools > AGP Upgrade Assistant).
To use uncompressed native libraries, remove the android::extractNativeLibs
attribute from the manifest and add the following code to the module-level
build.gradle.kts file (build.gradle file if you're using Groovy):
Enabling this with no signing configs specified causes AGP to use the
default debug signing config when running a profileable or debuggable
build. This flag is disabled by default to encourage build authors to
declare specific profiling signing configs.
android.experimental.library.desugarAndroidTest
AGP 8.0
false
This flag lets library builders enable core library desugaring for
test APKs without affecting the AAR produced, for example through linting.
We plan to eventually support this behavior in the Variant API.
If enabled, Gradle Managed Devices allows a user-defined custom device
type that can be provided by a plugin. This flag must be enabled if you
want to use the Firebase Test Lab plugin.
android.lint.printStackTrace
AGP 8.0
false
If enabled, Android lint prints a stacktrace if it crashes. This flag
has the same capabilities as the LINT_PRINT_STACKTRACE
environment variable.
Specifies the maximum number of concurrent Gradle Managed Devices
(AVDs) to be active at any one point in time. If the value is 0 or
negative, there is no maximum number of devices.
[AGP 8.1.0] ./gradlew test fails with "Unable to find manifest output" if both splits.abi.isEnable and testOptions.unitTests.isIncludeAndroidResources are true
[AGP 8.1.0] ./gradlew test fails with "Unable to find manifest output" if both splits.abi.isEnable and testOptions.unitTests.isIncludeAndroidResources are true
Do not run dexing task on subprojects' classes when they are already dex'd through artifact transforms
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2024-12-23 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-12-23 UTC."],[],[]]