android - GCM 错误 - googleCloudMessaging.register

标签 android push-notification google-cloud-messaging sap-fiori gcmlistenerservice

我遇到了 android 应用程序所说的问题。 “The application xxxx Sorry stopped”与推送通知一起工作,当执行调试器时发生在它通过时:

方法一

InstanceID InstanceId = InstanceID.getInstance (context);

 token = instanceID.getToken (key_id.toString ()

GoogleCloudMessaging.INSTANCE_ID_SCOPE); getToken error,

方法二

都是同一个错误

 if (googleCloudMessaging == null) {
googleCloudMessaging = GoogleCloudMessaging.getInstance(context);
                    }
                    token = googleCloudMessaging.register(key_id);

注意生成了token但是应用关闭了,报错:

"The method 'java.io.File android.support.v4.content.ContextCompat.getNoBackupFilesDir (android.content.Context)' was expected to be of type virtual but was found to be Instead of direct type (declaration of 'java.lang .reflect.ArtMethod 'appears in /system/framework/core-libart.jar)"

我正在使用 android studio,因为 cdvCompileSdkVersion = android-22 cdvBuildToolsVersion = 22.0.1

错误:

"FATAL EXCEPTION: main
Process:  PID: 11989
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.zzde(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 com.google.android.gms.iid.InstanceIDListenerService.zzn(Unknown Source)
    at com.google.android.gms.iid.InstanceIDListenerService.onStartCommand(Unknown Source)
    at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:2924)
    at android.app.ActivityThread.access$2100(ActivityThread.java:155)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1415)
    at android.os.Handler.dispatchMessage(Handler.java:102)
    at android.os.Looper.loop(Looper.java:135)
    at android.app.ActivityThread.main(ActivityThread.java:5343)
    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:905)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:700)"

可能是什么问题?

问候,

最佳答案

Google 已更新他们的发行说明,此问题已修复,您只需将版本更新到 9.0.2

这是发行说明:https://developers.google.com/android/guides/releases

关于android - GCM 错误 - googleCloudMessaging.register,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37415045/

相关文章:

android - 使用 ORMLite 时构造函数出错

android - 无法运行应用程序 - "The target device does not support the ' run-as'命令”

objective-c - didReceiveRemoteNotification 没有被调用

ios - 当前台应用程序收到推送通知时刷新当前 View ?

android - 在GCM android的推送通知中自动扩展图像

android - GCM ACCOUNT_MISSING 错误

android - ontouch逐帧动画

swift - .Element 含糊不清地使用 Element SWXMLHash swift

javascript - Chrome 浏览器 GCM - TOO_MANY_REGISTRATIONS - 如何取消注册/清除所有已注册的应用 ID (registration.pushManager.subscribe)

Android编程如何使用if和else语句检查应用程序是否存在