Android Gradle 插件 7.3.0(2022 年 9 月)
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
Android Gradle 插件 7.3.0 是一个主要版本,包含各种新功能和改进。
兼容性
|
最低版本 |
默认版本 |
备注 |
Gradle |
7.4 |
7.4 |
如需了解详情,请参阅更新 Gradle。 |
SDK Build Tools |
30.0.3 |
30.0.3 |
安装或配置 SDK Build Tools。 |
NDK |
不适用 |
23.1.7779620 |
安装或配置其他版本的 NDK。 |
JDK |
11 |
11 |
如需了解详情,请参阅设置 JDK 版本。 |
支持自定义 C/C++ 构建系统
现在,您可以通过创建一个采用 Ninja build 文件格式写入 build 信息的 Shell 脚本,来创建自定义 C/C++ 构建系统。如需详细了解自定义 C/C++ 构建系统,请参阅使用 Ninja(实验性)集成自定义 C/C++ 构建系统。

最低 Kotlin 插件版本为 1.5.20
从 Android Gradle 插件 7.3.0-alpha08 开始,AGP 要求使用 Kotlin 插件版本 1.5.20 或更高版本。为了保持兼容性,请务必在 build.gradle
文件中指定 Kotlin 插件版本 1.5.20 或更高版本:
org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.20
已启用生成已归档 APK
从 AGP 7.3 开始,构建的所有 Android App Bundle 都会默认启用存储归档。归档是一项新的 app bundle 功能,今后,如果存储支持此功能,存储空间不足的用户就可以借助此功能有效管理应用空间。
如需停止生成已归档 APK,请按如下方式修改应用级 build.gradle
文件:
android {
bundle {
storeArchive {
enable = false
}
}
}
已废弃清单文件中的 package 属性
从 AGP 7.3.0-alpha04 开始,使用 Gradle 构建项目时,如果在清单文件中使用 package
属性,AGP 会生成警告。如需为应用设置命名空间,请在模块级 build.gradle
文件中使用 namespace
属性。如需了解详情,请参阅设置命名空间。
如需获取移至新命名空间 DSL 方面的帮助,请使用 AGP 升级助理 (Tools > AGP Upgrade Assistant)。
从 AGP 7.3.0-beta05 开始,支持的最低 SDK 版本最高可设为 33(可以使用 minSdk = 33
来设置)。最低 SDK 表示可运行您的应用的最低 Android 版本,在应用级 build.gradle
文件中进行设置。
本页面上的内容和代码示例受内容许可部分所述许可的限制。Java 和 OpenJDK 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-08-30。
[null,null,["最后更新时间 (UTC):2025-08-30。"],[],[],null,["Android Gradle Plugin 7.3.0 is a major release that includes a variety of new\nfeatures and improvements.\n\nCompatibility\n\n\n| | Minimum version | Default version | Notes |\n|----------------:|:---------------:|:---------------:|:------------------------------------------------------------------------------------------------------------------------------------------------------------:|\n| Gradle | 7.4 | 7.4 | To learn more, see [updating Gradle](/build/releases/gradle-plugin?buildsystem=ndk-build#updating-gradle). |\n| SDK Build Tools | 30.0.3 | 30.0.3 | [Install](/studio/intro/update#sdk-manager) or [configure](/tools/releases/build-tools) SDK Build Tools. |\n| NDK | N/A | 23.1.7779620 | [Install](/studio/projects/install-ndk#specific-version) or [configure](/studio/projects/install-ndk#apply-specific-version) a different version of the NDK. |\n| JDK | 11 | 11 | To learn more, see [setting the JDK version](/studio/intro/studio-config#jdk). |\n\n\u003cbr /\u003e\n\nSupport for custom C/C++ build systems\n\nYou can now create a custom C/C++ build system by making a shell script that\nwrites build information in the [Ninja](https://ninja-build.org/)\nbuild file format. To learn more about custom C/C++ build systems see\n[Integrate custom C/C++ build systems using Ninja (experimental)](/studio/build/cxx-ninja).\n\nMinimum Kotlin plugin version is 1.5.20\n\nStarting with Android Gradle plugin 7.3.0-alpha08, AGP requires Kotlin plugin\nversion 1.5.20 or higher. To stay compatible, make sure to specify Kotlin plugin\nversion 1.5.20 or higher in your `build.gradle` file: \n\n org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.20\n\nArchived APK generation enabled\n\nStarting with AGP 7.3, all Android App Bundles built have\n[Store Archival](https://android-developers.googleblog.com/2022/03/freeing-up-60-of-storage-for-apps.html) enabled by\ndefault. Archival is a new app bundle feature that in the future will allow\nusers with low storage to effectively manage their app space, if supported by\nthe store.\n\nTo opt out of the generation of archived APKs, modify the app-level\n`build.gradle` file as follows: \n\n android {\n bundle {\n storeArchive {\n enable = false\n }\n }\n }\n\nPackage attribute in manifest file is deprecated\n\nStarting with AGP 7.3.0-alpha04, if you use Gradle to build your project,\nAGP generates a warning if you use the `package` attribute in the\nmanifest file. To set the namespace for your app, use the `namespace`\nproperty in the module-level `build.gradle` file. To learn more, see\n[Set a namespace](/studio/build/configure-app-module#set-namespace).\n\nTo get help moving to the new namespace DSL, use the AGP Upgrade\nAssistant (**Tools \\\u003e AGP Upgrade Assistant**).\n\nAndroid platform support\n\nStarting with AGP 7.3.0-beta05, the highest supported minimum SDK version is 33\n(you can use `minSdk = 33`). The minimum SDK represents the minimum version of\nAndroid that your app can run on and is set in the app-level `build.gradle`\nfile."]]