Problems implementing the new GCM Client for Android

前端 未结 2 1628
悲哀的现实
悲哀的现实 2020-12-19 08:39

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

2条回答
  •  粉色の甜心
    2020-12-19 09:24

    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.(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 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'
    }
    

提交回复
热议问题