android - 如何删除 Android Studio 中的重复文件

标签 android android-studio firebase android-gradle-plugin firebase-realtime-database

我正在使用 Firebase 在 Android Studio 上构建一个项目。完成,当我编译时,出现以下错误。我在堆栈上阅读了关于此的其他答案,但无法理解我在做什么错。我是 Android Studio 新手

下面是我的app/build.gradle

apply plugin: 'com.android.application'

android {
    compileSdkVersion 25
    buildToolsVersion "25.0.0"
    defaultConfig {
        applicationId "com.example.root.dravis"
        minSdkVersion 15
        targetSdkVersion 25
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    //adding firebase dependencies manually
   compile 'com.android.support:appcompat-v7:25.0.0'
   compile 'com.android.support:design:25.0.0'
    compile 'com.google.firebase:firebase-database:9.8.00'
    testCompile 'junit:junit:4.12'
    compile 'com.firebase:firebase-client-android:2.5.2'
}

apply plugin: 'com.google.gms.google-services'

以下是我的错误Compile Time error Snap

最佳答案

您正在组合两个不同的、不兼容的 Firebase SDK 版本:

compile 'com.google.firebase:firebase-database:9.8.00'
compile 'com.firebase:firebase-client-android:2.5.2'

您应该只使用最新版本:9.8.0。

compile 'com.google.firebase:firebase-database:9.8.0'

有关在 Android 中开始使用这个最新的 Firebase 的更多信息,请参阅此处的文档:https://firebase.google.com/docs/android/setup

关于android - 如何删除 Android Studio 中的重复文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40279077/

相关文章:

java - getAdapterPosition recyclerview上的空对象引用

java - Android Volley 从 onResponse 问题中获取响应

android - 如何集成 youtube android 播放器

android - 具有大量 View 或动态 View 的 Viewpager

java - Android Studio 错误 : Cannot resolve symbol 'View'

Android Studio 4.0 卡在刷新中,无法运行项目

java - 如何恢复到上次 Activity ?

Firebase云函数: how to deal with continuous request

android - Flutter with Android Studio 不显示设备列表

javascript - react 组件中的状态不会呈现