3

これを理解できません。テストアプリの1つで、アプリを閉じるときにエラーが発生します。

LogCatでは、handleRegistrationの長いコードは青いテキストでOKと表示されますが、アプリにregIdを保存した後、登録コードは赤いテキストで表示されます。

誰かが理由を知っていますか?

別のアプリでは、同じエミュレーターで、それは起こりませんが、私は解決策を見つけることができません。

編集

そうです、申し訳ありませんが、これはLogCatの出力です。

10-26 12:22:11.383: I/dalvikvm(754): threadid=3: reacting to signal 3
10-26 12:22:11.539: I/dalvikvm(754): Wrote stack traces to '/data/anr/traces.txt'
10-26 12:22:11.644: I/dalvikvm(754): threadid=3: reacting to signal 3
10-26 12:22:11.718: I/dalvikvm(754): Wrote stack traces to '/data/anr/traces.txt'
10-26 12:22:11.873: D/GCMRegistrar(754): resetting backoff for nl.easy.gcmnotification
10-26 12:22:11.883: V/GCMRegistrar(754): Registering app nl.easy.gcmnotification of senders 182xxxxxx601
10-26 12:22:12.153: I/dalvikvm(754): threadid=3: reacting to signal 3
10-26 12:22:12.163: I/dalvikvm(754): Wrote stack traces to '/data/anr/traces.txt'
10-26 12:22:12.445: D/gralloc_goldfish(754): Emulator without GPU emulation detected.
10-26 12:22:13.843: V/GCMBroadcastReceiver(754): onReceive: 
com.google.android.c2dm.intent.REGISTRATION
10-26 12:22:13.843: V/GCMBroadcastReceiver(754): GCM IntentService class: nl.easy.gcmnotification.GCMIntentService
10-26 12:22:13.853: V/GCMBaseIntentService(754): Acquiring wakelock
10-26 12:22:13.864: V/GCMBaseIntentService(754): Intent service name: GCMIntentService-182537982601-1
10-26 12:22:13.953: E/GCMRegistrar(754): internal error: retry receiver class not set yet
10-26 12:22:13.953: V/GCMRegistrar(754): Registering receiver
10-26 12:22:13.953: D/GCMBaseIntentService(754): handleRegistration: registrationId = APAxxxxxx8Kg, error = null, unregistered = null (IN COLOR BLUE)
10-26 12:22:13.953: D/GCMRegistrar(754): resetting backoff for nl.easy.gcmnotification
10-26 12:22:13.964: V/GCMRegistrar(754): Saving regId on app version 1
10-26 12:22:13.973: E/(754): registration id : APAxxxxxx8Kg (IN COLOR RED)
10-26 12:22:13.973: V/GCMBaseIntentService(754): Releasing wakelock
(WHEN SHUTTING DOWN APP)
10-26 12:22:35.033: V/GCMRegistrar(754): Unregistering receiver
10-26 12:22:35.033: D/AndroidRuntime(754): Shutting down VM
10-26 12:22:35.033: W/dalvikvm(754): threadid=1: thread exiting with uncaught exception (group=0x409c01f8)
10-26 12:22:35.155: E/AndroidRuntime(754): FATAL EXCEPTION: main
10-26 12:22:35.155: E/AndroidRuntime(754): java.lang.RuntimeException: Unable to destroy activity {nl.easy.gcmnotification/nl.easy.gcmnotification.MainActivity}: java.lang.IllegalArgumentException: Receiver not registered: com.google.android.gcm.GCMBroadcastReceiver@412bc5c0
10-26 12:22:35.155: E/AndroidRuntime(754):  at android.app.ActivityThread.performDestroyActivity(ActivityThread.java:3112)
10-26 12:22:35.155: E/AndroidRuntime(754):  at android.app.ActivityThread.handleDestroyActivity(ActivityThread.java:3130)
10-26 12:22:35.155: E/AndroidRuntime(754):  at android.app.ActivityThread.access$1200(ActivityThread.java:123)
10-26 12:22:35.155: E/AndroidRuntime(754):  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1180)
10-26 12:22:35.155: E/AndroidRuntime(754):  at android.os.Handler.dispatchMessage(Handler.java:99)
10-26 12:22:35.155: E/AndroidRuntime(754):  at android.os.Looper.loop(Looper.java:137)
10-26 12:22:35.155: E/AndroidRuntime(754):  at android.app.ActivityThread.main(ActivityThread.java:4424)
10-26 12:22:35.155: E/AndroidRuntime(754):  at java.lang.reflect.Method.invokeNative(Native Method)
10-26 12:22:35.155: E/AndroidRuntime(754):  at java.lang.reflect.Method.invoke(Method.java:511)
10-26 12:22:35.155: E/AndroidRuntime(754):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
10-26 12:22:35.155: E/AndroidRuntime(754):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
10-26 12:22:35.155: E/AndroidRuntime(754):  at dalvik.system.NativeStart.main(Native Method)
10-26 12:22:35.155: E/AndroidRuntime(754): Caused by: java.lang.IllegalArgumentException: Receiver not registered: com.google.android.gcm.GCMBroadcastReceiver@412bc5c0
10-26 12:22:35.155: E/AndroidRuntime(754):  at android.app.LoadedApk.forgetReceiverDispatcher(LoadedApk.java:628)
10-26 12:22:35.155: E/AndroidRuntime(754):  at android.app.ContextImpl.unregisterReceiver(ContextImpl.java:1066)
10-26 12:22:35.155: E/AndroidRuntime(754):  at android.content.ContextWrapper.unregisterReceiver(ContextWrapper.java:354)
10-26 12:22:35.155: E/AndroidRuntime(754):  at com.google.android.gcm.GCMRegistrar.onDestroy(GCMRegistrar.java:266)
10-26 12:22:35.155: E/AndroidRuntime(754):  at nl.easy.gcmnotification.MainActivity.onDestroy(MainActivity.java:49)
10-26 12:22:35.155: E/AndroidRuntime(754):  at android.app.Activity.performDestroy(Activity.java:4629)
10-26 12:22:35.155: E/AndroidRuntime(754):  at android.app.Instrumentation.callActivityOnDestroy(Instrumentation.java:1079)
10-26 12:22:35.155: E/AndroidRuntime(754):  at android.app.ActivityThread.performDestroyActivity(ActivityThread.java:3099)
10-26 12:22:35.155: E/AndroidRuntime(754):  ... 11 more
4

2 に答える 2

0

この問題は、eclipseを再起動し、プロジェクトをクリーンアップ/再構築することで修正されます...奇妙ですが本当です!

于 2012-11-23T13:49:49.060 に答える
0

アクティビティを破棄するために使用されたコードを投稿できますか?

あなたの問題はこれと同じだと思います: GCMRegistrar.onDestroy(context)がクラッシュし、Receiverが登録されていません

別の潜在的な問題:マニフェストでサービスを宣言しましたか?

于 2012-11-19T15:11:25.733 に答える