【问题标题】:I'm making a chat app using Android. I cannot connect to Firebase我正在使用 Android 制作聊天应用程序。我无法连接到 Firebase
【发布时间】:2021-05-28 04:15:40
【问题描述】:

IT 说“无法解析 Android 应用程序模块的 Gradle 配置。解决 gradle 构建问题和/或重新同步。'

下面是我的 build.gradle 模块。

plugins {
    id 'com.android.application'
}

android {
    compileSdkVersion 30
    buildToolsVersion "30.0.3"

    defaultConfig {
        applicationId "com.example.mchat"
        minSdkVersion 27
        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 'androidx.appcompat:appcompat:1.3.0'
    implementation 'com.google.android.material:material:1.3.0'
    implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
    testImplementation 'junit:junit:4.13.2'
    androidTestImplementation 'androidx.test.ext:junit:1.1.2'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
    implementation 'com.intuit.sdp:sdp-android:1.0.6'
}

【问题讨论】:

    标签: android firebase firebase-authentication


    【解决方案1】:

    确保 Android Studio 已更新并且您使用的是 Gradle 4.1 或更高版本。 另外,我在您的依赖项中看不到谷歌服务: com.google.gms.google-services

    我建议仔细检查文档中的步骤,以确保您已正确实施 firebase。 https://firebase.google.com/docs/android/setup#add-config-file

    在某些情况下,您的缓存构建可能已损坏,并且可能需要删除 .gradle/caches 目录。它保存 Gradle 构建缓存,如果您有关于构建缓存的错误,您可以安全地删除它以进行干净的构建。

    另外--no-build-cache 选项将在没有构建缓存的情况下运行 Gradle。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-11-13
      • 2015-05-02
      • 1970-01-01
      • 1970-01-01
      • 2020-04-10
      相关资源
      最近更新 更多