Android 地块负数组大小异常

Android Parcel Negative Array Size Exception

我是 Android 编程的新手,当然 Parcelable 概念对我来说也是全新的..我有一个名为 Store 的 Parcelable class。但是当 运行 下面的代码时,我得到了一个负数组大小异常。已经花了几个小时,但无法真正弄清楚问题是什么。请看看下面的代码(我没有把我所有的代码都拿走)请帮忙!

public class Store implements Parcelable {

int id;
String storeAddress;
String storeCategory;
String storeContact;
String storeDescription;
String storeFacebook;
String storeFranchise;
String storeId;
Boolean storeIsActive;
Boolean storeIsSubscribed;
Double storeLatitude;
Double storeLongitude;
byte[] storeLogo;


@Override
public void writeToParcel(Parcel dest, int flags) {
    dest.writeInt(id);
    dest.writeString(storeAddress);
    dest.writeString(storeCategory);
    dest.writeString(storeContact);
    dest.writeString(storeDescription);
    dest.writeString(storeFacebook);
    dest.writeString(storeFranchise);
    dest.writeString(storeId);
    dest.writeInt(storeIsActive ? 1 : 0);
    dest.writeInt(storeIsSubscribed ? 1 : 0);
    dest.writeDouble(storeLatitude);
    dest.writeDouble(storeLongitude);
    dest.writeByteArray(storeLogo);
    dest.writeString(storeName);
    dest.writeString(storeWebSite);
}

public static final Parcelable.Creator<Store> CREATOR = new Parcelable.Creator<Store>() {
    public Store createFromParcel(Parcel in) {
        return new Store(in);
    }

    public Store[] newArray(int size) {
        return new Store[size];
    }
};

private Store(Parcel in) {

    id = in.readInt();
    storeAddress = in.readString();
    storeCategory = in.readString();
    storeContact = in.readString();
    storeDescription = in.readString();
    storeFacebook = in.readString();
    storeFranchise = in.readString();
    storeId = in.readString();
    storeIsActive = in.readInt() > 0;
    storeIsSubscribed = in.readInt() > 0;
    storeLatitude = in.readDouble();
    storeLongitude = in.readDouble();
    storeLogo = new byte[in.readInt()];
    in.readByteArray(storeLogo);
    storeName = in.readString();
    storeWebSite = in.readString();
}

这是调用堆栈。

Caused by: java.lang.NegativeArraySizeException: -1
        at com.testapp.app.Store.<init>(Store.java:97)
        at com.testapp.app.Store.<init>(Store.java:9)
        at com.testapp.app.Store.createFromParcel(Store.java:74)
        at com.testapp.app.Store.createFromParcel(Store.java:72)
        at android.os.Parcel.readParcelable(Parcel.java:2104)
        at android.os.Parcel.readValue(Parcel.java:2013)
        at android.os.Parcel.readListInternal(Parcel.java:2343)
        at android.os.Parcel.readArrayList(Parcel.java:1703)
        at android.os.Parcel.readValue(Parcel.java:2034)
        at android.os.Parcel.readArrayMapInternal(Parcel.java:2314)
        at android.os.Bundle.unparcel(Bundle.java:249)
        at android.os.Bundle.getString(Bundle.java:1118)
        at android.content.Intent.getStringExtra(Intent.java:4624)
        at com.testapp.app.StoresListActivity.onCreate(StoresListActivity.java:27)
        at android.app.Activity.performCreate(Activity.java:5231)
        at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2148)
private Store(Parcel in) {
     id = in.readInt();
     storeAddress = in.readString();
     storeCategory = in.readString();
     storeContact = in.readString();
     storeDescription = in.readString();
     storeFacebook = in.readString();
     storeFranchise = in.readString(); 
     storeId = in.readString(); 
     storeIsActive = in.readInt() > 0;     
     storeIsSubscribed = in.readInt() > 0;
     storeLatitude = in.readDouble();
     storeLongitude = in.readDouble();
     storeLogo =  in.readByteArray(); 
     storeName = in.readString();
     storeWebSite = in.readString();
 }