App not running after adding firebase - android

I've added firebase-core to my project for analytics but since then my app is not responding.
This is the class path for gms that I'm using :
classpath 'com.google.gms:google-services:3.1.0'
This is the dependency that I'm using for firebase :
compile 'com.google.firebase:firebase-core:11.0.1'
Also I've added apply plugin: 'com.google.gms.google-services' to bottom of my build gradle file.
And in my application class I'm just initializing the FirebaseAnalytics :
firebaseAnalytics = FirebaseAnalytics.getInstance(getApplicationContext());
And this is the error I got from the logcat :
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.PHELAT.Vollip, PID: 15670
java.lang.NoClassDefFoundError: com.google.android.gms.common.api.Status
at com.google.android.gms.internal.zzbdl.<init>(Unknown Source)
at com.google.android.gms.internal.zzbdl.zzaz(Unknown Source)
at com.google.android.gms.internal.zzcff.zzjD(Unknown Source)
at com.google.android.gms.internal.zzchi.initialize(Unknown Source)
at com.google.android.gms.internal.zzcgk.<init>(Unknown Source)
at com.google.android.gms.internal.zzcgk.zzbj(Unknown Source)
at com.google.firebase.analytics.FirebaseAnalytics.getInstance(Unknown Source)
at com.PHELAT.Vollip.Vollip.onCreate(Vollip.java:84)
at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1025)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5548)
at android.app.ActivityThread.-wrap2(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1576)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:241)
at android.app.ActivityThread.main(ActivityThread.java:6274)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)
Caused by: java.lang.InstantiationError: com.google.android.gms.common.api.zzf
at com.google.android.gms.common.api.Status.<clinit>(Unknown Source)
at com.google.android.gms.internal.zzbdl.<init>(Unknown Source)
at com.google.android.gms.internal.zzbdl.zzaz(Unknown Source)
at com.google.android.gms.internal.zzcff.zzjD(Unknown Source)
at com.google.android.gms.internal.zzchi.initialize(Unknown Source)
at com.google.android.gms.internal.zzcgk.<init>(Unknown Source)
at com.google.android.gms.internal.zzcgk.zzbj(Unknown Source)
at com.google.android.gms.measurement.AppMeasurement.getInstance(Unknown Source)
at java.lang.reflect.Method.invoke(Native Method)
at com.google.firebase.FirebaseApp.zza(Unknown Source)
at com.google.firebase.FirebaseApp.initializeApp(Unknown Source)
at com.google.firebase.FirebaseApp.initializeApp(Unknown Source)
at com.google.firebase.FirebaseApp.initializeApp(Unknown Source)
at com.google.firebase.provider.FirebaseInitProvider.onCreate(Unknown Source)
at android.content.ContentProvider.attachInfo(ContentProvider.java:1751)
at android.content.ContentProvider.attachInfo(ContentProvider.java:1726)
at com.google.firebase.provider.FirebaseInitProvider.attachInfo(Unknown Source)
at android.app.ActivityThread.installProvider(ActivityThread.java:6008)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:5590)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5529)
at android.app.ActivityThread.-wrap2(ActivityThread.java) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1576) 
at android.os.Handler.dispatchMessage(Handler.java:102) 
at android.os.Looper.loop(Looper.java:241) 
at android.app.ActivityThread.main(ActivityThread.java:6274) 
The error is pointing to line 84 of my application class which is the FirebaseAnalytics init.
Also, I did some research on this problem and I've found out that I need to enable multidex in my project, I've enabled multidexing but nothing changed.
Something that I've noticed is after adding firebase to my project, the apk size is reduced by 1mb and now I have two .dex classes in my apk, I think firebase is multidexing my app automatically but its not configured.
EDIT :
I'm switching back to fabric, I've just noticed that firebase is not working in Iran because of sanctions.

use this version and try.
(Note: use same version for all gms and firebase library)
compile 'com.google.android.gms:play-services-maps:9.6.1'
compile 'com.google.android.gms:play-services-places:9.6.1'
compile 'com.google.firebase:firebase-core:9.6.1'
compile 'com.google.firebase:firebase-auth:9.6.1'

