Android Gradle 外掛程式 7.3.0 (2022 年 9 月)
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
Android Gradle 外掛程式 7.3.0 是主要版本,其中包含多項新功能和改善項目。
相容性
|
最低版本 |
預設版本 |
附註 |
Gradle |
7.4 |
7.4 |
詳情請參閱「更新 Gradle」一節。 |
SDK 版本工具 |
30.0.3 |
30.0.3 |
安裝或設定 SDK 版本工具。 |
NDK |
不適用 |
23.1.7779620 |
安裝或設定 NDK 其他版本。 |
JDK |
11 |
11 |
詳情請參閱「設定 JDK 版本」相關說明。 |
支援自訂 C/C++ 建構系統
您現在可以建立自訂 C/C++ 建構系統,方法是打造出利用 Ninja 建構檔案格式寫入建構資訊的殼層指令碼。如要進一步瞭解自訂 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 都會預設啟用儲存封存內容功能。「封存」是新的應用程式套件功能,日後在儲存空間支援的情況下,儲存空間不足的使用者將能有效管理應用程式空間。
如要選擇不採用產生已封存 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 和/或其關係企業的商標或註冊商標。
上次更新時間:2025-08-30 (世界標準時間)。
[[["容易理解","easyToUnderstand","thumb-up"],["確實解決了我的問題","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["缺少我需要的資訊","missingTheInformationINeed","thumb-down"],["過於複雜/步驟過多","tooComplicatedTooManySteps","thumb-down"],["過時","outOfDate","thumb-down"],["翻譯問題","translationIssue","thumb-down"],["示例/程式碼問題","samplesCodeIssue","thumb-down"],["其他","otherDown","thumb-down"]],["上次更新時間: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."]]