The error message "Unable to instantiate receiver com.parse.GcmBroadcastReceiver" usually occurs when there's an issue with the configuration of the Parse SDK's GcmBroadcastReceiver in your AndroidManifest.xml or due to issues with the Parse SDK itself. This receiver is responsible for handling push notifications in Parse.

To fix this issue, you can follow these steps:

  1. Check Dependencies: Make sure you have the correct dependencies for the Parse SDK in your build.gradle file:

    gradle
    implementation 'com.parse:parse-android:latest_version' implementation 'com.google.android.gms:play-services-gcm:latest_version'

    Replace latest_version with the appropriate version number for your project.

  2. Check AndroidManifest.xml: Ensure that you have correctly registered the GcmBroadcastReceiver in your AndroidManifest.xml. It should look something like this:

    xml
    <receiver android:name="com.parse.GcmBroadcastReceiver" android:permission="com.google.android.c2dm.permission.SEND"> <intent-filter> <action android:name="com.google.android.c2dm.intent.RECEIVE" /> <action android:name="com.google.android.c2dm.intent.REGISTRATION" /> <!-- Replace YOUR_PARSE_APP_ID with your actual Parse App ID --> <category android:name="YOUR_PARSE_APP_ID" /> </intent-filter> </receiver>

    Make sure to replace YOUR_PARSE_APP_ID with your actual Parse App ID. This ID can be found in the Parse Dashboard.

  3. Check Parse Initialization: Verify that you have correctly initialized the Parse SDK in your application's Application class or in the entry point of your app.

    java
    import android.app.Application; import com.parse.Parse; public class YourApplication extends Application { @Override public void onCreate() { super.onCreate(); // Replace YOUR_PARSE_APP_ID and YOUR_PARSE_CLIENT_KEY with your actual keys Parse.initialize(new Parse.Configuration.Builder(this) .applicationId("YOUR_PARSE_APP_ID") .clientKey("YOUR_PARSE_CLIENT_KEY") .server("https://parseapi.back4app.com/") .build() ); } }

    Ensure that you have provided the correct Parse App ID, Client Key, and Parse Server URL.

  4. Check Google Play Services: Make sure that Google Play Services is installed and up-to-date on the device or emulator where you are testing the app. The Parse SDK relies on Google Play Services for handling push notifications.

  5. Rebuild and Clean: Sometimes, issues can be resolved by cleaning and rebuilding your project. Try cleaning the project and rebuilding it to see if the error persists.

If you have followed these steps and the issue persists, make sure you have the latest version of the Parse SDK and Google Play Services in your project. You can also check the Parse documentation and GitHub repository for any reported issues or updates.

Have questions or queries?
Get in Touch