在项目中添加EventBus3.1.0-RC,编译ok的,但是运行的时候出现了java.lang.NoClassDefFoundError:
android/os/PersistableBundle at java.lang.Class.getDeclaredMethods(Native Method)这个错误。。。
总结如下:
这个问题是因为你的自定义Activity重写了
@Override
public void onCreate(@Nullable Bundle savedInstanceState, @Nullable PersistableBundle persistentState) {
super.onCreate(savedInstanceState, persistentState);
}
或者
@Override
public void onRestoreInstanceState(Bundle savedInstanceState, PersistableBundle persistentState) {
super.onRestoreInstanceState(savedInstanceState, persistentState);
}
这两个方法中的任意一个都会出现这个错误,所以解决办法是不要重写这两个方法。原因还有待我去深究下。