Related

Error:Execution failed for task ':app:packageDebug'. > !zip.isFile()

#UPDATE
Thank you very much. Now at least there are no errors. But it's still a far cry from how it worked before - how it should work. Now, the database looks ... strange. I think that something is still wrong with this gradle.
It should not look like. According to the java code in the database will be user and its data (name, email, date of account creation, id avatar)
In the application at the site next to the avatar you should display the name. Unfortunately, as you can see nothing happens. There is nothing wrong with the code because it previously worked. :(
I ruined my project! I tried to fix it but now it's worse than it was.
The project is chat client through Firebase.
It started when I deleted my base. I had too many test users, messages I wanted to clear it. Since then, it gets a million error notifications - trying to fix one thing leads to even worse errors.
I tried to connect to the application completely different base, I tried to re-arrange a few things. Nothing helps.
At first I thought that the problem is with wrong compile 'com.google.firebase:firebase-database:9.8.0' number. Then I received
E/FirebaseApp: Firebase API initialization failure.
I try to fix it. Application was started and in the database was very strange things.
Now i get
Error:Execution failed for task ':app:packageDebug'.> !zip.isFile()
build.gradle (project)
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.3'
classpath 'com.google.gms:google-services:3.0.0'
}
}
build.gradle (module:app)
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
defaultConfig {
applicationId "com.example.rachel.komunikator"
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'
})
compile 'com.android.support:appcompat-v7:25.1.0'
compile 'com.google.firebase:firebase-database:9.8.0'
compile 'com.google.firebase:firebase-auth:9.8.0'
compile 'com.android.support:recyclerview-v7:25.1.0'
testCompile 'junit:junit:4.12'
}
Google Play Services
on my emulator
Im using: Android Studio 2.2.3 and Nexus 5X Emulator
#UPDATE
W/DynamiteModule: Local module descriptor class for com.google.firebase.auth not found. E/FirebaseApp: Firebase API
initialization failure. D/FirebaseApp:
com.google.firebase.crash.FirebaseCrash is not linked. Skipping initialization.
all logs:
W/System: ClassLoader referenced unknown path: /data/app/com.example.rachel.komunikator-2/lib/x86
[ 02-02 20:56:04.988 1566: 1589 D/ ]
HostConnection::get() New Host Connection established 0x8cf20100, tid 1589
I/InstantRun: Instant Run Runtime started. Android package is com.example.rachel.komunikator, real application class is null.
W/System: ClassLoader referenced unknown path: /data/app/com.example.rachel.komunikator-2/lib/x86
W/DynamiteModule: Local module descriptor class for com.google.firebase.auth not found.
W/DynamiteModule: Local module descriptor class for com.google.firebase.auth not found.
W/System: ClassLoader referenced unknown path: /system/priv-app/PrebuiltGmsCore/lib/x86
E/FirebaseApp: Firebase API initialization failure.
java.lang.reflect.InvocationTargetException
at java.lang.reflect.Method.invoke(Native Method)
at com.google.firebase.FirebaseApp.zza(Unknown Source)
at com.google.firebase.FirebaseApp.initializeApp(Unknown Source)
at com.google.firebase.FirebaseApp.initializeApp(Unknown Source)
at com.google.firebase.FirebaseApp.initializeApp(Unknown Source)
at com.google.firebase.provider.FirebaseInitProvider.onCreate(Unknown Source)
at android.content.ContentProvider.attachInfo(ContentProvider.java:1751)
at android.content.ContentProvider.attachInfo(ContentProvider.java:1726)
at com.google.firebase.provider.FirebaseInitProvider.attachInfo(Unknown Source)
at android.app.ActivityThread.installProvider(ActivityThread.java:5853)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:5445)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5384)
at android.app.ActivityThread.-wrap2(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1545)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6119)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)
Caused by: java.lang.IllegalAccessError: Method 'void android.support.v4.content.ContextCompat.<init>()' is inaccessible to class 'com.google.firebase.iid.zzg' (declaration of 'com.google.firebase.iid.zzg' appears in /data/data/com.example.rachel.komunikator/files/instant-run/dex/slice-com.google.firebase-firebase-iid-9.0.0_8eee9db5e99a0da2dcdc7b52647c81db3aed29e6-classes.dex)
at com.google.firebase.iid.zzg.zzeC(Unknown Source)
at com.google.firebase.iid.zzg.<init>(Unknown Source)
at com.google.firebase.iid.zzg.<init>(Unknown Source)
at com.google.firebase.iid.zzd.zzb(Unknown Source)
at com.google.firebase.iid.FirebaseInstanceId.getInstance(Unknown Source)
at java.lang.reflect.Method.invoke(Native Method) 
at com.google.firebase.FirebaseApp.zza(Unknown Source) 
at com.google.firebase.FirebaseApp.initializeApp(Unknown Source) 
at com.google.firebase.FirebaseApp.initializeApp(Unknown Source) 
at com.google.firebase.FirebaseApp.initializeApp(Unknown Source) 
at com.google.firebase.provider.FirebaseInitProvider.onCreate(Unknown Source) 
at android.content.ContentProvider.attachInfo(ContentProvider.java:1751) 
at android.content.ContentProvider.attachInfo(ContentProvider.java:1726) 
at com.google.firebase.provider.FirebaseInitProvider.attachInfo(Unknown Source) 
at android.app.ActivityThread.installProvider(ActivityThread.java:5853) 
at android.app.ActivityThread.installContentProviders(ActivityThread.java:5445) 
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5384) 
at android.app.ActivityThread.-wrap2(ActivityThread.java) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1545) 
at android.os.Handler.dispatchMessage(Handler.java:102) 
at android.os.Looper.loop(Looper.java:154) 
at android.app.ActivityThread.main(ActivityThread.java:6119) 
at java.lang.reflect.Method.invoke(Native Method) 
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776) 
D/FirebaseApp: com.google.firebase.crash.FirebaseCrash is not linked. Skipping initialization.
E/FirebaseApp: Firebase API initialization failure.
java.lang.reflect.InvocationTargetException
at java.lang.reflect.Method.invoke(Native Method)
at com.google.firebase.FirebaseApp.zza(Unknown Source)
at com.google.firebase.FirebaseApp.initializeApp(Unknown Source)
at com.google.firebase.FirebaseApp.initializeApp(Unknown Source)
at com.google.firebase.FirebaseApp.initializeApp(Unknown Source)
at com.google.firebase.provider.FirebaseInitProvider.onCreate(Unknown Source)
at android.content.ContentProvider.attachInfo(ContentProvider.java:1751)
at android.content.ContentProvider.attachInfo(ContentProvider.java:1726)
at com.google.firebase.provider.FirebaseInitProvider.attachInfo(Unknown Source)
at android.app.ActivityThread.installProvider(ActivityThread.java:5853)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:5445)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5384)
at android.app.ActivityThread.-wrap2(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1545)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6119)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)
Caused by: java.lang.NoSuchMethodError: No static method zzz(Ljava/lang/Object;)Ljava/lang/Object; in class Lcom/google/android/gms/common/internal/zzaa; or its super classes (declaration of 'com.google.android.gms.common.internal.zzaa' appears in /data/data/com.example.rachel.komunikator/files/instant-run/dex/slice-com.google.android.gms-play-services-basement-9.8.0_b60271da061b8a83af31355011409573bfa72cef-classes.dex)
at com.google.android.gms.measurement.internal.zzx.zzbd(Unknown Source)
at com.google.android.gms.measurement.AppMeasurement.getInstance(Unknown Source)
at java.lang.reflect.Method.invoke(Native Method) 
at com.google.firebase.FirebaseApp.zza(Unknown Source) 
at com.google.firebase.FirebaseApp.initializeApp(Unknown Source) 
at com.google.firebase.FirebaseApp.initializeApp(Unknown Source) 
at com.google.firebase.FirebaseApp.initializeApp(Unknown Source) 
at com.google.firebase.provider.FirebaseInitProvider.onCreate(Unknown Source) 
at android.content.ContentProvider.attachInfo(ContentProvider.java:1751) 
at android.content.ContentProvider.attachInfo(ContentProvider.java:1726) 
at com.google.firebase.provider.FirebaseInitProvider.attachInfo(Unknown Source) 
at android.app.ActivityThread.installProvider(ActivityThread.java:5853) 
at android.app.ActivityThread.installContentProviders(ActivityThread.java:5445) 
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5384) 
at android.app.ActivityThread.-wrap2(ActivityThread.java) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1545) 
at android.os.Handler.dispatchMessage(Handler.java:102) 
at android.os.Looper.loop(Looper.java:154) 
at android.app.ActivityThread.main(ActivityThread.java:6119) 
at java.lang.reflect.Method.invoke(Native Method) 
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776) 
Clean and Rebuild project should work. It work for me. Look at this: https://code.google.com/p/android/issues/detail?id=230211
Regarding this:
Error:Execution failed for task ':app:packageDebug'.> !zip.isFile()
I solved it by deleting the build project and running again.
Hope this helps.
Its very simple just run ./gradlew clean
If you are using Cordova or Ionic Framework run following commands
cd platforms/android
./gradlew clean
Its easy fix.
I met this problems just A few minutes ago, I tried some ways in this question, but it's not work. So I asked other programmers for help, then it worked!
It's very easy! just do it as the figure shows below.
I hope that would help you.
Just disable Instant Run:
Android Studio -> Preferences -> Instant Run
Move this line to the BOTTOM of your module:app build.gradle:
apply plugin: 'com.google.gms.google-services'
Example in the Setup Guide.
According to this, try to use the new version of gradle : 2.3.0
This issue has been fixed in
ag/I6a6ef1a95732118b8e330b64fe4389710a3a2657. Please use newer gradle
plugin 2.3.0-beta2 or, if using 2.2.x, disable new packaging by using
the "android.useOldPackaging=true" flag.
You are missing the core firebase lib.
Add compile 'com.google.firebase:firebase-core:9.8.0'
I solve this question.i just change my gradle version from 2.2.3 to 2.2.2
classpath 'com.android.tools.build:gradle:2.2.2'
In my case, I clicked the rebuild icon (its guide: "sync project with gradle file") and it solved the problem
I use Cordova CLI and have run into this issue from time-to-time. Given that I build locally on my Windows 10 computer user permissions is not the issue. I found that from time to time Cordova simply deletes the android/builds folder and then is for some reason unable to create it. I simply recreate that folder manually and all is hunkry-dory.
Sometimes if you open another project simultaneously, it might give this issue. To overcome this issue you can:
flutter clean
After clean get your project packages through
flutter pub get
For Android Studio Users:
You can easily navigate to file and clear invalid caches.
Right click on root of the project ex:app select>>Show in Explorer and delete .gradle file and click on the clean OR Built option it will work 100%.

