google / gcm

Google Cloud Messaging - client libraries and sample implementations
https://developers.google.com/cloud-messaging
Apache License 2.0
820 stars 515 forks source link

NullPointerException in Android device #176

Open sytolk opened 8 years ago

sytolk commented 8 years ago

I have GCM 8.4.0

02-24 21:35:41.567 E/ACRA    ( 1170): java.lang.NullPointerException
02-24 21:35:41.567 E/ACRA    ( 1170):    at com.google.android.gms.gcm.GcmListenerService.zzo(Unknown Source)
02-24 21:35:41.567 E/ACRA    ( 1170):    at com.google.android.gms.gcm.GcmListenerService.zza(Unknown Source)
02-24 21:35:41.567 E/ACRA    ( 1170):    at com.google.android.gms.gcm.GcmListenerService$1.run(Unknown Source)
02-24 21:35:41.567 E/ACRA    ( 1170):    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1076)
02-24 21:35:41.567 E/ACRA    ( 1170):    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569)
02-24 21:35:41.567 E/ACRA    ( 1170):    at java.lang.Thread.run(Thread.java:856)
kroikie commented 8 years ago

Could you provide some more context around your issue, eg: code snippet, how often you can reproduce the issue.

yudhir commented 8 years ago

MAGIC PUSH My Crashlytics show this similar error once but I haven't sent any Push to any devices . The date registered for error on Crashlytics is Dec27 2015 even If the app launched a week ago.

The null pointer is shown to the String from. It is the default parameter for onMessageReceived. The device is some Rooted Android 4.1.1 GI I9500 TMMARS

com.myapp.appname.gcmservices.MedalGCMListenerService.onMessageReceived(MedalGCMListenerService.java:30)
       at com.google.android.gms.gcm.GcmListenerService.zzq(Unknown Source)
       at com.google.android.gms.gcm.GcmListenerService.zzp(Unknown Source)
       at com.google.android.gms.gcm.GcmListenerService.zzo(Unknown Source)
       at com.google.android.gms.gcm.GcmListenerService.zza(Unknown Source)
       at com.google.android.gms.gcm.GcmListenerService$1.run(Unknown Source)
       at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1076)
       at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569)
       at java.lang.Thread.run(Thread.java:856)
yudhir commented 8 years ago

Found the reason.

http://stackoverflow.com/questions/34942269/downloadmanager-illegalstateexception-creating-a-download-in-directory-downloads

TMMARS appears to be software from Trend Micro.

Trend Micro Mobile App Reputation Service or TMMARS is a cloud-based service that automatically identifies mobile threats based on app behaviors. It is extremely likely that the system is not behaving as the App expects it to, simply because it is a threat detection environment.

mjhram commented 8 years ago

Hi, I have the same issue. How this can be solved?

neocite commented 8 years ago

Hi, I have them same problem. Stack error: http://crashes.to/s/f5377ac4300

weicong96 commented 8 years ago

I had the same issue, was resolved by removing code that starts the class that inherits the GcmListenerService explictly

marcomorain commented 7 years ago

I'm hitting the same issue. It hit lots of times last night.

# Platform: android
# Date: 2016-10-14T17:49:41Z
# OS Version: 4.1.1
# Device: Full Android on Emulator
# RAM Free: 60.5%
# Disk Free: 88.8%

Fatal Exception: java.lang.NullPointerException
       at com.google.android.gms.gcm.GcmListenerService.zzo(Unknown Source)
       at com.google.android.gms.gcm.GcmListenerService.zza(Unknown Source)
       at com.google.android.gms.gcm.GcmListenerService$1.run(Unknown Source)
       at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1076)
       at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569)
       at java.lang.Thread.run(Thread.java:856)

#0. Crashed: AsyncTask #2: 0 0 0x0000000000000000
       at com.google.android.gms.gcm.GcmListenerService.zzo(Unknown Source)
       at com.google.android.gms.gcm.GcmListenerService.zza(Unknown Source)
       at com.google.android.gms.gcm.GcmListenerService$1.run(Unknown Source)
       at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1076)
       at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569)
       at java.lang.Thread.run(Thread.java:856)
ogeidix commented 7 years ago

Hi Marco, which version of GCM are you using? also, any chance you can update to Firebase Cloud Messaging?

Sloy commented 7 years ago

We're seeing exactly the same issue in crashlytics. I cannot seem to be able to reproduce it locally.

We were using the old BroadcastReceiver+IntentService technique, and we recently updated to GcmListenerService. That's when these crashes started to appear.

We're using version 8.4 of GCM, and cannot migrate to FCM at the moment.

Sloy commented 7 years ago

From reading the obfuscated code of GcmListenerService, it looks like the NPE is caused by the action switch in the zzo(Intent) method, because the intent's action is null. I can't be sure, but it also seems like this is coming from the zzn(intent) method called from onStartCommand.

I wonder, how could an intent arrive with a null action? Is this a different scenario from a normal server push? Since this is executed inside a ThreadPool we lose sight of the stacktrace.

And more importantly, @ogeidix is there a way to work around this?

marcomorain commented 7 years ago

This happening with com.google.android.gms:play-services-gcm:8.4.0. We have recently upgraded to 9.4.0 but I can't verify if the problem occurs with that version.

ogeidix commented 7 years ago

GCM 8.4 is quite old. Please update to the latest version of GCM (FCM would be even better) and report back if the problem persists.

PS: a new version is being released this week, so keep an eye on GCM: https://developers.google.com/android/guides/releases FCM: https://firebase.google.com/support/release-notes/android

arsners commented 7 years ago

Happened at 02/03/2017

java.lang.NullPointerException at com.google.android.gms.gcm.GcmListenerService.zzm(Unknown Source) at com.google.android.gms.gcm.GcmListenerService.zza(Unknown Source) at com.google.android.gms.gcm.GcmListenerService$1.run(Unknown Source) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1076) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569) at java.lang.Thread.run(Thread.java:856)

coyarzun89 commented 7 years ago

I have the same issue. It happen only on Android 4.3. I'm using the version 11.0.1 of GCM. Fatal Exception: java.lang.NullPointerException at com.google.android.gms.gcm.GcmListenerService.handleIntent(Unknown Source) at com.google.firebase.iid.zzc.run(Unknown Source) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573) at java.lang.Thread.run(Thread.java:841)

Bringoff commented 6 years ago

@coyarzun89 got two crashes with identical stacktrace from rooted Nexus 5 with Android 4.3. Google services v11.2.0.

ogeidix commented 6 years ago

Thanks @coyarzun89 @bringoff for the update. Will investigate and add more safeguards

procedurallygenerated commented 6 years ago

@ogeidix Got a similar crash with play-services-gcm:11.4.0.

Device Nexus 5 with Android 4.3

Fatal Exception: java.lang.NullPointerException
    at com.google.android.gms.gcm.GcmListenerService.handleIntent(Unknown Source)
    at com.google.firebase.iid.zzc.run(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573)
    at java.lang.Thread.run(Thread.java:841)
anjalisingh commented 6 years ago

@ogeidix same crash with play-services-gcm:11.4.0. Rooted Device Nexus 5 with Android 4.3

Fatal Exception: java.lang.NullPointerException at com.google.android.gms.gcm.GcmListenerService.handleIntent(Unknown Source) at com.google.firebase.iid.zzc.run(Unknown Source) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573) at java.lang.Thread.run(Thread.java:841)

Robot2037 commented 6 years ago

Same problem here, on rooted device though. Using Play Services 11.6.2.

screen shot 2017-12-08 at 11 12 46

henrikra commented 6 years ago

We are getting this randomly at production too! Looks like it is only on OS version 4.3 and below for us. Looks like many people are having the same problem on 4.3 and below 🤔

java.lang.NullPointerException
    Unknown:-1 com.google.android.gms.gcm.GcmListenerService.handleIntent
    Unknown:-1 com.google.android.gms.iid.zzc.run
    ThreadPoolExecutor.java:1080 java.util.concurrent.ThreadPoolExecutor.runWorker
    ThreadPoolExecutor.java:573 java.util.concurrent.ThreadPoolExecutor$Worker.run
    Thread.java:841 java.lang.Thread.run

image

MattyK14 commented 6 years ago

Also seeing this error from a user on Android 4.3.

henrikra commented 6 years ago

We ended up raising the minimumSdk to 19 so our app does not have Android users 4.3 or below 👼