android - java.lang.IncompatibleClassChangeError causes app to crash, using Firebase and Google Play Services -


i'm receiving following crash log when run app firebase , google play services

exception in emulator:

11-10 17:14:39.716 2645-2645/com.winjit.musiclib.sample e/androidruntime: fatal exception: main   process: com.winjit.musiclib.sample, pid: 2645   java.lang.incompatibleclasschangeerror: method 'java.io.file android.support.v4.content.contextcompat.getnobackupfilesdir(android.content.context)' expected of type virtual instead found of type direct (declaration of 'com.google.firebase.iid.zzg' appears in /data/app/com.winjit.musiclib.sample-1/base.apk)       @ com.google.firebase.iid.zzg.zzec(unknown source)       @ com.google.firebase.iid.zzg.<init>(unknown source)       @ com.google.firebase.iid.zzg.<init>(unknown source)       @ com.google.firebase.iid.zzd.zzb(unknown source)       @ com.google.firebase.iid.firebaseinstanceidservice.zzib(unknown source)       @ com.google.firebase.iid.firebaseinstanceidservice.zza(unknown source)       @ com.google.firebase.iid.zzb.onstartcommand(unknown source)       @ android.app.activitythread.handleserviceargs(activitythread.java:3010)       @ android.app.activitythread.-wrap17(activitythread.java)       @ android.app.activitythread$h.handlemessage(activitythread.java:1442)       @ android.os.handler.dispatchmessage(handler.java:102)       @ android.os.looper.loop(looper.java:148)       @ android.app.activitythread.main(activitythread.java:5417)       @ java.lang.reflect.method.invoke(native method)       @ com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:726)       @ com.android.internal.os.zygoteinit.main(zygoteinit.java:616) 

exception in device:

11-10 17:30:50.724 9161-9161/com.winjit.musiclib.sample e/firebaseapp: firebase api initialization failure.    java.lang.reflect.invocationtargetexception        @ java.lang.reflect.method.invoke(native method)        @ com.google.firebase.firebaseapp.zza(unknown source)        @ com.google.firebase.firebaseapp.initializeapp(unknown source)        @ com.google.firebase.firebaseapp.initializeapp(unknown source)        @ com.google.firebase.firebaseapp.zzbu(unknown source)        @ com.google.firebase.provider.firebaseinitprovider.oncreate(unknown source)        @ android.content.contentprovider.attachinfo(contentprovider.java:1801)        @ android.content.contentprovider.attachinfo(contentprovider.java:1776)        @ com.google.firebase.provider.firebaseinitprovider.attachinfo(unknown source)        @ android.app.activitythread.installprovider(activitythread.java:5464)        @ android.app.activitythread.installcontentproviders(activitythread.java:5037)        @ android.app.activitythread.handlebindapplication(activitythread.java:4977)        @ android.app.activitythread.-wrap1(activitythread.java)        @ android.app.activitythread$h.handlemessage(activitythread.java:1562)        @ android.os.handler.dispatchmessage(handler.java:111)        @ android.os.looper.loop(looper.java:207)        @ android.app.activitythread.main(activitythread.java:5769)        @ java.lang.reflect.method.invoke(native method)        @ com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:791)        @ com.android.internal.os.zygoteinit.main(zygoteinit.java:681)     caused by: java.lang.incompatibleclasschangeerror: method 'java.io.file android.support.v4.content.contextcompat.getnobackupfilesdir(android.content.context)' expected of type virtual instead found of type direct (declaration of 'com.google.firebase.iid.zzg' appears in /data/app/com.winjit.musiclib.sample-1/base.apk)        @ com.google.firebase.iid.zzg.zzec(unknown source)        @ com.google.firebase.iid.zzg.<init>(unknown source)        @ com.google.firebase.iid.zzg.<init>(unknown source)        @ com.google.firebase.iid.zzd.zzb(unknown source)        @ com.google.firebase.iid.firebaseinstanceid.getinstance(unknown source)        @ java.lang.reflect.method.invoke(native method)         @ com.google.firebase.firebaseapp.zza(unknown source)         @ com.google.firebase.firebaseapp.initializeapp(unknown source)         @ com.google.firebase.firebaseapp.initializeapp(unknown source)         @ com.google.firebase.firebaseapp.zzbu(unknown source)         @ com.google.firebase.provider.firebaseinitprovider.oncreate(unknown source)         @ android.content.contentprovider.attachinfo(contentprovider.java:1801)         @ android.content.contentprovider.attachinfo(contentprovider.java:1776)         @ com.google.firebase.provider.firebaseinitprovider.attachinfo(unknown source)         @ android.app.activitythread.installprovider(activitythread.java:5464)         @ android.app.activitythread.installcontentproviders(activitythread.java:5037)         @ android.app.activitythread.handlebindapplication(activitythread.java:4977)         @ android.app.activitythread.-wrap1(activitythread.java)         @ android.app.activitythread$h.handlemessage(activitythread.java:1562)         @ android.os.handler.dispatchmessage(handler.java:111)         @ android.os.looper.loop(looper.java:207)         @ android.app.activitythread.main(activitythread.java:5769)         @ java.lang.reflect.method.invoke(native method)         @ com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:791)         @ com.android.internal.os.zygoteinit.main(zygoteinit.java:681)  11-10 17:30:50.866 9161-9195/com.winjit.musiclib.sample e/fa: task exception on worker thread: java.lang.incompatibleclasschangeerror: method 'java.io.file android.support.v4.content.contextcompat.getnobackupfilesdir(android.content.context)' expected of type virtual instead found of type direct (declaration of 'com.google.firebase.iid.zzg' appears in /data/app/com.winjit.musiclib.sample-1/base.apk): com.google.android.gms.measurement.internal.zzt.zzed(unknown source) 

below gradle dependencies:

compile 'com.android.support:appcompat-v7:24.1.1' compile 'com.google.android.gms:play-services-ads:9.0.0' compile 'com.google.firebase:firebase-core:9.0.0'  // add bottom of file apply plugin: 'com.google.gms.google-services' 

can me resolve issue?

try compile

     compile 'com.google.firebase:firebase-messaging:9.0.0' 

instead of

      compile 'com.google.firebase:firebase-core:9.0.0' 

also update latest google-play-services , google repository through sdk manager:

enter image description here

try use solution. had solved problem using above solution. hope work you.


Comments

Popular posts from this blog

aws api gateway - SerializationException in posting new Records via Dynamodb Proxy Service in API -

asp.net - Problems sending emails from forum -