افزونه تنظیمات به شما امکان میدهد ویژگیهای ساخت مشترکی را که برای همه ماژولها اعمال میشود، در یک مکان متمرکز کنید، بنابراین نیازی به کپی و چسباندن پیکربندیها در چندین ماژول ندارید.
اعمال تنظیمات افزونه
افزونه تنظیمات را در فایل settings.gradle اعمال کنید. نسخه باید با نسخه AGP اعلام شده در فایل libs.versions.toml یکسان باشد:
کاتلین
pluginManagement { // Add the following. plugins { id("com.android.settings") version "8.13.0" apply false } } plugins { id("com.android.settings") }
گرووی
pluginManagement { // Add the following. plugins { id("com.android.settings") version "8.13.0" apply false } } plugins { id("com.android.settings") }
اعمال ویژگیهای ساخت
بلوک android را در فایل settings.gradle اعمال کنید. برخلاف فایلهای build.gradle در سطح ماژول، minSdk و targetSdk را در بلوک android سطح بالا اعمال کنید:
کاتلین
android { compileSdk = release(36) { minorApiLevel = 1 } minSdk { version = release(24) } targetSdk { version = release(36) } }
گرووی
android { compileSdk = release(36) { minorApiLevel = 1 } minSdk { version = release(24) } targetSdk { version = release(36) } }
You should remove these build properties from the module-level build.gradle files if you want the versions defined in the settings.gradle file to be applied. Keeping these properties in the module-level build.gradle files overrides those set in the settings.gradle file for that particular module.