How to fix: android.app.RemoteServiceException without any message (not related to Bad Notification or Broadcast)
AndroidCrashAndroid 7.0-NougatRemoteserviceexceptionAndroid Problem Overview
I have an android.app.RemoteServiceException (RSE) but without any message. I get the following crash report on Google Play Console. When I get a RSE due to a bad Notification or Broadcast I get the related message but in this case it is a black crash.
android.app.RemoteServiceException:
at android.app.ActivityThread$H.handleMessage (ActivityThread.java:1813)
at android.os.Handler.dispatchMessage (Handler.java:102)
at android.os.Looper.loop (Looper.java:154)
at android.app.ActivityThread.main (ActivityThread.java:6781)
at java.lang.reflect.Method.invoke (Method.java)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run (ZygoteInit.java:1520)
at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1410)
I started getting these crashes primarily on Android 7 and Samsung devices (in large).
We are following standard guidelines for Notifications and Broadcasts.
targetSdkVersion 25
compileSdkVersion 26
I have gone through many StackOverflow questions related to RemoteServiceException but not been able to find RCA hence posting the new question.
Listed below are the questions I have checked and not been able to find a resolution for RSE:
- https://stackoverflow.com/questions/25317659/how-to-fix-android-app-remoteserviceexception-bad-notification-posted-from-pac
- https://stackoverflow.com/questions/10607097/how-to-add-vertical-line-to-remoteview-for-custom-android-notifications
- https://stackoverflow.com/questions/24968556/how-to-fix-this-bug-android-app-remoteserviceexception-bad-notification-post
- https://stackoverflow.com/questions/48124458/fcm-how-to-fix-android-app-remoteserviceexception-bad-notification-posted-fro
- https://stackoverflow.com/questions/40175713/android-getting-cant-deliver-broadcast-error-on-dynamically-registered-broa
- https://stackoverflow.com/questions/46971153/fatal-exception-android-app-remoteserviceexception-cant-deliver-broadcast-at
Android Solutions
Solution 1 - Android
if you have started service using startforgroundservice()
then you have to call startforground() in service oncreate by following the google instructions for oreo.
Solution 2 - Android
It might be very late, but do you have content providers in your app? If they are, are they properly declared in the manifest? I saw ActivityThread class code for API 26. The line where the error happens is 1813.
case INSTALL_PROVIDER:
handleInstallProvider((ProviderInfo) msg.obj);
break;
Following the code shows that the app is not able to publish the content provider and crashing there.
try {
ActivityManager.getService().publishContentProviders(
getApplicationThread(), results);
} catch (RemoteException ex) {
throw ex.rethrowFromSystemServer();
}
Late!! but might help others to debug their case.