arimorty / floatingsearchview

A search view that implements a floating search bar also known as persistent search
https://github.com/arimorty/floatingsearchview/blob/master/README.md
Apache License 2.0
3.54k stars 667 forks source link

SearchView crashes when the activity is restored #32

Closed jakubkrolewski closed 8 years ago

jakubkrolewski commented 8 years ago
  1. Turn on the developer option "don't keep activities"
  2. Open the demo app
  3. Type "a"
  4. Press the home key to return to the home screen
  5. Go back to the demo app

The app crashes:

Process: com.arlib.floatingsearchviewdemo, PID: 31704 java.lang.RuntimeException: Unable to start activity ComponentInfo{com.arlib.floatingsearchviewdemo/com.arlib.floatingsearchviewdemo.MainActivity}: java.lang.RuntimeException: Parcel android.os.Parcel@de9ab18: Unmarshalling unknown type code 6619246 at offset 972 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.RuntimeException: Parcel android.os.Parcel@de9ab18: Unmarshalling unknown type code 6619246 at offset 972 at android.os.Parcel.readValue(Parcel.java:2340) 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 com.android.internal.policy.PhoneWindow.restoreHierarchyState(PhoneWindow.java:2033) at android.app.Activity.onRestoreInstanceState(Activity.java:1008) at android.app.Activity.performRestoreInstanceState(Activity.java:963) at android.app.Instrumentation.callActivityOnRestoreInstanceState(Instrumentation.java:1163) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2389) 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) 

ernestkamara commented 8 years ago

I am experiencing this same crash in my app using the steps above by @jakubkrolewski . Said to have been fix in #41 but still an issue.

Fatal Exception: java.lang.RuntimeException: Unable to start activity ComponentInfo{net.zedge.snakk/net.zedge.snakk.activity.ControllerActivity}: java.lang.RuntimeException: Parcel android.os.Parcel@4840c41: Unmarshalling unknown type code 7536672 at offset 3908 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:5422) at java.lang.reflect.Method.invoke(Method.java) 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.RuntimeException: Parcel android.os.Parcel@4840c41: Unmarshalling unknown type code 7536672 at offset 3908 at android.os.Parcel.readValue(Parcel.java:2340) 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:997) at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1252) at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1234) at android.support.v4.app.FragmentManagerImpl.dispatchCreate(FragmentManager.java:2041) at android.support.v4.app.FragmentController.dispatchCreate(FragmentController.java:163) at android.support.v4.app.FragmentActivity.onCreate(FragmentActivity.java:332) at android.support.v7.app.AppCompatActivity.onCreate(AppCompatActivity.java:84) at net.zedge.snakk.activity.ControllerActivity.onCreate(ControllerActivity.java:66) 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:5422) at java.lang.reflect.Method.invoke(Method.java) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)

bartoszostrowski commented 8 years ago

I am also experiencing the same problem. Do you know when the fix will be available via Gradle?

ernestkamara commented 8 years ago

I have a working in progress Gradle version of this library, You need to build the library and export the aar file to your project.

Here are the quick-fix configuration that work for me:

You would have to add these dependencies to your project, since minifyEnabled is set to true.

compile('com.arlib:floatingsearchview:[filename]@aar')
compile 'com.bartoszlipinski:viewpropertyobjectanimator:1.4.5'

Add these to your ProGuard rules file

-keep class com.arlib.** { *; }
-keep interface com.arlib.** { *;}
-keep class com.bartoszlipinski.** { *; }

I will update my fork when i have time. Hope to move these configuration over to the library and update the Readme file.

Good luck!

bartoszostrowski commented 8 years ago

Thank you! Problem solved:)

ernestkamara commented 8 years ago

Am glad to help :)

arimorty commented 8 years ago

Fix will be merged into version 2.2.0 Thanks

drjunior commented 8 years ago

Waiting for this fix. I've users complaining about this crash. Thanks for your welcome support Ari. Cheers.

arimorty commented 8 years ago

Have a look at the new release, it should fix this problem. Let me know if it fixed it or not.

Thanks,

drjunior commented 8 years ago

Yes it fixed the problem. Thanks Ari.