FirebaseStorage.getInstance().getReference() crashes app

FirebaseStorage.getInstance().getReference() crashes the app. I have checked another similar post but that did not help as my google-services.json file is correctly downloaded from FireBase API and the FireBase assistant shows connection and status as 'OK'.
here's the log:
A/FirebaseApp: Firebase API initialization failure.
java.lang.reflect.InvocationTargetException
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.google.firebase.FirebaseApp.zza(Unknown Source)
at com.google.firebase.FirebaseApp.initializeApp(Unknown Source)
at com.google.firebase.FirebaseApp.initializeApp(Unknown Source)
at com.google.firebase.FirebaseApp.initializeApp(Unknown Source)
at com.google.firebase.provider.FirebaseInitProvider.onCreate(Unknown Source)
at android.content.ContentProvider.attachInfo(ContentProvider.java:1737)
at android.content.ContentProvider.attachInfo(ContentProvider.java:1712)
at com.google.firebase.provider.FirebaseInitProvider.attachInfo(Unknown Source)
at android.app.ActivityThread.installProvider(ActivityThread.java:6487)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:6082)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6022)
at android.app.ActivityThread.access$1700(ActivityThread.java:211)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1766)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:145)
at android.app.ActivityThread.main(ActivityThread.java:6946)
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:1404)
at com.android.internal .os.ZygoteInit.main(ZygoteInit.java:1199)
Caused by: java.lang.NoSuchMethodError: No static method getNoBackupFilesDir(Landroid/content/Context;)Ljava/io/File; in class Lcom/google/android/gms/common/util/zzx; or its super classes (declaration of 'com.google.android.gms.common.util.zzx' appears in /data /data /com.example.bhrigu.simpleblog/files/instant-run/dex/slice-com.google.android.gms-play-services-basement-10.0.0_c06534ef2c8c0d287af412696f22ee66b12bcbfa-classes.dex)
at com.google.firebase.iid.zzg.zzkg(Unknown Source)
There was indeed a conflict with the google-play version. Initially, I had used version 9.2.0 for Firebase libraries as I was getting errors with 10.0.0. However fixing the google-play version seems to have taken care of those ones as well. And I am able to run with all the updated libraries.

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

