如何修复: android.app.RemoteServiceException 而没有任何消息(与 Bad Notification 或 Broadcast 无关)

我有一个 android.app. RemoteServiceException (RSE) ,但是没有任何消息。 我得到了以下的谷歌播放控制台崩溃报告。当我得到一个 RSE 由于一个坏的通知或广播,我得到了相关的消息,但在这种情况下,它是一个黑色的崩溃。

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)

我开始主要在安卓7和三星的设备上看到这些崩溃(大体上)。

Android versions and devices

我们遵循通知和广播的标准准则。

targetSdkVersion 25
compileSdkVersion 26

我已经查看了许多与 RemoteServiceException 相关的 StackOverflow 问题,但是没有找到 RCA,因此发布了这个新问题。
下面列出的问题,我已经检查,无法找到一个解决 RSE:

4393 次浏览

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.

if you have started service using startforgroundservice()

then you have to call startforground() in service oncreate by following the google instructions for oreo.