GCM upgrade from 7.5 to 8.3.0 fatal exception

I tried updating the GCM (Google cloud messages) libraries (from 7.5 to 8.3.0) in my Gradle project. But now, with this new version, I can’t start the previous activity, which worked fine before.

Code that handles the following error:

Intent in = new Intent(this, MyGcmListenerService.class);
startService(in);

MyGcmListenerService.java:

public class MyGcmListenerService extends GcmListenerService
{
    private static final String TAG = "MyGcmListenerService";

    @Override
    public void onMessageReceived(String from, Bundle data)
    {
        Log.w(TAG, "onMessageReceived");
    }

Error returned:

FATAL EXCEPTION: AsyncTask #1
java.lang.NullPointerException: Attempt to invoke virtual method 'int java.lang.String.hashCode()' on a null object reference
E/AndroidRuntime:     at com.google.android.gms.gcm.GcmListenerService.zzo(Unknown Source)
E/AndroidRuntime:     at com.google.android.gms.gcm.GcmListenerService.zza(Unknown Source)
E/AndroidRuntime:     at com.google.android.gms.gcm.GcmListenerService$1.run(Unknown Source)
E/AndroidRuntime:     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
E/AndroidRuntime:     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
E/AndroidRuntime:     at java.lang.Thread.run(Thread.java:818)

Gradle files:

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:appcompat-v7:21.0.3'
    compile 'com.google.android.gms:play-services-gcm:8.3.0'
}

If I roll back from a previous version of GCM (7.5), it works as expected. Do you know what has changed? I checked the change lists, but I could not find information about this. https://developers.google.com/android/guides/releases

thanks for the help

+4
source share
1 answer

GcmListenerService, IDE. Android Studio 8.3.0, , , , , ACTION , . , ACTION null.

, GcmListenerService? GCM GcmReceiver, GcmListenerService . , GcmReceiver . .

+7

Source: https://habr.com/ru/post/1615749/


All Articles