I'm receiving following crash log when I run my app with firebase and 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: The method 'java.io.File android.support.v4.content.ContextCompat.getNoBackupFilesDir(android.content.Context)' was expected to be of type virtual but instead was found to be of type direct (declaration of 'com.google.firebase.iid.zzg' appears in /data/app/com.winjit.musiclib.sample-1/base.apk)
at com.google.firebase.iid.zzg.zzeC(Unknown Source)
at com.google.firebase.iid.zzg.<init>(Unknown Source)
at com.google.firebase.iid.zzg.<init>(Unknown Source)
at com.google.firebase.iid.zzd.zzb(Unknown Source)
at com.google.firebase.iid.FirebaseInstanceIdService.zziB(Unknown Source)
at com.google.firebase.iid.FirebaseInstanceIdService.zzA(Unknown Source)
at com.google.firebase.iid.zzb.onStartCommand(Unknown Source)
at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:3010)
at android.app.ActivityThread.-wrap17(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1442)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5417)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at 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
at java.lang.reflect.Method.invoke(Native Method)
at com.google.firebase.FirebaseApp.zza(Unknown Source)
at com.google.firebase.FirebaseApp.initializeApp(Unknown Source)
at com.google.firebase.FirebaseApp.initializeApp(Unknown Source)
at com.google.firebase.FirebaseApp.zzbu(Unknown Source)
at com.google.firebase.provider.FirebaseInitProvider.onCreate(Unknown Source)
at android.content.ContentProvider.attachInfo(ContentProvider.java:1801)
at android.content.ContentProvider.attachInfo(ContentProvider.java:1776)
at com.google.firebase.provider.FirebaseInitProvider.attachInfo(Unknown Source)
at android.app.ActivityThread.installProvider(ActivityThread.java:5464)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:5037)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4977)
at android.app.ActivityThread.-wrap1(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1562)
at android.os.Handler.dispatchMessage(Handler.java:111)
at android.os.Looper.loop(Looper.java:207)
at android.app.ActivityThread.main(ActivityThread.java:5769)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:791)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:681)
Caused by: java.lang.IncompatibleClassChangeError: The method 'java.io.File android.support.v4.content.ContextCompat.getNoBackupFilesDir(android.content.Context)' was expected to be of type virtual but instead was found to be of type direct (declaration of 'com.google.firebase.iid.zzg' appears in /data/app/com.winjit.musiclib.sample-1/base.apk)
at com.google.firebase.iid.zzg.zzeC(Unknown Source)
at com.google.firebase.iid.zzg.<init>(Unknown Source)
at com.google.firebase.iid.zzg.<init>(Unknown Source)
at com.google.firebase.iid.zzd.zzb(Unknown Source)
at com.google.firebase.iid.FirebaseInstanceId.getInstance(Unknown Source)
at java.lang.reflect.Method.invoke(Native Method) 
at com.google.firebase.FirebaseApp.zza(Unknown Source) 
at com.google.firebase.FirebaseApp.initializeApp(Unknown Source) 
at com.google.firebase.FirebaseApp.initializeApp(Unknown Source) 
at com.google.firebase.FirebaseApp.zzbu(Unknown Source) 
at com.google.firebase.provider.FirebaseInitProvider.onCreate(Unknown Source) 
at android.content.ContentProvider.attachInfo(ContentProvider.java:1801) 
at android.content.ContentProvider.attachInfo(ContentProvider.java:1776) 
at com.google.firebase.provider.FirebaseInitProvider.attachInfo(Unknown Source) 
at android.app.ActivityThread.installProvider(ActivityThread.java:5464) 
at android.app.ActivityThread.installContentProviders(ActivityThread.java:5037) 
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4977) 
at android.app.ActivityThread.-wrap1(ActivityThread.java) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1562) 
at android.os.Handler.dispatchMessage(Handler.java:111) 
at android.os.Looper.loop(Looper.java:207) 
at android.app.ActivityThread.main(ActivityThread.java:5769) 
at java.lang.reflect.Method.invoke(Native Method) 
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:791) 
at 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: The method 'java.io.File android.support.v4.content.ContextCompat.getNoBackupFilesDir(android.content.Context)' was expected to be of type virtual but instead was found to be 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 is my 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 to the bottom of the file
apply plugin: 'com.google.gms.google-services'
Can someone help me to resolve this issue?
Try to compile
compile 'com.google.firebase:firebase-messaging:9.0.0'
instead of
compile 'com.google.firebase:firebase-core:9.0.0'
Also update to the latest google-play-services and google repository through the SDK Manager:
Try to use this solution. I had solved problem using above solution. I hope it will work for you.

