提问人:Bryan Antonnio 提问时间:11/13/2023 最后编辑:Doug StevensonBryan Antonnio 更新时间:11/13/2023 访问量:23
ID 为“com.android.application”的插件已在第 1 行请求
Plugin with id 'com.android.application' was already requested at line 1
问:
我仍然不明白为什么会这样。我什么也没做,突然我收到这个错误说
ID 为“com.android.application”的插件已在第 1 行请求
代码如下
plugins {
id("com.android.application")
id("com.google.gms.google-services") version "4.4.0" apply false
id("com.android.application")
id("com.google.gms.google-services")
}
android {
namespace = "com.example.automaticgate"
compileSdk = 34
defaultConfig {
applicationId = "com.example.automaticgate"
minSdk = 28
targetSdk = 33
versionCode = 1
versionName = "1.0"
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
isMinifyEnabled = false
proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro")
}
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
buildFeatures {
viewBinding = true
}
}
dependencies {
implementation("androidx.appcompat:appcompat:1.6.1")
implementation("com.google.android.material:material:1.10.0")
implementation("androidx.constraintlayout:constraintlayout:2.1.4")
implementation("androidx.lifecycle:lifecycle-livedata-ktx:2.6.2")
implementation("androidx.lifecycle:lifecycle-viewmodel-ktx:2.6.2")
implementation("androidx.navigation:navigation-fragment:2.7.5")
implementation("androidx.navigation:navigation-ui:2.7.5")
testImplementation("junit:junit:4.13.2")
androidTestImplementation("androidx.test.ext:junit:1.1.5")
androidTestImplementation("androidx.test.espresso:espresso-core:3.5.1")
// Import the BoM for the Firebase platform
implementation(platform("com.google.firebase:firebase-bom:32.5.0"))
// Add the dependency for the Realtime Database library
// When using the BoM, you don't specify versions in Firebase library dependencies
implementation("com.google.firebase:firebase-database")
}
我尝试以不同的名称和包创建一个新项目,但问题仍然相同。请帮忙,我可能会哭:')
答:
0赞
Doug Stevenson
11/13/2023
#1
您应用了两个插件两次:
plugins {
id("com.android.application")
id("com.google.gms.google-services") version "4.4.0" apply false
id("com.android.application")
id("com.google.gms.google-services")
}
只需删除重复项即可。
评论