gpt4 book ai didi

java - 未找到 ID 为 'com.google.gms.google-services' 的插件。 [ 安卓 ]

转载 作者:行者123 更新时间:2023-12-05 00:00:27 25 4
gpt4 key购买 nike

我正在设置 firebase

Firebase Official link
我正在关注此链接,我的第 2 步正确完成了它,但我认为我在第 3 步和第 4 步中犯了一些错误我的代码中有一些我不理解的缺陷,
如果你能帮助我们,我会很高兴。

构建 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.3' apply false
id 'com.android.library' version '7.1.3' apply false
}

task clean(type: Delete) {
delete rootProject.buildDir
}

构建 Gradle:模块

plugins {
id 'com.android.application'
}

//code here..
apply plugin: 'com.google.gms.google-services'

android {
compileSdk 32

defaultConfig {
applicationId "com.company.myfire"
minSdk 21
targetSdk 32
versionCode 1
versionName "1.0"

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}

buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-
rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}

dependencies {
classpath 'com.google.gms:google-services:4.3.10'
implementation 'androidx.appcompat:appcompat:1.4.1'
implementation 'com.google.android.material:material:1.6.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.3'
implementation platform('com.google.firebase:firebase-bom:30.0.0')
implementation 'com.google.firebase:firebase-analytics'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
}

最佳答案

插件需要添加到类路径中:

plugins {
id 'com.android.application' version '7.2.0' apply false
id 'com.android.library' version '7.2.0' apply false
id 'com.google.gms.google-services' version '4.3.10' apply false
}

然后可以在模块中应用:

plugins {
id 'com.android.application'
id 'com.google.gms.google-services'
}

关于java - 未找到 ID 为 'com.google.gms.google-services' 的插件。 [ 安卓 ],我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/72208587/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com