The settings plugin lets you centralize common build properties that apply to all modules in one place so you don't need to copy and paste the configurations across multiple modules.
اعمال تنظیمات افزونه
Apply the settings plugin in the settings.gradle file. The version must be the same as the AGP version declared in the libs.versions.toml file:
کاتلین
pluginManagement { // Add the following. plugins { id("com.android.settings") version "9.0.0" apply false } } plugins { id("com.android.settings") }
گرووی
pluginManagement { // Add the following. plugins { id("com.android.settings") version "9.0.0" apply false } } plugins { id("com.android.settings") }
اعمال ویژگیهای ساخت
Apply the android block in the settings.gradle file. Unlike in module-level build.gradle files, apply the minSdk and targetSdk to the top-level android block:
کاتلین
android { compileSdk { version = release(36) { minorApiLevel = 1 } } minSdk { version = release(23) } targetSdk { version = release(36) } }
گرووی
android { compileSdk { version = release(36) { minorApiLevel = 1 } } minSdk { version = release(23) } targetSdk { version = release(36) } }
اگر میخواهید نسخههای تعریفشده در فایل settings.gradle اعمال شوند، باید این ویژگیهای ساخت را از فایلهای build.gradle سطح ماژول حذف کنید. نگهداشتن این ویژگیها در فایلهای build.gradle سطح ماژول، ویژگیهای تنظیمشده در فایل settings.gradle را برای آن ماژول خاص لغو میکند.