Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unexpected problem when unmounting #82

Open
wellguimaraes opened this issue Sep 19, 2016 · 1 comment
Open

Unexpected problem when unmounting #82

wellguimaraes opened this issue Sep 19, 2016 · 1 comment

Comments

@wellguimaraes
Copy link

I've got this error reported from an app in production and it seems that it tried to remove view more than once. Maybe a simple try/catch on L138 would solve with no side effects.

Fatal Exception: java.lang.IllegalArgumentException
The observer is null.

android.database.Observable.unregisterObserver (Observable.java:64)
android.widget.BaseAdapter.unregisterDataSetObserver (BaseAdapter.java:42)
android.widget.AbsListView.onDetachedFromWindow (AbsListView.java:2668)
android.view.View.dispatchDetachedFromWindow (View.java:12024)
android.view.ViewGroup.dispatchDetachedFromWindow (ViewGroup.java:2612)
android.view.ViewGroup.dispatchDetachedFromWindow (ViewGroup.java:2610)
android.view.ViewGroup.removeViewsInternal (ViewGroup.java:3792)
android.view.ViewGroup.removeViews (ViewGroup.java:3674)
trikita.anvil.Anvil.unmount (Anvil.java:138)

@helgoboss
Copy link

I have a very similar Anvil issue after switching from Android SDK 23 to 25. When unmounting a RecyclerView, a NullPointerException is thrown. Because the RecyclerView was already detached from the window once and Anvil tries to detach it again.

First stack trace:

at android.support.v7.widget.RecyclerView.onDetachedFromWindow(RecyclerView.java:2479)
at android.view.View.dispatchDetachedFromWindow(View.java:14573)
at android.view.ViewGroup.dispatchDetachedFromWindow(ViewGroup.java:3073)
at android.view.ViewGroup.dispatchDetachedFromWindow(ViewGroup.java:3065)
at android.view.ViewGroup.dispatchDetachedFromWindow(ViewGroup.java:3065)
at android.view.ViewGroup.removeViewInternal(ViewGroup.java:4605)
at android.view.ViewGroup.removeViewInternal(ViewGroup.java:4578)
at android.view.ViewGroup.removeView(ViewGroup.java:4509)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1406)
at android.support.v4.app.FragmentManagerImpl.moveFragmentToExpectedState(FragmentManager.java:1523)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1598)
at android.support.v4.app.FragmentManagerImpl.executeOpsTogether(FragmentManager.java:2145)
at android.support.v4.app.FragmentManagerImpl.optimizeAndExecuteOps(FragmentManager.java:2092)
at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1998)
at android.support.v4.app.FragmentManagerImpl$1.run(FragmentManager.java:709)
at android.os.Handler.handleCallback(Handler.java:745)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:171)
at android.app.ActivityThread.main(ActivityThread.java:5454)
at java.lang.reflect.Method.invoke(Method.java:-1)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)

Second stack trace (causing the exception):

  at android.support.v7.widget.RecyclerView.onDetachedFromWindow(RecyclerView.java:2479)
  at android.view.View.dispatchDetachedFromWindow(View.java:14573)
  at android.view.ViewGroup.dispatchDetachedFromWindow(ViewGroup.java:3073)
  at android.view.ViewGroup.dispatchDetachedFromWindow(ViewGroup.java:3065)
  at android.view.ViewGroup.removeViewsInternal(ViewGroup.java:4706)
  at android.view.ViewGroup.removeViews(ViewGroup.java:4570)
  at trikita.anvil.Anvil.unmount(Anvil.java:138)
  at trikita.anvil.RenderableView.onDetachedFromWindow(RenderableView.java:33)
  at android.view.View.dispatchDetachedFromWindow(View.java:14573)
  at android.view.ViewGroup.dispatchDetachedFromWindow(ViewGroup.java:3073)
  at android.view.ViewGroup.removeViewInternal(ViewGroup.java:4605)
  at android.view.ViewGroup.removeViewInternal(ViewGroup.java:4578)
  at android.view.ViewGroup.removeView(ViewGroup.java:4509)
  at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1406)
  at android.support.v4.app.FragmentManagerImpl.moveFragmentToExpectedState(FragmentManager.java:1523)
  at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1598)
  at android.support.v4.app.FragmentManagerImpl.executeOpsTogether(FragmentManager.java:2145)
  at android.support.v4.app.FragmentManagerImpl.optimizeAndExecuteOps(FragmentManager.java:2092)
  at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1998)
  at android.support.v4.app.FragmentManagerImpl$1.run(FragmentManager.java:709)
  at android.os.Handler.handleCallback(Handler.java:745)
  at android.os.Handler.dispatchMessage(Handler.java:95)
  at android.os.Looper.loop(Looper.java:171)
  at android.app.ActivityThread.main(ActivityThread.java:5454)
  at java.lang.reflect.Method.invoke(Method.java:-1)
  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)

Seems like Android itself takes care of removing the Anvil views and Anvil tries to do it a second time. Not sure what would be the cleanest solution here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants