Firebase初始化问题(android java)



我想初始化一个Firebase,但遇到了一些问题。

这是一个错误的文本:

Caused by: org.gradle.api.internal.artifacts.ivyservice.DefaultLenientConfiguration$ArtifactResolveException: Could not resolve all files for configuration ':app:debugCompileClasspath'.

以下是项目build.gradle代码:

buildscript {
repositories {
google()  // Google's Maven repository
}
dependencies {
classpath 'com.google.gms:google-services:4.3.10'
classpath 'com.android.tools.build:gradle:4.0.2'
}
}
plugins {
id 'com.android.application' version '7.1.0' apply false
id 'com.android.library' version '7.1.0' apply false
}
allprojects {
repositories {
google()
}
}

当我从中删除谷歌((时,问题消失了

allprojects {
repositories {
google()
}
}

但当我删除谷歌((时,还有另一个错误:GoogleSignIn.getLastSignedInAccount导致异常

还有渐变错误日志:

FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task 
':app:dataBindingMergeDependencyArtifactsDebug'.
Could not resolve all files for configuration 
':app:debugCompileClasspath'.
Could not find org.jetbrains.kotlin:kotlin-stdlib:1.6.0.
Required by:
project :app > androidx.navigation:navigation-fragment:2.4.0
project :app > androidx.navigation:navigation-runtime:2.4.0
project :app > androidx.navigation:navigation-common:2.4.0
Could not find org.jetbrains.kotlin:kotlin-stdlib:1.6.0.
Required by:
project :app > androidx.fragment:fragment:1.4.0
project :app > androidx.fragment:fragment-ktx:1.4.0
Could not find org.jetbrains.kotlin:kotlin-stdlib:1.6.0.
Required by:
project :app > androidx.core:core-ktx:1.2.0
Could not find org.jetbrains.kotlin:kotlin-stdlib:1.6.0.
Required by:
project :app > androidx.activity:activity-ktx:1.2.3
project :app > androidx.lifecycle:lifecycle-livedata-core-ktx:2.3.1
project :app > androidx.lifecycle:lifecycle-viewmodel-ktx:2.3.1
project :app > androidx.savedstate:savedstate-ktx:1.1.0
project :app > androidx.lifecycle:lifecycle-runtime-ktx:2.3.1
Could not find org.jetbrains.kotlin:kotlin-stdlib:1.6.0.
Required by:
project :app > androidx.collection:collection-ktx:1.1.0
Could not find org.jetbrains.kotlinx:kotlinx-coroutines-android:1.4.1.
Required by:
project :app > androidx.lifecycle:lifecycle-viewmodel-ktx:2.3.1
project :app > androidx.lifecycle:lifecycle-runtime-ktx:2.3.1
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 1s

通过在中添加jcenter((解决了问题

allprojects {
repositories {
google()
jcenter()
}
}

我不知道它为什么有效,为什么以前不起作用。如果你知道原因或者你有其他解决方案,请回答。

最新更新