您的位置:首页 > 移动开发 > Android开发

java.lang.ClassNotFoundException: Didn't find class "android.os.PersistableBundle" on path: DexPathL

2016-03-18 11:19 1116 查看
导致问题的原因有很多,所以解决办法不一样。

1移除Activity中的这个方法

@Override
public void onSaveInstanceState(Bundle outState, PersistableBundle outPersistentState) {
super.onSaveInstanceState(outState, outPersistentState);
}


2或者替换1中的代码段

@Override
public void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
}


3我出现的问题原因很奇怪:

问题还原,在fragment中用bundle传值,贴代码如下

xml

<TextView
android:id="@+id/tvEntryRoomBtn"
android:layout_width="@dimen/dimen_0dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="1"
android:gravity="center"
android:clickable="true"
android:onClick="entryRoom"
android:text="进入房间"
android:textColor="@color/tv_white"
android:textSize="24px" />


fragment

void entryRoom() {
//进入到群组
if (augur != null) {
roomID1 = augur.getRoomID1();
roomID2 = augur.getRoomID2();
new Thread(new Runnable() {
@Override
public void run() {
try {
EMGroupManager.getInstance().joinGroup(roomID1);//需异步处理
EMGroupManager.getInstance().joinGroup(roomID2);//需异步处理
EMChat.getInstance().setAppInited();
mycontext.log(roomID1 + "  1加入的公开群" + roomID2 + " 2加入的公开群" + "augurId:" + augur.getObjectId());
} catch (EaseMobException e) {
e.printStackTrace();
}
}
}).start();
Intent intent = new Intent(mycontext, ChatContainerActivity.class);
Bundle bundle = new Bundle();
bundle.putSerializable(ConstantInfo.AUGUR_CHATROOM, augur);
intent.putExtra("bundle", bundle);
mycontext.startActivity(intent);
}

}


我的问题出在,我在xml文件中,写了 android:onClick=”entryRoom” 这句代码。

然后我很天真的给fragment中的控件加上了onClick事件,然而这样并不好用。

不建议大家直接在fragment中直接通过xml为控件设置onClick=”” 方法。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: