我收到'import com.firebase.client.Firebase;'的错误在Android上

时间:2017-11-08 08:37:55

标签: android firebase

我正在使用Firebase开展项目,但在更新版本后,我收到'import com.firebase.client.Firebase;'的错误。

我清理了项目,重建并从本地删除,并从我存储信息的github导入。

这是我的build.gradle

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.0.0'
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
        classpath 'com.google.gms:google-services:3.1.0'
    }
}

allprojects {
    repositories {
        jcenter()
        maven {url 'https://jitpack.io'}
        maven {url 'https://maven.google.com'}
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

这是我的build.gradle(模块:应用)

apply plugin: 'com.android.application'

android {
    compileSdkVersion 26
    buildToolsVersion '26.0.2'
    defaultConfig {
        applicationId "com.example.android"
        minSdkVersion 19
        targetSdkVersion 26
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    packagingOptions {
        exclude 'META-INF/LICENSE'
        exclude 'META-INF/LICENSE-FIREBASE.txt'
        exclude 'META-INF/NOTICE'
    }
}

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'
    })

    compile 'com.android.support:appcompat-v7:26.+'
    compile 'com.android.support.constraint:constraint-layout:1.0.2'
    compile 'com.android.support:design:26.0.0-alpha1'
    compile 'com.android.support:support-v4:26.0.0-alpha1'
    compile 'com.android.support:recyclerview-v7:26.0.0-alpha1'
    compile 'com.android.support:cardview-v7:26.0.0-alpha1'

    compile 'com.google.android.gms:play-services-maps:11.0.4'
    compile 'com.google.maps.android:android-maps-utils:0.4.+'
    compile 'com.google.firebase:firebase-core:11.0.4'
    compile 'com.google.firebase:firebase-database:11.0.4'
    compile 'com.google.firebase:firebase-auth:11.0.4'
    compile 'com.google.firebase:firebase-storage:11.0.4'

    compile 'com.google.code.gson:gson:2.2.4'
    compile 'com.google.zxing:core:3.2.1'
    compile 'de.hdodenhof:circleimageview:2.1.0'
    compile 'com.github.wdullaer:MaterialDateTimePicker:v3.0.0'
    compile 'com.journeyapps:zxing-android-embedded:3.2.0@aar'
    testCompile 'junit:junit:4.12'
}

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

这是我遇到的错误

错误的屏幕截图

image

1 个答案:

答案 0 :(得分:0)

尝试在gradle文件中添加此行。

compile 'com.firebase:firebase-client-android:2.5.0'