I am developing an android app using Android Studio and got the message today that there is a new version of Google Play services.
I am using Google play services analytics, ads and tag manager. As well as Firebase analytics/messaging/crash.
The version I had in my build.gradle was 10.0.1 and the new version is 10.2.0
But when I change it, the app crashes on start with:
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.sega.segaid, PID: 15749
java.lang.NoSuchMethodError: com.google.android.gms.internal.zzaac.zza
at com.google.firebase.FirebaseApp.zzcl(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: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:4964)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:4559)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4499)
at android.app.ActivityThread.access$1600(ActivityThread.java:153)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1324)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5191)
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:810)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
at dalvik.system.NativeStart.main(Native Method)
Is this an error on my side? It crashes before the app even starts. The only thing I changed is updating the used dependencies of the play services and firebase.
The last time something like that happened, it was a bug in Firebase, which was fixed by Google after some days.
EDIT:
build.gradle dependencies
compile 'com.android.support:appcompat-v7:25.1.1'
compile 'com.android.support:support-v13:25.1.1'
compile 'com.android.support:design:25.1.1'
compile 'com.google.android.gms:play-services-base:10.2.0'
compile 'com.google.android.gms:play-services-tagmanager:10.2.0'
compile 'com.google.android.gms:play-services-ads:10.2.0'
compile 'com.google.android.gms:play-services-analytics:10.2.0'
compile 'com.google.firebase:firebase-core:10.2.0'
compile 'com.google.firebase:firebase-analytics:10.2.0'
compile 'com.google.firebase:firebase-messaging:10.2.0'
compile 'com.google.firebase:firebase-crash:10.2.0'
SOLUTION:
I cleared all caches and also added the version as def instead if writing it out each time. It worked now. Thank you everyone.
I picked the answer by rencsaridogan as solution because I think I forgot to update one of the libraries at my first try and the def is really helpful there. But I also needed to clear caches (as recommended by Avi in the comments below).
There are 2 important things about Google Play Services and Firebase usage as stated in official documentation.
You need to declare the latest classpath of Google Play Services in your root-level gradle, example quoted from given documentation:
buildscript {
// ...
dependencies {
// ...
classpath 'com.google.gms:google-services:3.0.0'
}
}
Also, as comments suggest in your project every Google Play Services and Firebase package has to have same version, to ensure this you can follow the method given below (It'll be easier like this, you only need to update version number on definitions)
def googlePlayLibVersion = "10.2.0"
def googleFirebaseLibVersion = "10.2.0"
ext {
annotations = "com.android.support:support-annotations:${supportLibVersion}"
firebaseAnalytics = "com.google.firebase:firebase-core:${googleFirebaseLibVersion}"
firebaseCrash = "com.google.firebase:firebase-crash:${googleFirebaseLibVersion}"
googlePlayAds = "com.google.android.gms:play-services-ads:${googlePlayLibVersion}"
googlePlayGcm = "com.google.android.gms:play-services-gcm:${googlePlayLibVersion}"
googlePlayAnalytics = "com.google.android.gms:play-services-analytics:${googlePlayLibVersion}"
}
Related
I just upgraded my Android Studio Version from 2.1 to 2.2.2 and I also upgraded a bunch of other Google dependencies (play services and all support libraries) to version 25.0.0.
I also upgraded gradle version to 2.2.2 and compiledSdkVersion to 25.
Well, I just made everything as up to date as possible.
Now when I run my app, I suddenly get this very weird crash as soon as the app launches.
java.lang.NoSuchMethodError: No static method zzb(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; in class Lcom/google/android/gms/common/internal/zzab; or its super classes (declaration of 'com.google.android.gms.common.internal.zzab' appears in /data/app/com.avantcar.a2go-1/base.apk:classes72.dex)
at com.google.firebase.provider.FirebaseInitProvider.zza(Unknown Source)
at com.google.firebase.provider.FirebaseInitProvider.attachInfo(Unknown Source)
at android.app.ActivityThread.installProvider(ActivityThread.java:5153)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:4748)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4688)
at android.app.ActivityThread.-wrap1(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1405)
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)
Has anyone seen this before and knows how to fix it?
I also saw this since a couple days ago after updating my sdk. This works for me:
Update your firebase library to version 10. You can do this by updating into these lines in build.gradle file:
compile 'com.google.firebase:firebase-core:10.0.0'
compile 'com.google.firebase:firebase-messaging:10.0.0'
You may have different firebase component on your project, so adjust accordingly.
But you can change the version to:
compile 'com.google.firebase:firebase-core:+'
compile 'com.google.firebase:firebase-messaging:+'
compile 'com.google.android.gms:play-services:+'
compile 'com.google.firebase:firebase-core:+'
The one that works for me
update all library versions and gms version as well . It will definitely work. Make sure all google services library you are using must be of same version
Today I tested my app on a new device (see below) and I'm getting an exception right at launch. I can't event start the main activity.
Device: Genymotion Samsung Galaxy S2 - Android 4.1.1 - API 16
No google play services installed.
E/AndroidRuntime: FATAL EXCEPTION: main
java.lang.NoClassDefFoundError: com.google.firebase.g
at com.google.firebase.b.a(Unknown Source)
at com.google.firebase.provider.FirebaseInitProvider.onCreate(Unknown Source)
at android.content.ContentProvider.attachInfo(ContentProvider.java:1058)
at com.google.firebase.provider.FirebaseInitProvider.attachInfo(Unknown Source)
at android.app.ActivityThread.installProvider(ActivityThread.java:4560)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:4190)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4132)
at android.app.ActivityThread.access$1300(ActivityThread.java:130)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1255)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4745)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
at dalvik.system.NativeStart.main(Native Method)
gradle build:
android {
compileSdkVersion 23
buildToolsVersion '23.0.2'
useLibrary 'org.apache.http.legacy'
defaultConfig {
applicationId "com.app"
minSdkVersion 10
targetSdkVersion 21
multiDexEnabled true
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile('com.crashlytics.sdk.android:crashlytics:2.5.5#aar') {
transitive = true;
}
compile 'com.android.support:recyclerview-v7:24.2.0'
compile 'com.android.support:appcompat-v7:24.2.0'
compile 'com.google.android.gms:play-services:9.4.0'
compile 'com.mcxiaoke.volley:library:1.0.19'
compile 'com.github.chrisbanes.actionbarpulltorefresh:extra-abc:+'
compile 'com.github.castorflex.smoothprogressbar:library:1.1.0'
compile 'com.jeremyfeinstein.slidingmenu:library:1.3#aar'
compile 'com.google.android.gms:play-services-ads:9.4.0'
compile 'com.google.android.gms:play-services-identity:8.4.0'
compile 'com.google.android.gms:play-services-gcm:9.4.0'
compile 'com.google.android.gms:play-services-auth:9.4.0'
}
Is it crashing because of missing Play Services?
Note: I have implemented firebase about a month ago, and It's working on other devices.
Although you have multiDexEnabled true in your build.gradle file, you are missing compile 'com.android.support:multidex:1.0.1' in your dependencies. I doubt that Mulidex is working. Review the Multidex configuration instructions and make sure you have done everything correctly.
Also, it is not good practice to include compile 'com.google.android.gms:play-services:9.4.0'. That adds all the Google Play and Firebase libraries to you app, increasing build time and the size of the APK file. Replace the dependency on play-services:9.4.0 with only the libraries you need. A list of the Google Play libraries is provided here, the Firebase libraries are listed here.
Try adding this apply plugin: 'com.google.gms.google-services' to the end of your gradle build file
You're correct, Firebase requires Google play services. As mentioned here in the release announcement for Google Play Services 9.0:
Google Play Services 9.0
Firebase was built using Google Play services 9.0
Add this line in the Application Tag on manifest file:
android:name="android.support.multidex.MultiDexApplication"
Does anyone knows about this crash?
Fatal Exception: java.lang.NullPointerException
at com.google.firebase.messaging.FirebaseMessagingService.zzo(Unknown Source)
at com.google.firebase.messaging.FirebaseMessagingService.zzn(Unknown Source)
at com.google.firebase.messaging.FirebaseMessagingService.zzm(Unknown Source)
at com.google.firebase.iid.zzb$2.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1076)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569)
at java.lang.Thread.run(Thread.java:856)
It doesn't happen that much, about 0.1% of sessions.
Reported environments: GI-I9500_TMMARS / Android 4.1.1.
This problem is discussed as an issue for the Quick Start project. Comments there from the Firebase support team indicate the problem is fixed in SDK version 9.4.0. Are you building with that version?
In my case i use wrong key to get value
Map data = remoteMessage.getData();
String name;
name = data.get("naem").toString());
//while correct key is name not naem
In order to fix this error you should update firebase in your Gradle file and add the 2nd line:
compile 'com.google.firebase:firebase-messaging:10.0.1'
compile 'com.google.firebase:firebase-core:10.0.1' // also need to add this line.
Getting a "Could not find" error? Make sure you have
the latest Google Repository in the Android SDK manager
Don't forget to update the Gradle file in the root folder of your project as well otherwise you won't be able to get the version 10.0.1:
buildscript {
// ...
dependencies {
// ...
classpath 'com.google.gms:google-services:3.0.0'
}
}
source:
https://github.com/firebase/quickstart-android/issues/185
https://firebase.google.com/docs/android/setup
I was following the Firebase guide to adding FCM, and so I added the following dependencies to my app gradle:
compile 'com.google.android.gms:play-services:9.0.0'
apply plugin: 'com.google.gms.google-services'
And this one to my project gradle:
classpath 'com.google.gms:google-services:3.0.0'
After this, I added the google-services.json from the Firebase console settings by downloading it and adding it to my app directory.
Now I'm getting this error:
Error:The number of method references in a .dex file cannot exceed 64K.
Learn how to resolve this issue at https://developer.android.com/tools/building/multidex.html
If I follow the instructions and have my application to support multidex, my application crashes as soon as it launches.
Here is the error after adding multidex to my app:
05-20 01:25:32.253 19812-19812/com.cryogenos.pearsonvisionlimousine W/dalvikvm: VFY: unable to resolve static field 8723 (common_google_play_services_unknown_issue) in Lcom/google/android/gms/R$string;05-20 01:25:32.253 19812-19812/com.cryogenos.pearsonvisionlimousine W/dalvikvm: threadid=1: thread exiting with uncaught exception (group=0x416b5e30)05-20 01:25:32.253 19812-19812/com.cryogenos.pearsonvisionlimousine E/AndroidRuntime: FATAL EXCEPTION: mainProcess: com.cryogenos.pearsonvisionlimousine, PID: 19812java.lang.NoClassDefFoundError: com.google.android.gms.R$stringat com.google.android.gms.common.internal.zzah.<init>
(Unknown Source)
at com.google.firebase.FirebaseOptions.fromResource(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:1609)
at android.content.ContentProvider.attachInfo(ContentProvider.java:1574)
at com.google.firebase.provider.FirebaseInitProvider.attachInfo(Unknown Source)
at android.app.ActivityThread.installProvider(ActivityThread.java:5643)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:5206)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5143)
at android.app.ActivityThread.access$1500(ActivityThread.java:156)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1418)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:157)
at android.app.ActivityThread.main(ActivityThread.java:5883)
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:872)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:688)
at dalvik.system.NativeStart.main(Native Method)
My phone's google play services is 9.0.0+.
I have updated to the latest play services and the repository in SDK manager.
EDIT:
My app build.gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "22.0.1"
defaultConfig {
applicationId "com.cryogenos.pearsonvisionlimousine"
minSdkVersion 19
targetSdkVersion 23
versionCode 3
versionName "2.1"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled true
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:23.1.1'
compile 'com.google.android.gms:play-services:9.0.0'
compile 'com.mcxiaoke.volley:library:1.0.19'
compile 'com.android.support:design:23.1.1'
compile 'com.android.support:multidex:1.0.0'
compile 'com.google.firebase:firebase-messaging:9.0.0'
}
apply plugin: 'com.google.gms.google-services'
One possible way to avoid 64k Dex error is by including only those APIs which your app needs from Google Play Services.
Selectively compiling APIs into your executable
From version 6.5, you can instead selectively compile Google Play service APIs into your app. For example, to include only the Google Fit and Android Wear APIs, replace the following line in your build.gradle file:
compile 'com.google.android.gms:play-services:9.0.0'
with these lines:
compile 'com.google.android.gms:play-services-fitness:9.0.0'
compile 'com.google.android.gms:play-services-wearable:9.0.0'
UPDATED
Well I read the doc, which says
Apps that rely on the Play Services SDK should always check the device for a compatible Google Play services APK before accessing Google Play services features
So you only need to check Google Play Service is available or not. And to do this you only need Google Actions, Base Client Library API.
compile 'com.google.android.gms:play-services-base:9.0.0'
as explained in documentation use Selectively compiling APIs into your executable which is best approach for you(take it in first priority insted of Multi Dex), because Multi-dex have some limitations check before proceed.
Avoiding the 64K Limit - Proguard will help you
Before configuring your app to enable use of 64K or more method
references, you should take steps to reduce the total number of
references called by your app code, including methods defined by your
app code or included libraries. The following strategies can help you
avoid hitting the dex reference limit:
Review your app's direct and transitive dependencies - Ensure any large library dependency you include in your app is used in a manner
that outweighs the amount of code being added to the application. A
common anti-pattern is to include a very large library because a few
utility methods were useful. Reducing your app code dependencies can
often help you avoid the dex reference limit.
Remove unused code with ProGuard - Configure the ProGuard settings for your app to run ProGuard and ensure you have shrinking enabled for
release builds. Enabling shrinking ensures you are not shipping unused
code with your APKs.
Using these techniques can help you avoid the
build configuration changes required to enable more method references
in your app. These steps can also decrease the size of your APKs,
which is particularly important for markets where bandwidth costs are
high.
So, try to avoid Multi-Dex
one more thing when you use compile 'com.android.support:design:23.1.1' then you not need to use compile 'com.android.support:appcompat-v7:23.1.1' and compile 'com.android.support:support-v4:23.1.1'. so remove v7 & v4 from build.gradle file
First check if the multidex has really worked, you can do that by renaming the apk file to zip and extracting it. There should 2 multiple classes.dex files.
Secondly, it can also happen if earlier to reduce the method you must have used proguard, so just comment the use of proguard and it should work.
Otherwise paste your exception here.
Something wrong.
Checking the doc you only need this dependency
dependencies {
compile 'com.google.firebase:firebase-messaging:9.0.0'
}
So you can remove this dependency
//compile 'com.google.android.gms:play-services:9.0.0'
If it is not enough and you have more than 65536 methods you can use the multidex support.
Just add these lines in the build.gradle:
android {
defaultConfig {
...
// Enabling multidex support.
multiDexEnabled true
}
...
}
dependencies {
compile 'com.android.support:multidex:1.0.0'
}
Also in your Manifest add the MultiDexApplication class from the multidex support library to the application element
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.android.multidex.myapplication">
<application
...
android:name="android.support.multidex.MultiDexApplication">
...
</application>
</manifest>
and override attachBaseContext method:
#Override
protected void attachBaseContext(Context newBase) {
super.attachBaseContext(newBase);
MultiDex.install(this);
}
If you are using a own Application class, change the parent class from Application to MultiDexApplication.
My Android application started crashing today when generating a token for Google Cloud Messaging (GCM). This happens on multiple devices and version of Android. I think it may have to do with the new Firebase features announced by Google yesterday at Google IO.
I wasn't working around the code related to GCM when this started happening so it was unexpected. If I uninstall Google Play Services updates from Android system settings, the app no longer crashes. As soon as I re-install the latest, the app starts crashing again every time.
FATAL EXCEPTION: IntentService[MyGCMRegistrationIntentService]
Process: <my process>, PID: 26036
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 'java.lang.reflect.ArtMethod' appears in /system/framework/core-libart.jar)
at com.google.android.gms.iid.zzd.zzeb(Unknown Source)
at com.google.android.gms.iid.zzd.<init>(Unknown Source)
at com.google.android.gms.iid.zzd.<init>(Unknown Source)
at com.google.android.gms.iid.InstanceID.zza(Unknown Source)
at com.google.android.gms.iid.InstanceID.getInstance(Unknown Source)
at <package>.MyGCMRegistrationIntentService.onHandleIntent(MyGCMRegistrationIntentService.java:<line number>);
at android.app.IntentService$ServiceHandler.handleMessage(IntentService.java:65)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.os.HandlerThread.run(HandlerThread.java:61)
Here is my registration service:
public class MyGCMRegistrationIntentService extends IntentService
{
public static final String KEY_GCM_TOKEN = "gcm_token";
public static final String KEY_GCM_INSTANCE_ID = "gcm_instance_id";
private static final String NAME = MyGCMRegistrationIntentService.class.getSimpleName();
public MyGCMRegistrationIntentService()
{
super(NAME);
}
#Override
protected void onHandleIntent(final Intent intent)
{
try
{
final InstanceID instanceId = InstanceID.getInstance(this);
final String token = instanceId.getToken(getGCMSenderID(), GoogleCloudMessaging.INSTANCE_ID_SCOPE, null);
final String instanceIdId = instanceId.getId();
sendTokenToMyServer(token, instanceIdId);
}
catch (final IOException e)
{
Timber.e(e, "Error getting GCM token.");
}
}
}
Top-level Gradle build file:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.1.0'
classpath 'de.felixschulze.gradle:gradle-hockeyapp-plugin:3.3'
classpath 'com.android.tools.build:gradle:2.1.0'
classpath 'com.google.gms:google-services:2.1.0'
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.3'
}
}
allprojects {
repositories {
jcenter()
maven { url 'https://jitpack.io' }
}
}
App-level Gradle build dependencies dealing with Google:
dependencies {
compile 'com.android.support:appcompat-v7:23.3.0'
compile 'com.android.support:multidex:1.0.1'
compile 'com.android.support:design:23.3.0'
compile 'com.android.support:recyclerview-v7:23.3.0'
compile 'com.android.support:support-annotations:23.3.0'
compile 'com.android.support:support-v4:23.3.0'
compile 'com.android.support:support-v13:23.3.0'
compile 'com.google.android.gms:play-services-analytics:8.4.0'
compile 'com.google.android.gms:play-services-gcm:8.4.0'
...(and then the rest of my dependecies)
}
Library dependencies dealing with Google (I know this is all messy and some things are redundant, sorry):
dependencies {
compile 'com.android.support:appcompat-v7:23.3.0'
compile 'com.android.support:cardview-v7:23.3.0'
compile 'com.android.support:recyclerview-v7:23.3.0'
compile 'com.android.support:support-v4:23.3.0'
compile 'com.android.support:support-v13:23.3.0'
compile 'com.google.android.gms:play-services-location:8.4.0'
compile 'com.google.android.gms:play-services-analytics:8.4.0'
compile 'com.google.android.gms:play-services-gcm:8.4.0'
...(and then the rest of my dependecies)
}
I thought maybe upgrading the versions would help. Here is what I upgraded:
com.google.gms:google-services:2.1.0 -> com.google.gms:google-services:3.0.0
com.google.android.gms:play-services-XXX:8.4.0' -> com.google.android.gms:play-services-XXX:9.0.0
The application still crashes, but in a different way. First it logs the following, but does not crash.
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.zzbu(Unknown Source)
at com.google.firebase.provider.FirebaseInitProvider.onCreate(Unknown Source)
at android.content.ContentProvider.attachInfo(ContentProvider.java:1696)
at android.content.ContentProvider.attachInfo(ContentProvider.java:1671)
at com.google.firebase.provider.FirebaseInitProvider.attachInfo(Unknown Source)
at android.app.ActivityThread.installProvider(ActivityThread.java:4999)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:4594)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4534)
at android.app.ActivityThread.access$1500(ActivityThread.java:151)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1364)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5254)
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:903)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)
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 'java.lang.reflect.ArtMethod' appears in /system/framework/core-libart.jar)
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 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.zzbu(Unknown Source)
at com.google.firebase.provider.FirebaseInitProvider.onCreate(Unknown Source)
at android.content.ContentProvider.attachInfo(ContentProvider.java:1696)
at android.content.ContentProvider.attachInfo(ContentProvider.java:1671)
at com.google.firebase.provider.FirebaseInitProvider.attachInfo(Unknown Source)
at android.app.ActivityThread.installProvider(ActivityThread.java:4999)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:4594)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4534)
at android.app.ActivityThread.access$1500(ActivityThread.java:151)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1364)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5254)
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:903)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)
After I move around in the app which triggers the GCM registration, I get the same stack as before along with this line before crashing:
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 'java.lang.reflect.ArtMethod' appears in /system/framework/core-libart.jar): com.google.android.gms.measurement.internal.zzt.zzEd(Unknown Source)
So the issue is that you have dependencies that inlcude old versions of the support library. Check this thread out:
Android UrbanAirship Crash in takeOff
Doing this might help (from the thread):
configurations.all {
resolutionStrategy {
force 'com.android.support:design:23.4.0'
force 'com.android.support:support-v4:23.4.0'
force 'com.android.support:appcompat-v7:23.4.0'
}
}
Try this it will solve
configurations.all {
resolutionStrategy {
force 'com.android.support:design:23.4.0'
force 'com.android.support:support-v4:23.4.0'
force 'com.android.support:appcompat-v7:23.4.0'
}
}
if you still have problem then you can solve it as,
Updated the play-services dependencies in build.gradle
dependencies {
compile 'com.google.android.gms:play-services:9.0.0'}
If any version conflict fix it by adding this in build.gradle (project gradle)
dependencies {
classpath 'com.google.gms:google-services:3.0.0'}
update may 27:
we just released an update (version 9.0.1) to fix the incompatibility I mentioned in my first edit.
Please update your dependencies and let us know if this is still an issue.
Thanks!
original answer May 20:
Version 9.0.0 of Google Play services sdk includes an incompatibility with the support library version 24.x (the version released to support Android-N)
Please check that you are using:
dependencies {
compile 'com.android.support:appcompat-v7:23.3.0'
}
and not com.android.support:appcompat-v7:24.*
If you already update Android Support Repository, revert it by replacing m2repository folder at sdk path.
First download Older m2repository :
https://dl-ssl.google.com/android/repository/android_m2repository_r31.zip
SDK Path
Replace m2repository folder
Just upate your GCM library, it'll fix your Problem.
compile "com.google.android.gms:play-services-gcm:9.2.0"