在为Google Cloud Messaging(GCM)生成令牌时,我的Android应用程序今天开始崩溃.这种情况发生在Android的多个设备和版本上.我认为这可能与Google昨天在Google IO上宣布的新Firebase功能有关.
当这个开始发生时,我没有解决与GCM相关的代码,所以这是出乎意料的.如果我从Android系统设置中卸载Google Play服务更新,则该应用不会崩溃.一旦我重新安装最新版本,应用程序每次都会再次崩溃.
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)
Run Code Online (Sandbox Code Playgroud)
这是我的注册服务:
public class MyGCMRegistrationIntentService extends IntentService
{
public static final String KEY_GCM_TOKEN = …Run Code Online (Sandbox Code Playgroud)