升级Parse Android SDK后,使用PushServiceApi26.run进行IllegalArgumentException

时间:2018-03-08 08:46:44

标签: android illegalargumentexception

我在Android> = 8.0(奥利奥)的所有用户的开发者控制台中反复出现崩溃。它在将Parse从1.15.8升级到1.16.3之后开始发生。

enter image description here

没有太多信息,我试图检查theoricDt <- structure(list(firstDate = structure(c(1483228800, 1483574400, 1485907200), class = c("POSIXct", "POSIXt"), tzone = "GMT"), lastDate = structure(c(1483401600, 1485302400, 1504137600 ), class = c("POSIXct", "POSIXt"), tzone = "GMT"), theoric = c(10, 20, 30)), .Names = c("firstDate", "lastDate", "theoric"), row.names = c(NA, -3L), class = c("data.table", "data.frame")) measureDt <- structure(list(datetime = structure(c(1483315200, 1483833600, 1483920000, 1485388800, 1488412800), class = c("POSIXct", "POSIXt"), tzone = "GMT"), measured = c(11, 22, 19, 25, 32)), .Names = c("datetime", "measured"), row.names = c(NA, -5L), class = c("data.table","data.frame")) 触发的代码。它实际上是有意义的,这是Parse 1.16.x版本的IllegalArgumentException代码:

GcmBroadcastReceiver's onReceive()

@Override @CallSuper public void onReceive(Context context, Intent intent) { PushServiceUtils.runService(context, intent); } // In Parse 1.15.8, onReceive was instead calling // ServiceUtils.runWakefulIntentInService(context, intent, PushService.class);

PushServiceUtils

虽然我设法找到错误发生的地方,但我对Android(尤其是推送通知)的了解不足以了解发生了什么。在清单中,相关部分:

public static boolean runService(Context context, @NonNull Intent intent) {
    if (USE_JOBS) { // USE_JOBS : Android SDK >= 8.0 (Oreo)
        return PushServiceApi26.run(context, intent);
    } else {
        return PushService.run(context, intent);
    }
}

但是,我仍然无法找到造成这种情况的原因。任何帮助将不胜感激!

1 个答案:

答案 0 :(得分:0)

我设法通过在奥利奥的设备上重现问题来找到解决方案。堆栈跟踪中的错误更精确:

  

Android java.lang.IllegalArgumentException:没有此类服务

然后我得到了this post的解决方案。

我只需要在清单中添加它:

<service android:name="com.parse.PushServiceApi26"
        android:permission="android.permission.BIND_JOB_SERVICE"
        android:exported="true"/>