无法在android工作室中设置firebase



因此,我正试图设置firebase并制作一个应用程序,一旦打开该应用程序,它就可以实现基本的登录功能,但我的构建失败,并显示以下消息:


Execution failed for task ':app:checkDebugAarMetadata'.
> Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
> Could not find com.firebaseui:firebase-ui-firestore:6.4.0.
Searched in the following locations:
- https://dl.google.com/dl/android/maven2/com/firebaseui/firebase-ui-firestore/6.4.0/firebase-ui-firestore-6.4.0.pom
- https://repo.maven.apache.org/maven2/com/firebaseui/firebase-ui-firestore/6.4.0/firebase-ui-firestore-6.4.0.pom
Required by:
project :app

Possible solution:
- Declare repository providing the artifact, see the documentation at https://docs.gradle.org/current/userguide/declaring_repositories.html

我的应用程序级别等级如下:


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

android {
compileSdkVersion 30
buildToolsVersion "30.0.3"

defaultConfig {
applicationId "com.example.socialapp"
minSdkVersion 16
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
}
kotlinOptions {
jvmTarget = '1.8'
}
}

dependencies {

implementation "androidx.appcompat:appcompat:$rootProject.appCompatVersion"

implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
api "org.jetbrains.kotlinx:kotlinx-coroutines-core:$rootProject.coroutines"
api "org.jetbrains.kotlinx:kotlinx-coroutines-android:$rootProject.coroutines"

// UI
implementation "androidx.constraintlayout:constraintlayout:$rootProject.constraintLayoutVersion"
implementation "com.google.android.material:material:$rootProject.materialVersion"

/* coroutines support for firebase operations */
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-play-services:1.1.1'


// Import the BoM for the Firebase platform
implementation platform('com.google.firebase:firebase-bom:26.1.0')
implementation 'com.google.firebase:firebase-firestore'
implementation 'com.google.firebase:firebase-auth-ktx'
implementation 'com.firebaseui:firebase-ui-firestore:6.4.0'

implementation 'com.google.android.gms:play-services-auth:19.0.0'

implementation 'com.github.bumptech.glide:glide:4.12.0'
annotationProcessor 'com.github.bumptech.glide:compiler:4.12.0'

// Testing
testImplementation "junit:junit:$rootProject.junitVersion"
androidTestImplementation "androidx.arch.core:core-testing:$rootProject.coreTestingVersion"
androidTestImplementation ("androidx.test.espresso:espresso-core:$rootProject.espressoVersion", {
exclude group: 'com.android.support', module: 'support-annotations'
})
androidTestImplementation "androidx.test.ext:junit:$rootProject.androidxJunitVersion"
}

我的项目级别等级如下:


// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext.kotlin_version = "1.5.20"
repositories {
google()
mavenCentral()
}
dependencies {
classpath "com.android.tools.build:gradle:4.2.1"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.google.gms:google-services:4.3.8'

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}

allprojects {
repositories {
google()
mavenCentral()
//jcenter() // Warning: this repository is going to shut down soon

}
}

task clean(type: Delete) {
delete rootProject.buildDir
}
ext {
appCompatVersion = '1.2.0'
constraintLayoutVersion = '2.0.2'
coreTestingVersion = '2.1.0'
coroutines = '1.3.9'
lifecycleVersion = '2.2.0'
materialVersion = '1.2.1'
// testing
junitVersion = '4.13.1'
espressoVersion = '3.1.0'
androidxJunitVersion = '1.1.2'
}

我无法找到此错误消息的确切解决方案,但我遇到了类似错误消息的解决方案,但是它们似乎不起作用,任何帮助都将不胜感激!

根据文档,您应该从6.4.0升级到7.x.x,因此您的等级应该看起来像:

// FirebaseUI for Cloud Firestore
implementation 'com.firebaseui:firebase-ui-firestore:7.2.0'

此外,你是否应用了谷歌服务应用插件:"com.Google.gms.googleservices",并确保你更新了

我通过更新修复了这个问题com.google.gms:google-services:4.3.8到版本4.3.10以及com.firebaseui:firebase-ui-firestore:6.4.08.0.0

最新更新