这是堆栈跟踪。
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.shakti.mathssolver/com.mathssolver.pstrip.MainActivity}: java.lang.RuntimeException: Parcel android.os.Parcel@4215dec0: Unmarshalling unknown type code 7733356 at offset 24
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2209)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2269)
at android.app.ActivityThread.access$800(ActivityThread.java:139)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1210)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5102)
at java.lang.reflect.Method.invokeNative(Method.java)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
at dalvik.system.NativeStart.main(NativeStart.java)
Caused by: java.lang.RuntimeException: Parcel android.os.Parcel@4215dec0: Unmarshalling unknown type code 7733356 at offset 24
at android.os.Parcel.readValue(Parcel.java:2080)
at android.os.Parcel.readArrayMapInternal(Parcel.java:2313)
at android.os.Bundle.unparcel(Bundle.java:249)
at android.os.Bundle.getSparseParcelableArray(Bundle.java:1275)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:881)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1126)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1108)
at android.support.v4.app.FragmentManagerImpl.dispatchCreate(FragmentManager.java:1912)
at android.support.v4.app.FragmentActivity.onCreate(FragmentActivity.java:266)
at android.support.v7.app.ActionBarActivity.onCreate(ActionBarActivity.java:122)
at com.google.analyticscode.MyTrackerActivity.onCreate(MyTrackerActivity.java:21)
at com.google.billing.BillingHandlerLayerActivity.onCreate(BillingHandlerLayerActivity.java:36)
at com.mathssolver.pstrip.BaseSampleActivity.onCreate(BaseSampleActivity.java:164)
at com.mathssolver.pstrip.MainActivity.onCreate(MainActivity.java:96)
at android.app.Activity.performCreate(Activity.java:5248)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1110)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2173)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2269)
at android.app.ActivityThread.access$800(ActivityThread.java:139)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1210)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5102)
at java.lang.reflect.Method.invokeNative(Method.java)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
at dalvik.system.NativeStart.main(NativeStart.java)
这是我正在使用的Parcelable之一
public class QuesSolnInfo implements Parcelable {
private String strValue;
private Integer intValue;
public String ques;
public String ans;
public Bitmap ans_b;
/**
* Standard basic constructor for non-parcel
* object creation
*/
public QuesSolnInfo() { ; }
public QuesSolnInfo(String ques, String ans, Bitmap ans_b) {
this.ques = ques;
this.ans = ans;
this.ans_b = ans_b;
}
/**
*
* Constructor to use when re-constructing object
* from a parcel
*
* @param in a parcel from which to read this object
*/
public QuesSolnInfo(Parcel in) {
readFromParcel(in);
}
/**
* standard getter
*
* @return strValue
*/
public String getStrValue() {
return strValue;
}
/**
* Standard setter
*
* @param strValue
*/
public void setStrValue(String strValue) {
this.strValue = strValue;
}
/**
* standard getter
*
* @return
*/
public Integer getIntValue() {
return intValue;
}
/**
* Standard setter
*
* @param intValue
*/
public void setIntValue(Integer intValue) {
this.intValue = intValue;
}
@Override
public int describeContents() {
return 0;
}
@Override
public void writeToParcel(Parcel dest, int flags) {
if(ans_b == null || ques == null)
return;
// We just need to write each field into the
// parcel. When we read from parcel, they
// will come back in the same order
ans_b.writeToParcel(dest, 0);
dest.writeString(ques);
//dest.writeString(ans);
}
/**
*
* Called from the constructor to create this
* object from a parcel.
*
* @param in parcel from which to re-create object
*/
private void readFromParcel(Parcel in) {
// We just need to read back each
// field in the order that it was
// written to the parcel
in.setDataPosition(0);
try {
ans_b = Bitmap.CREATOR.createFromParcel(in);
ques = in.readString();
} catch (Exception e) { // TODO: handle exception
ans_b = null;
ques = null;
}
//ans = in.readString();
}
/**
*
* This field is needed for Android to be able to
* create new objects, individually or as arrays.
*
* This also means that you can use use the default
* constructor to create the object and use another
* method to hyrdate it as necessary.
*
* I just find it easier to use the constructor.
* It makes sense for the way my brain thinks ;-)
*
*/
public static final Parcelable.Creator CREATOR = new Parcelable.Creator() {
public QuesSolnInfo createFromParcel(Parcel in) {
return new QuesSolnInfo(in);
}
public QuesSolnInfo[] newArray(int size) {
return new QuesSolnInfo[size];
}
};
}
我的proguard文件中还有以下行,如其他问题中的其他类似问题的建议
-keepclassmembers class * implements android.os.Parcelable {
static ** CREATOR;
}