10

My android app got crash report like below.(very rare)

java.lang.RuntimeException: WakeLock under-locked GCM_LIB
    at android.os.PowerManager$WakeLock.release(PowerManager.java:325)
    at android.os.PowerManager$WakeLock.release(PowerManager.java:300)
    at com.google.android.gcm.GCMBaseIntentService.onHandleIntent(GCMBaseIntentService.java:252)

Like java.lang.RuntimeException: WakeLock under-locked C2DM_LIB, I could try~catch or using isHeld()

but I'm not sure this is the best solution and I want to know why this is happening.

Some guess is that BroadcastReceiver and Service in different process like http://groups.google.com/group/cw-android/browse_thread/thread/9716bc101ce72fb4.

But is this even possible? I never used android:process in manifest, so BroadcastReceiver and Service should be in the same(main) process, shouldn't they?

Community
  • 1
  • 1
NoraBora
  • 333
  • 3
  • 8

1 Answers1

3

+NoraBora this is a bug from GCM lib that you included into your project. This bug is still there in r3 version of the gcm.jar

You can find more information in this Issue thread: https://code.google.com/p/android/issues/detail?id=36364#makechanges

As Mark said:

Yup, ran into those with WakefulIntentService. If you're willing to create your own fork of GCMBaseIntentService, wrap the WakeLock release() call in a check of isHeld() to avoid this crash.

StErMi
  • 5,389
  • 5
  • 48
  • 71