首页 > 解决方案 > 在 Android Studio 中连接到 Firebase 的 Gradle 的当前版本是什么?

问题描述

我正在考虑在 android studio 上创建一个应用程序,目前,我正在创建它的登录部分。我正在观看有关如何执行此操作的教程,并且按照所有说明进行操作,但它在 build.gradle(模块:app)文件中给了我一个关于连接到 Firebase 以通过电子邮件和密码对用户进行身份验证的错误。我认为该错误与以下代码行中的版本号有关:apply plugin: 'com.android.application'

android {
compileSdkVersion 28
buildToolsVersion "29.0.3"

defaultConfig {
    applicationId "com.example.simplysnap"
    minSdkVersion 15
    targetSdkVersion 28
    versionCode 1
    versionName "1.0"

    testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}

buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
    }
}
}
dependencies {

implementation fileTree(dir: "libs", include: ["*.jar"])
implementation 'androidx.appcompat:appcompat:28.0.0'
//The two lines below have the errors
implementation 'android.support:appcompat-v7:28.0.0'
implementation 'androidx.appcompat:design:1.1.0'
// Until here
implementation 'androidx.support:support-v7:28.0.0'
implementation 'androidx.support:design:28.0.0'
implementation 'androidx.constraintlayout:constraintlayout:28.0.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:28.0.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
compile 'com.google.api-client:google-api-client:1.22.0'
compile 'com.google.http-client:google-http-client-gson:1.22.0'

}

尝试使用电子邮件和密码连接到 Firebase 身份验证时出现的错误是:无法解析 Android 应用程序模块的 Gradle 配置。解决 gradle 构建问题和/或重新同步。

这两行的最新版本是什么: implementation 'android.support:appcompat-v7:28.0.0' implementation 'androidx.appcompat:design:1.1.0' 语法是否正确?提前致谢!

标签: androidfirebaseandroid-studiogradlebuild.gradle

解决方案


这是将android项目与firebase连接的链接,只需按照链接中指导的步骤操作

确保您在firebase控制台中添加了sha1,您可以按照以下链接步骤获取sh1 https://stackoverflow.com/a/34223470/5309463

https://firebase.google.com/docs/android/setup

实现 'android.support:appcompat-v7:28.0.0' 使用这个代替实现 'androidx.legacy:legacy-support-v4:1.0.0'

使用这个等级

    implementation fileTree(dir: "libs", include: ["*.jar"])
    implementation 'androidx.appcompat:appcompat:1.1.0'
    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
    testImplementation 'junit:junit:4.13'
    androidTestImplementation 'androidx.test.ext:junit:1.1.1'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
    implementation 'com.google.api-client:google-api-client:1.22.0'
    implementation 'com.google.http-client:google-http-client-gson:1.22.0'

推荐阅读