Note that there are some explanatory texts on larger screens.

plurals
  1. POGCM - "Unable to instantiante receiver"
    text
    copied!<p><strong>The Error:</strong></p> <pre><code>java.lang.RuntimeException: Unable to instantiate receiver com.app_name.GcmBroadcastReceiver: java.lang.ClassNotFoundException: Didn't find class "com.app_name.GcmBroadcastReceiver" on path: DexPathList[[zip file "/data/app/com.app_name-2.apk"],nativeLibraryDirectories=[/data/app-lib/com.app_name-2, /system/lib]] </code></pre> <p><strong>Class Source Code</strong></p> <pre><code>package com.app_name; import android.app.Activity; import android.content.ComponentName; import android.content.Context; import android.content.Intent; import android.support.v4.content.WakefulBroadcastReceiver; public class GcmBroadcastReceiver extends WakefulBroadcastReceiver { @Override public void onReceive(Context context, Intent intent){ ComponentName comp = new ComponentName(context.getPackageName(), GcmIntentService.class.getName()); startWakefulService(context, (intent.setComponent(comp))); setResultCode(Activity.RESULT_OK); } } </code></pre> <p><strong>Manifest</strong></p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.app_name" android:versionCode="1" android:versionName="1.0"&gt; &lt;uses-sdk android:minSdkVersion="15" android:targetSdkVersion="17"/&gt; &lt;uses-permission android:name="android.permission.INTERNET" /&gt; &lt;uses-permission android:name="android.permission.GET_ACCOUNTS" /&gt; &lt;uses-permission android:name="android.permission.WAKE_LOCK" /&gt; &lt;uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" /&gt; &lt;permission android:name="com.app_name.permission.C2D_MESSAGE" android:protectionLevel="signature" /&gt; &lt;uses-permission android:name="com.app_name.permission.C2D_MESSAGE" /&gt; &lt;application android:label="@string/app_name" android:icon="@drawable/ic_launcher"&gt; &lt;activity android:name="Main" android:label="@string/app_name"&gt; &lt;intent-filter&gt; &lt;action android:name="android.intent.action.MAIN"/&gt; &lt;category android:name="android.intent.category.LAUNCHER"/&gt; &lt;/intent-filter&gt; &lt;/activity&gt; &lt;receiver android:name=".GcmBroadcastReceiver" android:permission="com.google.android.c2dm.permission.SEND"&gt; &lt;intent-filter&gt; &lt;action android:name="com.google.android.c2dm.intent.RECEIVE" /&gt; &lt;category android:name="com.app_name" /&gt; &lt;/intent-filter&gt; &lt;/receiver&gt; &lt;service android:name=".GcmIntentService" /&gt; &lt;/application&gt; &lt;/manifest&gt; </code></pre> <p>I've been searching for at least an hour trying to figure this out, and none of the solutions I've seen have worked for me. Most of the time this error happens when there is a simple typo, but I've checked the code over and over, and can't figure out what is wrong with it. If it makes a difference, I am using IntelliJ Idea (not Android Studio) and an HTC One (T-Mobile US) connected via USB to compile/run the app.</p> <p>This occurs when I send the GCM message down to the device. So I know it's receiving it, but I can't figure out what would be causing this.</p> <p>All help would be appreciated!</p> <p><strong>FIXED</strong> Fixed - The problem was with the fact that I created the project using the JDK6 then set it to the JDK7. Recreating the project fixed it!</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload