inloop / easygcm

Android Library for easy GCM integration in few lines of code.
Apache License 2.0
261 stars 43 forks source link

Unable to start receiver com.google.android.gms.gcm.GcmReceiver: java.lang.SecurityException #72

Open mrkcsc opened 8 years ago

mrkcsc commented 8 years ago

Hello,

Thank you for for this easy to use and helpful library!

My issue is that I am seeing this exception in my error logs for a small subset of my users (ongoing) and I can't figure out why. GCM messages are successfully received in the vast majority of cases so I suspect this must be some sort of esoteric configuration oddity that only hits a small subset of devices. The most common OS version this error is hit on is 4.4.4 (and a few 6.0+ devices).

I am using the latest version of the library.

java.lang.RuntimeException: Unable to start receiver com.google.android.gms.gcm.GcmReceiver: java.lang.SecurityException: Not allowed to start service Intent { act=com.google.android.c2dm.intent.RECEIVE flg=0x10 pkg=com.discord (has extras) } without permission not exported from uid 10008
        at android.app.ActivityThread.handleReceiver(ActivityThread.java:2580)
        at de.robv.android.xposed.XposedBridge.invokeOriginalMethodNative(XposedBridge.java:-2)
        at de.robv.android.xposed.XposedBridge.handleHookedMethod(XposedBridge.java:631)
        at android.app.ActivityThread.handleReceiver(ActivityThread.java:-2)
        at android.app.ActivityThread.access$1700(ActivityThread.java:151)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1397)
        at android.os.Handler.dispatchMessage(Handler.java:110)
        at android.os.Looper.loop(Looper.java:193)
        at android.app.ActivityThread.main(ActivityThread.java:5292)
        at java.lang.reflect.Method.invokeNative(Method.java:-2)
        at java.lang.reflect.Method.invoke(Method.java:515)
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:824)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:640)
        at de.robv.android.xposed.XposedBridge.main(XposedBridge.java:132)
        at dalvik.system.NativeStart.main(NativeStart.java:-2)
Caused by: java.lang.SecurityException: Not allowed to start service Intent { act=com.google.android.c2dm.intent.RECEIVE flg=0x10 pkg=com.discord (has extras) } without permission not exported from uid 10008
        at android.app.ContextImpl.startServiceCommon(ContextImpl.java:1599)
        at android.app.ContextImpl.startService(ContextImpl.java:1576)
        at android.content.ContextWrapper.startService(ContextWrapper.java:494)
        at android.content.ContextWrapper.startService(ContextWrapper.java:494)
        at android.support.v4.content.WakefulBroadcastReceiver.startWakefulService(WakefulBroadcastReceiver.java:89)
        at com.google.android.gms.gcm.GcmReceiver.zzi(Unknown:-1)
        at com.google.android.gms.gcm.GcmReceiver.onReceive(Unknown:-1)
        at android.app.ActivityThread.handleReceiver(ActivityThread.java:2573)
        at de.robv.android.xposed.XposedBridge.invokeOriginalMethodNative(XposedBridge.java:-2)
        at de.robv.android.xposed.XposedBridge.handleHookedMethod(XposedBridge.java:631)
        at android.app.ActivityThread.handleReceiver(ActivityThread.java:-2)
        at android.app.ActivityThread.access$1700(ActivityThread.java:151)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1397)
        at android.os.Handler.dispatchMessage(Handler.java:110)
        at android.os.Looper.loop(Looper.java:193)
        at android.app.ActivityThread.main(ActivityThread.java:5292)
        at java.lang.reflect.Method.invokeNative(Method.java:-2)
        at java.lang.reflect.Method.invoke(Method.java:515)
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:824)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:640)
        at de.robv.android.xposed.XposedBridge.main(XposedBridge.java:132)
        at dalvik.system.NativeStart.main(NativeStart.java:-2)

Any suggestions would be very helpful.

I did find this answer which suggests using the application package for the permission.RECEIVE tag (dubious) http://stackoverflow.com/questions/10315455/not-allowed-to-start-service-intent-x-without-permission-y but otherwise the final merged manifest appears to be correct.

Epholl commented 8 years ago

Hello mrkcsc. Unfortunately, I do not know what the cause here is, but I have encountered the exact same problem with another application (that does actually not use easygcm) and I will be looking into the cause in the near future. If you have any news on the problem, please feel free to keep me informed.

mrkcsc commented 8 years ago

Thanks Epholl,

I'll be doing some additional digging myself (most of the problem devices seem to not be US based phones, going to try to order one for testing).

If I get any more information about the crash I will keep you updated.