[英]Where to put Android Gradle Plugin version in the new Android Studio (Bumblebee and above) Gradle setup?
當您使用最新版本的 Android Studio 創建新的 Android 項目時,它現在將為您提供僅包含插件塊的項目級別build.gradle
// Top-level build file where you can add configuration options common to all sub-projects/modules.
plugins {
id 'com.android.application' version '7.1.0' apply false
id 'com.android.library' version '7.1.0' apply false
id 'org.jetbrains.kotlin.android' version '1.6.10' apply false
}
我的問題是現在如何使用此設置指定 AGP 的版本? 在它看起來像這樣之前
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
// This block encapsulates custom properties and makes them available to all modules in the project.
ext {
kotlin_version = '1.6.20-M1'
}
dependencies {
classpath 'com.android.tools.build:gradle:7.4.0-alpha03'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
我也想知道你將如何在一些仍然需要它的插件上添加類路徑,比如
classpath 'com.google.gms:google-services:4.3.10'
我也不明白com.android.library
插件是做什么的,為什么它在應用程序模塊中?
要問的另一件事是,通過這個新設置,您有兩個插件塊,一個在應用程序級別,一個在項目級別。 這真的有必要嗎? 那有什么意義呢? 謝謝
buildscript {
dependencies {
classpath "com.google.dagger:hilt-android-gradle-plugin:2.38.1"
}}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.