我知道這個問題已被問到,但這些答案是沒有幫助的。java.lang.IllegalStateException:沒有收件人的行動com.google.android.c2dm.intent.REGISTRATION
我在三星標籤3等特定設備上出現錯誤,並且它在三星Galaxy S3手機上運行良好。
我想在支持谷歌播放服務的所有設備上運行我的應用程序。還有其他的應用程序,其中包括GCM和三星標籤3
我的manifest.xml
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.google.android.gcm.demo.app"
android:versionCode="1"
android:versionName="1.0" >
<!-- GCM requires Android SDK version 2.2 (API level 8) or above. -->
<!--
The targetSdkVersion is optional, but it's always a good practice
to target higher versions.
-->
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="16" />
<!-- GCM connects to Google Services. -->
<uses-permission android:name="android.permission.INTERNET" />
<!-- GCM requires a Google account. -->
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<!-- Keeps the processor from sleeping when a message is received. -->
<uses-permission android:name="android.permission.WAKE_LOCK" />
<!--
Creates a custom permission so only this app can receive its messages.
NOTE: the permission *must* be called PACKAGE.permission.C2D_MESSAGE,
where PACKAGE is the application's package name.
-->
<permission
android:name="com.google.android.gcm.demo.app.permission.C2D_MESSAGE"
android:protectionLevel="signature" />
<uses-permission android:name="com.google.android.gcm.demo.app.permission.C2D_MESSAGE" />
<!-- This app has permission to register and receive data message. -->
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<!-- Main activity. -->
<application
android:icon="@drawable/ic_launcher"
android:label="@string/app_name" >
<meta-data
android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />
<activity
android:name=".DemoActivity"
android:configChanges="orientation|keyboardHidden"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<!--
BroadcastReceiver that will receive intents from GCM
services and handle them to the custom IntentService.
The com.google.android.c2dm.permission.SEND permission is necessary
so only GCM services can send data messages for the app.
-->
<receiver
android:name="com.google.android.gcm.GCMBroadcastReceiver"
android:permission="com.google.android.c2dm.permission.SEND" >
<intent-filter>
<!-- Receives the actual messages. -->
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
<!-- Receives the registration id. -->
<action android:name="com.google.android.c2dm.intent.REGISTRATION" />
<category android:name="com.google.android.gcm.demo.app" />
</intent-filter>
</receiver>
<service android:name="com.google.android.gcm.demo.app.GCMIntentService" />
</application>
我的錯誤日誌上運行良好: -
09-22 13:03:06.625: E/AndroidRuntime(22439): FATAL EXCEPTION: main
09-22 13:03:06.625: E/AndroidRuntime(22439): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.google.android.gcm.demo.app/com.google.android.gcm.demo.app.DemoActivity}: java.lang.IllegalStateException: No receivers for action com.google.android.c2dm.intent.REGISTRATION
09-22 13:03:06.625: E/AndroidRuntime(22439): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2129)
09-22 13:03:06.625: E/AndroidRuntime(22439): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2154)
09-22 13:03:06.625: E/AndroidRuntime(22439): at android.app.ActivityThread.access$700(ActivityThread.java:146)
09-22 13:03:06.625: E/AndroidRuntime(22439): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1260)
09-22 13:03:06.625: E/AndroidRuntime(22439): at android.os.Handler.dispatchMessage(Handler.java:99)
09-22 13:03:06.625: E/AndroidRuntime(22439): at android.os.Looper.loop(Looper.java:137)
09-22 13:03:06.625: E/AndroidRuntime(22439): at android.app.ActivityThread.main(ActivityThread.java:4949)
09-22 13:03:06.625: E/AndroidRuntime(22439): at java.lang.reflect.Method.invokeNative(Native Method)
09-22 13:03:06.625: E/AndroidRuntime(22439): at java.lang.reflect.Method.invoke(Method.java:511)
09-22 13:03:06.625: E/AndroidRuntime(22439): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1043)
09-22 13:03:06.625: E/AndroidRuntime(22439): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:810)
09-22 13:03:06.625: E/AndroidRuntime(22439): at dalvik.system.NativeStart.main(Native Method)
09-22 13:03:06.625: E/AndroidRuntime(22439): Caused by: java.lang.IllegalStateException: No receivers for action com.google.android.c2dm.intent.REGISTRATION
09-22 13:03:06.625: E/AndroidRuntime(22439): at com.google.android.gcm.GCMRegistrar.checkReceiver(GCMRegistrar.java:184)
09-22 13:03:06.625: E/AndroidRuntime(22439): at com.google.android.gcm.GCMRegistrar.checkManifest(GCMRegistrar.java:169)
09-22 13:03:06.625: E/AndroidRuntime(22439): at com.google.android.gcm.demo.app.DemoActivity.onCreate(DemoActivity.java:54)
09-22 13:03:06.625: E/AndroidRuntime(22439): at android.app.Activity.performCreate(Activity.java:5185)
09-22 13:03:06.625: E/AndroidRuntime(22439): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1094)
09-22 13:03:06.625: E/AndroidRuntime(22439): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2093)
09-22 13:03:06.625: E/AndroidRuntime(22439): ... 11 more
這是在同一個包。我還說過,該應用程序正在其他設備上運行。如果問題是關於錯誤的軟件包名稱而不是如何在其他設備上運行。 – 2014-09-22 07:58:25
當我的設備在安全模式下運行時,我也遇到了同樣的問題! - 此信息可能對您有所幫助。 – 2015-06-19 07:26:04
對我的問題進行低估的人請告訴我我的問題以何種方式不適當的原因?你甚至讀過我的問題嗎? – 2015-06-30 09:12:39