Reputation: 3646
I have an application on the Play Store, which I update regularly with android tools update and dependencies update but that's it. I just ensure it compile and work with the latest Android platform and support libraries.
I don't add any features or anything.
Recently I've been received a lot of crash on ActivityThread.java with the message:
Fatal Exception: android.app.RemoteServiceException
Bad notification posted from package xxx.xxx.xxx: Couldn't create icon: StatusBarIcon(pkg=gxxx.xxx.xxxsuser=0 id=0x7f03002d level=0 visible=true num=0 )
My application do receive notification, I use the intercom SDK for that, which is registered like so
Intercom.client().setupGCM(token, R.mipmap.notification_icon);
Basically I don't intercept the notification myself, I just use an AsyncTask to request the GCM token and that's it.
Now it appears that every time the production app receive notifications, it silently fail to create the notification and crash the app, as per the report I got.
Prior to an Android 3.0 and compileSDK 26 build, I didn't had this issue. I didn't change nor the code which handle notifications, nor the Intercom SDK version.
Did I mention I can't myself replicate the issue, with both a debug and production build on my phone, I can receive notification just fine.
But I got a lot of those crashes in the wild like a lot. As you can except when thousands of notifications are sent to the same app.
But it seems to be concentrated on Samsung phone with Android 7. But not only.
I guess and I hope I'm not the only one having this issue, I bet there is something that have changed in the APK generation or the support libraries I'm not aware of. If you have any clues, it would be welcome.
Upvotes: 1
Views: 1410
Reputation: 19
AS 3.0 uses new gradle version. In my app I have the same issue. It's caused by new resource IDs. If you compare R.java files, generated by different gradle versions, you can see that same resources have different IDs. In my case, I use DevToDev SDK to receive push messages. I initialize SDK and pass resources used in notifications in MainActivity, obviously, if user will not start app after update, there will be old IDs for recources used in notification. This causes app to crash. I haven't solved my issue yet, the only way I can offer you to solve it is to use BroadcastReceiver to catch app update event
<receiver android:name=".AppUpdateBroadcastReceiver" android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MY_PACKAGE_REPLACED"/>
</intent-filter>
</receiver>
and to initialize your SDK there.
If you want to replacate this issue, you can try to do these steps:
Upvotes: 1