Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
403 views
in Technique[技术] by (71.8m points)

android - Firebase database dependency crashes app

I'm trying to write to my DB with the following "Set up Firebase Realtime Database for Android" example but the app crashes on startup.

It's seems because the dependency:

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

The crash log:

FATAL EXCEPTION: main
Process: com.example.giat.myapplication, PID: 3874
java.lang.NoSuchMethodError: No static method zzeq(Landroid/content/Context;)Lcom/google/android/gms/internal/zzalp; in class Lcom/google/android/gms/internal/zzalp; or its super classes (declaration of 'com.google.android.gms.internal.zzalp' appears in /data/data/com.example.giat.myapplication/files/instant-run/dex/slice-com.google.firebase-firebase-database-9.2.1_b22e7bdbdba6ace0ee1e94f163c76d1f75b59f7e-classes.dex)
    at com.google.firebase.FirebaseApp.initializeApp(Unknown Source)
    at com.google.firebase.FirebaseApp.initializeApp(Unknown Source)
    at com.google.firebase.FirebaseApp.zzek(Unknown Source)
    at com.google.firebase.provider.FirebaseInitProvider.onCreate(Unknown Source)
    at android.content.ContentProvider.attachInfo(ContentProvider.java:1702)
    at android.content.ContentProvider.attachInfo(ContentProvider.java:1665)
    at com.google.firebase.provider.FirebaseInitProvider.attachInfo(Unknown Source)
    at android.app.ActivityThread.installProvider(ActivityThread.java:5417)
    at android.app.ActivityThread.installContentProviders(ActivityThread.java:4988)
    at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4923)
    at android.app.ActivityThread.access$1500(ActivityThread.java:144)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1424)
    at android.os.Handler.dispatchMessage(Handler.java:102)
    at android.os.Looper.loop(Looper.java:155)
    at android.app.ActivityThread.main(ActivityThread.java:5696)
    at java.lang.reflect.Method.invoke(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:372)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1028)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:823)

MY App build.gradle:

apply plugin: 'com.android.application'

android {
compileSdkVersion 24
buildToolsVersion "24.0.1"

defaultConfig {
    applicationId "com.example.giat.myapplication"
    minSdkVersion 15
    targetSdkVersion 24
    versionCode 1
    versionName "1.0"
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}
}

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:24.1.1'
compile 'com.google.firebase:firebase-core:9.4.0'
compile 'com.google.firebase:firebase-database:9.2.1'

}


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

How to fix this issue ?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...