DroidKaigi / conference-app-2017

The Official Conference App for DroidKaigi 2017 Tokyo
Apache License 2.0
470 stars 140 forks source link

App causes a crash when resuming MainActivity with `Don't keep activities` #110

Open jmatsu opened 7 years ago

jmatsu commented 7 years ago

Overview (Required)

Links

Screenshot

02-06 18:53:13.214 7824-7824/io.github.droidkaigi.confsched2017.develop.debug E/AndroidRuntime: FATAL EXCEPTION: main
    Process: io.github.droidkaigi.confsched2017.develop.debug, PID: 7824
    java.lang.RuntimeException: Unable to start activity ComponentInfo{io.github.droidkaigi.confsched2017.develop.debug/io.github.droidkaigi.confsched2017.view.activity.MainActivity}: java.lang.ArrayIndexOutOfBoundsException: src.length=11 srcPos=0 dst.length=0 dstPos=0 length=11
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2416)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476)
        at android.app.ActivityThread.-wrap11(ActivityThread.java)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344)
        at android.os.Handler.dispatchMessage(Handler.java:102)
        at android.os.Looper.loop(Looper.java:148)
        at android.app.ActivityThread.main(ActivityThread.java:5417)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
     Caused by: java.lang.ArrayIndexOutOfBoundsException: src.length=11 srcPos=0 dst.length=0 dstPos=0 length=11
        at java.lang.System.arraycopy(Native Method)
        at org.lucasr.twowayview.widget.ItemEntries.ensureSize(ItemEntries.java:56)
        at org.lucasr.twowayview.widget.ItemEntries.putItemEntry(ItemEntries.java:70)
        at org.lucasr.twowayview.widget.BaseLayoutManager$LanedSavedState.<init>(BaseLayoutManager.java:597)
        at org.lucasr.twowayview.widget.BaseLayoutManager$LanedSavedState.<init>(BaseLayoutManager.java:566)
        at org.lucasr.twowayview.widget.BaseLayoutManager$LanedSavedState$1.createFromParcel(BaseLayoutManager.java:628)
        at org.lucasr.twowayview.widget.BaseLayoutManager$LanedSavedState$1.createFromParcel(BaseLayoutManager.java:625)
        at android.os.Parcel.readParcelable(Parcel.java:2367)
        at android.support.v7.widget.RecyclerView$SavedState.<init>(RecyclerView.java:11129)
        at android.support.v7.widget.RecyclerView$SavedState$1.createFromParcel(RecyclerView.java:11154)
        at android.support.v7.widget.RecyclerView$SavedState$1.createFromParcel(RecyclerView.java:11151)
        at android.support.v4.os.ParcelableCompatCreatorHoneycombMR2.createFromParcel(ParcelableCompatHoneycombMR2.java:46)
        at android.os.Parcel.readParcelable(Parcel.java:2365)
        at android.os.Parcel.readValue(Parcel.java:2264)
        at android.os.Parcel.readSparseArrayInternal(Parcel.java:2675)
        at android.os.Parcel.readSparseArray(Parcel.java:1967)
        at android.os.Parcel.readValue(Parcel.java:2321)
        at android.os.Parcel.readArrayMapInternal(Parcel.java:2614)
        at android.os.BaseBundle.unparcel(BaseBundle.java:221)
        at android.os.Bundle.getSparseParcelableArray(Bundle.java:856)
        at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1207)
        at android.support.v4.app.FragmentManagerImpl.moveFragmentToExpectedState(FragmentManager.java:1523)
        at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1585)
        at android.support.v4.app.FragmentManagerImpl.dispatchCreate(FragmentManager.java:2827)
        at android.support.v4.app.FragmentController.dispatchCreate(FragmentController.java:190)
        at android.support.v4.app.FragmentActivity.onCreate(FragmentActivity.java:353)
        at android.support.v7.app.AppCompatActivity.onCreate(AppCompatActivity.java:88)
        at io.github.droidkaigi.confsched2017.view.activity.MainActivity.onCreate(MainActivity.java:39)
        at android.app.Activity.performCreate(Activity.java:6251)
        at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1107)
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2369)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476) 
        at android.app.ActivityThread.-wrap11(ActivityThread.java) 
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344) 
        at android.os.Handler.dispatchMessage(Handler.java:102) 
        at android.os.Looper.loop(Looper.java:148) 
        at android.app.ActivityThread.main(ActivityThread.java:5417) 
        at java.lang.reflect.Method.invoke(Native Method) 
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726) 
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616) 
jmatsu commented 7 years ago

Ah sorry, I enabled Don't keep activities. Let me modify the description and title... Anyway, it's easy to replicate this problem when enabling this option.

konifar commented 7 years ago

Thanks! It's good way to debug strictly 😄

ghost commented 7 years ago

Hello. This is library bug. A Array of ItemEntry is set 0 in length by mAdapterSize(=0) when ensuring array size in restoring state.

see code

twoway-view, this library has not been maintained anymore.