Google Play Services 9.2.1 and google-services plugin

My app needs to integrate google play services and firebase;so,I have downloaded the offical demo ,complie google play services and firebase sdk, google play services and firebase sdk have been updated to v9.2.1,the demo works well on android 5.0+,but crash on android 4.4.4.
Click here to download the demo!
Here is my build.gradle:
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:23.2.1'
compile 'com.android.support:support-v4:23.2.1'
compile 'com.google.firebase:firebase-core:9.2.1'
compile 'com.google.android.gms:play-services:9.2.1'
}
apply plugin: 'com.google.gms.google-services'
And here is the crash log:
07-19 14:34:29.790
25938-25938/com.google.firebase.quickstart.analytics
E/FirebaseCrash: Failed to initialize crash reporting
com.google.firebase.crash.internal.zzg$zza:
com.google.android.gms.internal.zzsj$zza: No acceptable module found.
Local version is 0 and remote version is 0.
at com.google.firebase.crash.internal.zzg.zzbq(Unknown Source)
at com.google.firebase.crash.FirebaseCrash.(Unknown Source)
at com.google.firebase.crash.FirebaseCrash.getInstance(Unknown Source)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.google.firebase.FirebaseApp.zza(Unknown Source)
at com.google.firebase.FirebaseApp.initializeApp(Unknown Source)
at com.google.firebase.FirebaseApp.initializeApp(Unknown Source)
at com.google.firebase.FirebaseApp.zzeh(Unknown Source)
at com.google.firebase.provider.FirebaseInitProvider.onCreate(Unknown
Source)
at
android.content.ContentProvider.attachInfo(ContentProvider.java:1591)
at
android.content.ContentProvider.attachInfo(ContentProvider.java:1562)
at
com.google.firebase.provider.FirebaseInitProvider.attachInfo(Unknown
Source)
at
android.app.ActivityThread.installProvider(ActivityThread.java:5038)
at
android.app.ActivityThread.installContentProviders(ActivityThread.java:4632)
at
android.app.ActivityThread.handleBindApplication(ActivityThread.java:4566)
at android.app.ActivityThread.access$1500(ActivityThread.java:145)
at
android.app.ActivityThread$H.handleMessage(ActivityThread.java:1276)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:145)
at android.app.ActivityThread.main(ActivityThread.java:5266)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:826)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:642)
at dalvik.system.NativeStart.main(Native Method)
Caused by: com.google.android.gms.internal.zzsj$zza: No acceptable
module found. Local version is 0 and remote version is 0.
at com.google.android.gms.internal.zzsj.zza(Unknown Source)
at com.google.firebase.crash.internal.zzg.zzbq(Unknown Source) 
at com.google.firebase.crash.FirebaseCrash.(Unknown Source) 
at com.google.firebase.crash.FirebaseCrash.getInstance(Unknown
Source) 
at java.lang.reflect.Method.invokeNative(Native Method) 
at java.lang.reflect.Method.invoke(Method.java:515) 
at com.google.firebase.FirebaseApp.zza(Unknown Source) 
at com.google.firebase.FirebaseApp.initializeApp(Unknown Source) 
at com.google.firebase.FirebaseApp.initializeApp(Unknown Source) 
at com.google.firebase.FirebaseApp.zzeh(Unknown Source) 
at com.google.firebase.provider.FirebaseInitProvider.onCreate(Unknown
Source) 
at
android.content.ContentProvider.attachInfo(ContentProvider.java:1591) 
at
android.content.ContentProvider.attachInfo(ContentProvider.java:1562) 
at
com.google.firebase.provider.FirebaseInitProvider.attachInfo(Unknown
Source) 
at
android.app.ActivityThread.installProvider(ActivityThread.java:5038) 
at
android.app.ActivityThread.installContentProviders(ActivityThread.java:4632) 
at
android.app.ActivityThread.handleBindApplication(ActivityThread.java:4566) 
at android.app.ActivityThread.access$1500(ActivityThread.java:145) 
at
android.app.ActivityThread$H.handleMessage(ActivityThread.java:1276) 
at android.os.Handler.dispatchMessage(Handler.java:102) 
at android.os.Looper.loop(Looper.java:145) 
at android.app.ActivityThread.main(ActivityThread.java:5266) 
at java.lang.reflect.Method.invokeNative(Native Method) 
at java.lang.reflect.Method.invoke(Method.java:515) 
at
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:826) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:642) 
at dalvik.system.NativeStart.main(Native Method)
Anyone can help me?
As a first step, you should identify the specific Play Service APIs your app needs and include only those instead of com.google.android.gms:play-services. Listing play-services as a dependency pulls in all of Play Services and causes the 64K limit on method references to be exceeded. This creates problems when running on pre-Lollipop devices.
The complete list of Play Services APIs is provided here and the Firebase APIs are listed here. Find the ones you need and list them in your dependencies instead of com.google.android.gms:play-services.
To get an understanding of all the libraries that are pulled in when you specify play-services as a dependency, you can look at this gist or open the Android Studio tool window for Gradle and run the androidDependencies task under :app\Tasks\android.
Firebase is now included in the google-play-services - see https://developers.google.com/android/guides/releases#june_2016_-_v92 . But somehow the play-services on API 19(aka Android 4.4) do not contain usable firebase-files. So what you have do do is, compile only the used APIs from the play-services and exclude the Firebase from them.
So remove line compile 'com.google.android.gms:play-services:9.2.1'
and replace with something like compile 'com.google.android.gms:play-services-NAME_OF_USED_API:9.2.1'
Alternative you could use an older Version of the google-play-services that doesn't contain Firebase.

