#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%.
Related
08-17 06:27:52.494 8079-8079/? E/FirebaseApp: Firebase API initialization failure.
java.lang.reflect.InvocationTargetException
at java.lang.reflect.Method.invoke(Native Method)
at com.google.firebase.FirebaseApp.zza(SourceFile:739)
at com.google.firebase.FirebaseApp.zze(SourceFile:705)
at com.google.firebase.FirebaseApp.initializeApp(SourceFile:328)
at com.google.firebase.FirebaseApp.initializeApp(SourceFile:294)
at com.google.firebase.FirebaseApp.initializeApp(SourceFile:281)
at com.google.firebase.provider.FirebaseInitProvider.onCreate(SourceFile:37)
at android.content.ContentProvider.attachInfo(ContentProvider.java:1759)
at android.content.ContentProvider.attachInfo(ContentProvider.java:1734)
at com.google.firebase.provider.FirebaseInitProvider.attachInfo(SourceFile:31)
at android.app.ActivityThread.installProvider(ActivityThread.java:6420)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:6012)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5951)
at android.app.ActivityThread.-wrap3(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1710)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6776)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1518)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1408)
Caused by: java.lang.NoSuchMethodError: No virtual method zzbqp()Ljava/lang/String; in class Lcom/google/firebase/FirebaseApp; or its super classes (declaration of 'com.google.firebase.FirebaseApp' appears in /data/app/com.setting.noshairamjad7.wallpaper-1/base.apk)
at com.google.firebase.auth.FirebaseAuth.zzb(Unknown Source)
at com.google.firebase.auth.FirebaseAuth.getInstance(Unknown Source)
at java.lang.reflect.Method.invoke(Native Method)
at com.google.firebase.FirebaseApp.zza(SourceFile:739)
at com.google.firebase.FirebaseApp.zze(SourceFile:705)
at com.google.firebase.FirebaseApp.initializeApp(SourceFile:328)
at com.google.firebase.FirebaseApp.initializeApp(SourceFile:294)
at com.google.firebase.FirebaseApp.initializeApp(SourceFile:281)
at com.google.firebase.provider.FirebaseInitProvider.onCreate(SourceFile:37)
at android.content.ContentProvider.attachInfo(ContentProvider.java:1759)
at android.content.ContentProvider.attachInfo(ContentProvider.java:1734)
at com.google.firebase.provider.FirebaseInitProvider.attachInfo(SourceFile:31)
at android.app.ActivityThread.installProvider(ActivityThread.java:6420)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:6012)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5951)
at android.app.ActivityThread.-wrap3(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1710)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6776)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1518)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1408)
08-17 06:27:53.881 8079-8079/com.setting.noshairamjad7.wallpaper E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.setting.noshairamjad7.wallpaper, PID: 8079
here is gradle it's my first post so sorry if not properlyposted
Try this:
1.You should never include this dependency! It brings in all of the play-services-{x} libraries into your app at once. Just remove this line
compile 'com.google.android.gms:play-services:9.0.0'
Could you try updating dependencies to a later version? That means change all the 25.3.1 dependencies to 26.0.1 or 27.0.0 and all the 9.0.0 dependencies to 11.4.2 or 11.6.0.
it helps you
A simple solution is that use Fireabase Assistant to initialize the Firebase in your application
First remove all firebase dependency and apply plugin: 'com.google.gms.google-services' from your app gradle ( in Android Studio 2.3.3) follow this step
Tools > Firebase
(On right tab) Assistant > Authentication
Caused by: java.lang.NoSuchMethodError: No virtual method zzbqp()Ljava/lang/String; in class Lcom/google/firebase/FirebaseApp; or its super classes (declaration of 'com.google.firebase.FirebaseApp' appears in /data/app/com.setting.noshairamjad7.wallpaper-1/base.apk)
at com.google.firebase.auth.FirebaseAuth.zzb(Unknown Source)
A missing ProGuard rule ?
https://firebase.google.com/docs/database/android/start/
After implementing Facebook Account Kit and run project it shows Firebase API initialization failure as
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:1758)
at android.content.ContentProvider.attachInfo(ContentProvider.java:1733)
at com.google.firebase.provider.FirebaseInitProvider.attachInfo(Unknown Source)
at android.app.ActivityThread.installProvider(ActivityThread.java:5257)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:4808)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4748)
at android.app.ActivityThread.access$1700(ActivityThread.java:153)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1436)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:5529)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:739)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:629)
And also getting Null Pointer Exception from AccountKitController as
Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'android.content.pm.PackageManager android.content.Context.getPackageManager()' on a null object reference
at com.facebook.accountkit.internal.Initializer.initialize(Initializer.java:101)
at com.facebook.accountkit.internal.AccountKitController.initialize(AccountKitController.java:601)
at com.facebook.accountkit.internal.AccountKitInitProvider.onCreate(AccountKitInitProvider.java:31)
at android.content.ContentProvider.attachInfo(ContentProvider.java:1758)
at android.content.ContentProvider.attachInfo(ContentProvider.java:1733)
at android.app.ActivityThread.installProvider(ActivityThread.java:5257)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:4808)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4748)
at android.app.ActivityThread.access$1700(ActivityThread.java:153)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1436)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:5529)
at java.lang.reflect.Method.invoke(Native Method)
Using Account kit gradle as
compile 'com.facebook.android:account-kit-sdk:4.27.0'
And Firebase Gradle as
compile 'com.google.firebase:firebase-messaging:11.0.4'
Note : Removing Account Kit from project its working fine i.e. there is no Firebase API initialization failure. issue. Therefore it's sure that there is conflict in firebase and Account kit SDK (:
This is caused by Facebook's SDK being packaged with a different version of the GMS library than what is packaged with Firebase's. You can do something like this to get back up and running:
compile ('com.facebook.android:account-kit-sdk:4.27.0') {
exclude group: 'com.google.android.gms', module: 'play-services-auth-api-phone'
exclude group: 'com.google.android.gms', module: 'play-services-auth'
}
compile 'com.google.android.gms:play-services-auth:11.6.0'
compile 'com.google.firebase:firebase-messaging:11.6.0'
What this does is essentially hot-swaps out the older library for the newer one packaged with Firebase. It tells Facebook to compile without the old libs and then we make sure they are added back in with newer version right after.
For NullPointerException exception it seems that, Application is not initialized first, Content Providers are initialized before it.
And in Facebook account kit SDK's code it was trying to get my application context.
Now the problem was, I did implement method getApplicationContext() in application class that is getting application shared variable but that variable was setting globally and Facebook Account Kit sdk code getting Null application context.
Solution : setting shared variable in onCreate method instead of setting globally it resolved the problem of Unable to get provider.
And For Mixing issue, Account Kit SDK use 11.0.1 version for play services gradle and in my project I am having 11.0.4 that is actually not the issue because on compile time gradle takes latest gradle but In my project I am not referring below gradle which Facebook Account Kit SDK is using.
compile 'com.google.android.gms:play-services-auth-api-phone:11.0.1'
Solution : I have added above gradle with version 11.0.4 and the mixing gradle issue has been resolved.
compile 'com.google.android.gms:play-services-auth-api-phone:11.0.4'
And as suggested by #astryk if I exclude play-services-auth-api-phone module then gradle mixing error is not showing but it is not including that module becasue in AccountKitActivity on next button click my application crashes as
Crash Report Thread:main Exception:java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/android/gms/auth/api/phone/SmsRetriever;
at com.facebook.accountkit.internal.PhoneLoginController.createSmsToken(PhoneLoginController.java:250)
at com.facebook.accountkit.internal.PhoneLoginController.logIn(PhoneLoginController.java:188)
at com.facebook.accountkit.internal.LoginManager.logInWithPhoneNumber(LoginManager.java:372)
at com.facebook.accountkit.internal.AccountKitController.logInWithPhoneNumber(AccountKitController.java:631)
at com.facebook.accountkit.ui.PhoneLoginFlowManager.logInWithPhoneNumber(PhoneLoginFlowManager.java:57)
at com.facebook.accountkit.ui.ActivityPhoneHandler.onPhoneLoginComplete(ActivityPhoneHandler.java:189)
at com.facebook.accountkit.ui.AccountKitActivity$1.onReceive(AccountKitActivity.java:176)
at android.support.v4.content.LocalBroadcastManager.executePendingBroadcasts(LocalBroadcastManager.java:297)
at android.support.v4.content.LocalBroadcastManager.access$000(LocalBroadcastManager.java:46)
at android.support.v4.content.LocalBroadcastManager$1.handleMessage(LocalBroadcastManager.java:116)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:5529)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:739)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:629)
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.android.gms.auth.api.phone.SmsRetriever" on path: DexPathList[[zip file "/data/app/com.myapp-1/base.apk"],nativeLibraryDirectories=[/data/app/com.myappList item -1/lib/arm64, /vendor/lib64, /system/lib64]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
... 16 more
Suppressed: java.lang.ClassNotFoundException: com.google.android.gms.auth.api.phone.SmsRetriever
at java.lang.Class.classForName(Native Method)
at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
... 17 more
Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack trace available`
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'
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.
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/