Android Firebase java.lang.NoSuchMethodError:类中没有虚拟方法zzbqo()Z

时间:2018-08-20 20:03:55

标签: android firebase firebase-realtime-database

我正遇到此错误,我不知道出了什么问题。

FirebaseDatabase无法初始化,从而导致此错误。所有依赖项均与每个Firebase文档相同,但仍会出现此错误。

Firebase数据库初始化时,应用程序总是崩溃。

有人知道解决方案是因为我尝试了所有事情,但都尝试了。

 java.lang.NoSuchMethodError: No virtual method zzbqo()Z in class Lcom/google/firebase/FirebaseApp; or its super classes (declaration of 'com.google.firebase.FirebaseApp' appears in /data/app/com.hypertrack.uber_consumer-DvUezTpoT5o5n6I7J2WLgg==/base.apk)
    at com.google.firebase.database.FirebaseDatabase.getInstance(Unknown Source:128)
    at com.google.firebase.database.FirebaseDatabase.getInstance(Unknown Source:22)

这是我的礼物

apply plugin: 'com.android.application'
//apply plugin: 'io.fabric'

android {
    compileSdkVersion 27
    defaultConfig {
        applicationId "com.example.abc"
        minSdkVersion 16
        targetSdkVersion 27
        versionCode 1
        versionName "1.0"
        multiDexEnabled true
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

//HyperTrack: HyperTrack library
repositories {
    maven {
        url 'http://hypertrack-android-sdk.s3-website-us-west-2.amazonaws.com/'
    }
}


ext {
    supportVersion = '27.1.0'
    playServicesVersion = '11.8.0'
    butterKnifeVersion = '8.8.1'
    glideVersion = '3.7.0'
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation "com.android.support:appcompat-v7:$supportVersion"

    //Custom ProgressBar/ loader
    implementation 'com.github.rahatarmanahmed:circularprogressview:2.5.0'

    //implementation 'com.crashlytics.sdk.android:crashlytics:2.9.1'

    //ButterKnife
    implementation "com.jakewharton:butterknife:$butterKnifeVersion"
    implementation 'com.android.support:appcompat-v7:27.1.1'
    annotationProcessor "com.jakewharton:butterknife-compiler:$butterKnifeVersion"

    //Firbase auth for login
    implementation 'com.firebaseui:firebase-ui-auth:4.1.0'
    implementation "com.google.firebase:firebase-core:$playServicesVersion"

    //Firebase Realtime database for getting Customer trips data : models.Trip
    implementation "com.google.firebase:firebase-database:$playServicesVersion"

    //Fetch image
    implementation "com.github.bumptech.glide:glide:4.6.1"
    annotationProcessor 'com.github.bumptech.glide:compiler:4.6.1'

    //Google Direction Api: Displaying route from source-destimation
    compile 'com.google.maps:google-maps-services:0.2.9'
    compile 'org.slf4j:slf4j-nop:1.7.25'

    //HyperTrack: HyperTrack library
    implementation('com.hypertrack:android:0.7.39@aar') {
        transitive = true;
    }
}

//HyperTrack: FCM
apply plugin: 'com.google.gms.google-services'

1 个答案:

答案 0 :(得分:2)

要解决此问题,请更改以下代码行:

implementation "com.google.firebase:firebase-database:$playServicesVersion"
compile 'com.google.maps:google-maps-services:0.2.9'

implementation "com.google.firebase:firebase-database:16.0.1"
implementation "com.google.android.gms:play-services-maps:15.0.1"

也不要忘记添加:

implementation "com.google.firebase:firebase-core:16.0.1"

这是强制性的。从Firebase SDK的June 12th release开始,您必须明确包含firebase-core

  

您的应用gradle文件现在必须明确列出com.google.firebase:firebase-core作为Firebase服务按预期工作的依赖项。