New GCM Implemented, But Not starting App

Trying to implement GCM in my app. Compiled successfully. But when i run my app, Its crashing. Stack trace :
E/FirebaseApp: Firebase API initialization failure.
java.lang.reflect.InvocationTargetException
at java.lang.reflect.Method.invoke(Native Method)
at com.google.firebase.FirebaseApp.zza(Unknown Source)
at com.google.firebase.FirebaseApp.initializeApp(Unknown Source)
at com.google.firebase.FirebaseApp.initializeApp(Unknown Source)
at com.google.firebase.FirebaseApp.zzbu(Unknown Source)
at com.google.firebase.provider.FirebaseInitProvider.onCreate(Unknown Source)
at android.content.ContentProvider.attachInfo(ContentProvider.java:1748)
at android.content.ContentProvider.attachInfo(ContentProvider.java:1723)
at com.google.firebase.provider.FirebaseInitProvider.attachInfo(Unknown Source)
at android.app.ActivityThread.installProvider(ActivityThread.java:5174)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:4769)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4709)
at android.app.ActivityThread.-wrap1(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1415)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5443)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:728)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
Caused by: java.lang.IncompatibleClassChangeError: The method 'java.io.File android.support.v4.content.ContextCompat.getNoBackupFilesDir(android.content.Context)' was expected to be of type virtual but instead was found to be of type direct (declaration of 'com.google.firebase.iid.zzg' appears in /data/app/sun.way2online.dropxapp-2/base.apk)
at com.google.firebase.iid.zzg.zzeC(Unknown Source)
at com.google.firebase.iid.zzg.(Unknown Source)
at com.google.firebase.iid.zzg.(Unknown Source)
at com.google.firebase.iid.zzd.zzb(Unknown Source)
at com.google.firebase.iid.FirebaseInstanceId.getInstance(Unknown Source)
at java.lang.reflect.Method.invoke(Native Method) 
at com.google.firebase.FirebaseApp.zza(Unknown Source) 
at com.google.firebase.FirebaseApp.initializeApp(Unknown Source) 
at com.google.firebase.FirebaseApp.initializeApp(Unknown Source) 
at com.google.firebase.FirebaseApp.zzbu(Unknown Source) 
at com.google.firebase.provider.FirebaseInitProvider.onCreate(Unknown Source) 
at android.content.ContentProvider.attachInfo(ContentProvider.java:1748) 
at android.content.ContentProvider.attachInfo(ContentProvider.java:1723) 
at com.google.firebase.provider.FirebaseInitProvider.attachInfo(Unknown Source) 
at android.app.ActivityThread.installProvider(ActivityThread.java:5174) 
at android.app.ActivityThread.installContentProviders(ActivityThread.java:4769) 
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4709) 
at android.app.ActivityThread.-wrap1(ActivityThread.java) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1415) 
at android.os.Handler.dispatchMessage(Handler.java:102) 
at android.os.Looper.loop(Looper.java:148) 
at android.app.ActivityThread.main(ActivityThread.java:5443) 
at java.lang.reflect.Method.invoke(Native Method) 
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:728) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618) 
07-05 12:01:28.476 15753-15753/sun.way2online.dropxapp D/FirebaseApp: com.google.firebase.crash.FirebaseCrash is not linked. Skipping initialization.
And
java.lang.IncompatibleClassChangeError: The method 'java.io.File android.support.v4.content.ContextCompat.getNoBackupFilesDir(android.content.Context)' was expected to be of type virtual but instead was found to be of type direct (declaration of 'com.google.android.gms.iid.zzd' appears in /data/app/sun.way2online.dropxapp-2/base.apk)
at com.google.android.gms.iid.zzd.zzeC(Unknown Source)
at com.google.android.gms.iid.zzd.(Unknown Source)
at com.google.android.gms.iid.zzd.(Unknown Source)
at com.google.android.gms.iid.InstanceID.zza(Unknown Source)
at com.google.android.gms.iid.InstanceID.getInstance(Unknown Source)
at myapp.com.Services.RegistrationIntentService.onHandleIntent(RegistrationIntentService.java:29)
at android.app.IntentService$ServiceHandler.handleMessage(IntentService.java:66)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.os.HandlerThread.run(HandlerThread.java:61)
My gradle file :
android {
compileSdkVersion 24
buildToolsVersion "24.0.0"
defaultConfig {
minSdkVersion 19
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.0.0'
compile "com.google.android.gms:play-services-gcm:9.0.0"
}
apply plugin: 'com.google.gms.google-services'
The problem might comes from one of the libraries your app depends on, library that depends itself on Google Play Services as well. You might using an older version of the Google Play Services SDK and its still relies on the fact that Google API Client class is an interface. This breaks backward compatibility because of the transitive dependencies of libraries. Please check if you use the latest version or remove the dependecy if possible.
For more information regarding Google Play Services, check this link: https://www.reddit.com/r/androiddev/comments/3mehbb/breaking_changes_in_google_play_services_81/

Categories

Resources