Java 如何连接Firebase和Android??请
失败:生成失败,出现异常Java 如何连接Firebase和Android??请,java,android,firebase,Java,Android,Firebase,失败:生成失败,出现异常 出了什么问题: 配置项目“:app”时出现问题 无法打开生成文件“C:\Users\Fuser\AndroidStudioProjects\NEW\app\build.gradle”(C:\Users\Fuser.gradle\caches\6.7.1\scripts\1if03h4fyufvb0fl5dcuqaurv)的cp_项目通用类缓存。 缺陷无法将源单元“BuildScript”类org.codehaus.groovy.ast.expr.TupleExpre
- 出了什么问题: 配置项目“:app”时出现问题
plugins {id 'com.android.application'
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'}
android {
compileSdkVersion 30
buildToolsVersion "30.0.3"
defaultConfig {
applicationId "com.example.anew"
minSdkVersion 21
targetSdkVersion 30
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 {
implementation 'com.google.firebase:firebase-analytics'
implementation platform('com.google.firebase:firebase-bom:28.0.0')
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'com.google.android.material:material:1.3.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'androidx.recyclerview:recyclerview:1.1.0'
testImplementation 'junit:junit:4.+'
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'}
我应该把这个放在哪里
应用插件:“com.android.application”
应用插件:“com.google.gms.googleservices”
哪里出了问题?在插件内部,而不是应用插件写入id。
id'com.android.application'
id'com.google.gms.google services'
像这样尝试构建Gradle。为了更好地理解,您可以参考这个。将build.Gradle文件中的插件块替换为
plugins {
id 'com.android.application'
id 'com.google.gms.google-services'
}
太好了,我做到了,谢谢,谢谢,我做得很好!!!