Skip to content Skip to sidebar Skip to footer

Problems Implementing The New GCM Client For Android

I'm trying to implement the new GCM Client on Android following the guidelines from Google (https://developers.google.com/cloud-messaging/android/client). I'm receiving slightly di

Solution 1:

I saw that the method getNoBackupFilesDir is found in android.support.v4.content.ContextCompat.

Seems that the problem was that I had an old appcompat-v7 included in the project. Download with the SDK manager the last version of Android Support Library and then follow the steps for Adding libraries with resources and add the library to your application project.


Solution 2:

I got this error:

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.crave.iapdemo/files/instant-run/dex/slice-com.google.android.gms-play-services-basement-10.0.1_b9da1447b99cc6cbc2fa601fb84d0418780bfa55-classes.dex)
                                                                       at com.google.android.gms.iid.zzd.zzeC(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 vodio.labs.crave.gcm.RegistrationIntentService.onHandleIntent(RegistrationIntentService.java:39)

in this line:

InstanceID.getInstance(this);

The solution for me was upgrading this:

dependencies {
    // play services
    compile 'com.google.android.gms:play-services-gcm:9.0.0'
    compile 'com.google.android.gms:play-services-analytics:9.0.0'
}

into:

dependencies {
    // play services
    compile 'com.google.android.gms:play-services-gcm:10.0.1'
    compile 'com.google.android.gms:play-services-analytics:10.0.1'
}

Post a Comment for "Problems Implementing The New GCM Client For Android"