Crashlytics reporting multiples issues for TextView.makeSingleLayout - android

I am receiving multiples crash reports about the same error, but I have no idea what is may causing it.
The exception that is throwing is ArrayIndexOutOfBoundsException in android.widget.TextView.makeSingleLayout.
I know it is not about Android versions and devices types, since it is getting reports from multiple versions and devices.
Here is what I am getting from Crashlytics:
Fatal Exception: java.lang.ArrayIndexOutOfBoundsException: length=125; index=-1
at android.text.StaticLayout.calculateEllipsis(StaticLayout.java:785)
at android.text.StaticLayout.out(StaticLayout.java:704)
at android.text.StaticLayout.generate(StaticLayout.java:410)
at android.text.StaticLayout.<init>(StaticLayout.java:140)
at android.widget.TextView.makeSingleLayout(TextView.java:6199)
at android.widget.TextView.makeNewLayout(TextView.java:6056)
at android.widget.TextView.onMeasure(TextView.java:6432)
at android.view.View.measure(View.java:16653)
at android.widget.LinearLayout.measureHorizontal(LinearLayout.java:1231)
at android.widget.LinearLayout.onMeasure(LinearLayout.java:590)
at android.view.View.measure(View.java:16653)
at android.widget.ListView.setupChild(ListView.java:1870)
at android.widget.ListView.makeAndAddView(ListView.java:1793)
at android.widget.ListView.fillDown(ListView.java:691)
at android.widget.ListView.fillFromTop(ListView.java:752)
at android.widget.ListView.layoutChildren(ListView.java:1616)
at android.widget.AbsListView.onLayout(AbsListView.java:2087)
at android.view.View.layout(View.java:14973)
at android.view.ViewGroup.layout(ViewGroup.java:4637)
at android.support.v4.widget.SwipeRefreshLayout.onLayout(SwipeRefreshLayout.java:636)
at android.view.View.layout(View.java:14973)
at android.view.ViewGroup.layout(ViewGroup.java:4637)
at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1671)
at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1525)
at android.widget.LinearLayout.onLayout(LinearLayout.java:1434)
at android.view.View.layout(View.java:14973)
at android.view.ViewGroup.layout(ViewGroup.java:4637)
at android.support.design.widget.CoordinatorLayout.layoutChild(CoordinatorLayout.java:1167)
at android.support.design.widget.CoordinatorLayout.onLayoutChild(CoordinatorLayout.java:852)
at android.support.design.widget.CoordinatorLayout.onLayout(CoordinatorLayout.java:871)
at android.view.View.layout(View.java:14973)
at android.view.ViewGroup.layout(ViewGroup.java:4637)
at android.widget.FrameLayout.layoutChildren(FrameLayout.java:453)
at android.widget.FrameLayout.onLayout(FrameLayout.java:388)
at android.view.View.layout(View.java:14973)
at android.view.ViewGroup.layout(ViewGroup.java:4637)
at android.support.v7.widget.ActionBarOverlayLayout.onLayout(ActionBarOverlayLayout.java:437)
at android.view.View.layout(View.java:14973)
at android.view.ViewGroup.layout(ViewGroup.java:4637)
at android.widget.FrameLayout.layoutChildren(FrameLayout.java:453)
at android.widget.FrameLayout.onLayout(FrameLayout.java:388)
at android.view.View.layout(View.java:14973)
at android.view.ViewGroup.layout(ViewGroup.java:4637)
at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1671)
at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1525)
at android.widget.LinearLayout.onLayout(LinearLayout.java:1434)
at android.view.View.layout(View.java:14973)
at android.view.ViewGroup.layout(ViewGroup.java:4637)
at android.widget.FrameLayout.layoutChildren(FrameLayout.java:453)
at android.widget.FrameLayout.onLayout(FrameLayout.java:388)
at android.view.View.layout(View.java:14973)
at android.view.ViewGroup.layout(ViewGroup.java:4637)
at android.view.ViewRootImpl.performLayout(ViewRootImpl.java:1995)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1752)
at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1008)
at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:5717)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:761)
at android.view.Choreographer.doCallbacks(Choreographer.java:574)
at android.view.Choreographer.doFrame(Choreographer.java:544)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:747)
at android.os.Handler.handleCallback(Handler.java:733)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5127)
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:825)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:641)
at dalvik.system.NativeStart.main(NativeStart.java)
Is there any solution for that?
I do not write a explicit implementation for TextView.makeSingleLayout.

It has been almost a year, so my memory on this is a little fuzzy, but...
I faced what I suspect is the same problem in my own app. For me, it was happening because I was using android:ellipsize="start" without also using android:singleLine="true".
We had switched all of our android:singleLine="true" attributes to the recommended android:maxLines="1", but it turns out that there's a bug in how the system calculates the ellipsis that is triggered if singleLine isn't present.
So I believe you can solve this issue by simply adding android:singleLine="true" to your TextViews that are using ellipsize attrs.

Related

RecyclerView Error when remove last item in list

I have problem with my recyclerview. I have function that remove item in list.
When last item didn't showing, it had work fine. But when last item did showing in the end of screen (list), i got error after excute remove item from list.
This my logcat:
java.lang.IllegalArgumentException: Scrapped or attached views may not be recycled. isScrap:false isAttached:true
at android.support.v7.widget.RecyclerView$Recycler.recycleViewHolderInternal(RecyclerView.java:5778)
at android.support.v7.widget.RecyclerView$Recycler.quickRecycleScrapView(RecyclerView.java:5885)
at android.support.v7.widget.RecyclerView$LayoutManager.removeAndRecycleScrapInt(RecyclerView.java:8547)
at android.support.v7.widget.RecyclerView.dispatchLayoutStep3(RecyclerView.java:3698)
at android.support.v7.widget.RecyclerView.dispatchLayout(RecyclerView.java:3365)
at android.support.v7.widget.RecyclerView.onLayout(RecyclerView.java:3886)
at android.view.View.layout(View.java:15664)
at android.view.ViewGroup.layout(ViewGroup.java:4869)
at android.widget.RelativeLayout.onLayout(RelativeLayout.java:1055)
at android.view.View.layout(View.java:15664)
at android.view.ViewGroup.layout(ViewGroup.java:4869)
at android.widget.FrameLayout.layoutChildren(FrameLayout.java:453)
at android.widget.FrameLayout.onLayout(FrameLayout.java:388)
at android.view.View.layout(View.java:15664)
at android.view.ViewGroup.layout(ViewGroup.java:4869)
at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1677)
at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1531)
at android.widget.LinearLayout.onLayout(LinearLayout.java:1440)
at android.view.View.layout(View.java:15664)
at android.view.ViewGroup.layout(ViewGroup.java:4869)
at android.widget.FrameLayout.layoutChildren(FrameLayout.java:453)
at android.widget.FrameLayout.onLayout(FrameLayout.java:388)
at android.view.View.layout(View.java:15664)
at android.view.ViewGroup.layout(ViewGroup.java:4869)
at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1677)
at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1531)
at android.widget.LinearLayout.onLayout(LinearLayout.java:1440)
at android.view.View.layout(View.java:15664)
at android.view.ViewGroup.layout(ViewGroup.java:4869)
at android.widget.FrameLayout.layoutChildren(FrameLayout.java:453)
at android.widget.FrameLayout.onLayout(FrameLayout.java:388)
at android.view.View.layout(View.java:15664)
at android.view.ViewGroup.layout(ViewGroup.java:4869)
at android.view.ViewRootImpl.performLayout(ViewRootImpl.java:2246)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1968)
at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1200)
at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:6401)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:803)
at android.view.Choreographer.doCallbacks(Choreographer.java:603)
at android.view.Choreographer.doFrame(Choreographer.java:573)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:789)
at android.os.Handler.handleCallback(Handler.java:733)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:157)
at android.app.ActivityThread.main(ActivityThread.java:5335)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1265)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1081)
at dalvik.system.NativeStart.main(Native Method)
I remove item like this:
public void delete(Entity entity) {
entities.remove(entity);
notifyDataSetChanged();
}
What's wrong here? Have any suggestion for my problem? Thanks!
I think may be the cause of this error is remove item i called from Dispoable of rx thread? When i remove item in my activity it's work fine.
You can use notifyItemRangeChanged or notifyItemChanged method RecyclerView Adapter.

java.lang.IndexOutOfBoundsException: Invalid index 0, size is 0 and some time my appcrash and some time work properly [duplicate]

This question already has answers here:
What causes a java.lang.ArrayIndexOutOfBoundsException and how do I prevent it?
(26 answers)
Closed 5 years ago.
Error:
03-28 14:23:08.466 8743-8743/com.furbonics.furbonicsexecutive
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.furbonics.furbonicsexecutive, PID: 8743
java.lang.IndexOutOfBoundsException: Invalid index 0, size is 0
at
java.util.ArrayList.throwIndexOutOfBoundsException(ArrayList.java:255)
at java.util.ArrayList.get(ArrayList.java:308)
at android.widget.ArrayAdapter.getItem(ArrayAdapter.java:337)
at
android.widget.ArrayAdapter.createViewFromResource(ArrayAdapter.java:390)
at android.widget.ArrayAdapter.getView(ArrayAdapter.java:362)
at android.widget.Spinner.makeView(Spinner.java:592)
at android.widget.Spinner.layout(Spinner.java:540)
at android.widget.Spinner.onLayout(Spinner.java:502)
at android.view.View.layout(View.java:14845)
at android.view.ViewGroup.layout(ViewGroup.java:4631)
at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1671)
at
android.widget.LinearLayout.layoutHorizontal(LinearLayout.java:1660)
at android.widget.LinearLayout.onLayout(LinearLayout.java:1436)
at android.view.View.layout(View.java:14845)
at android.view.ViewGroup.layout(ViewGroup.java:4631)
at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1671)
at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1525)
at android.widget.LinearLayout.onLayout(LinearLayout.java:1434)
at android.view.View.layout(View.java:14845)
at android.view.ViewGroup.layout(ViewGroup.java:4631)
at android.widget.FrameLayout.layoutChildren(FrameLayout.java:453)
at android.widget.FrameLayout.onLayout(FrameLayout.java:388)
at android.widget.ScrollView.onLayout(ScrollView.java:1468)
at android.view.View.layout(View.java:14845)
at android.view.ViewGroup.layout(ViewGroup.java:4631)
at android.widget.RelativeLayout.onLayout(RelativeLayout.java:1055)
at android.view.View.layout(View.java:14845)
at android.view.ViewGroup.layout(ViewGroup.java:4631)
at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1671)
at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1525)
at android.widget.LinearLayout.onLayout(LinearLayout.java:1434)
at android.view.View.layout(View.java:14845)
at android.view.ViewGroup.layout(ViewGroup.java:4631)
at android.widget.FrameLayout.layoutChildren(FrameLayout.java:453)
at android.widget.FrameLayout.onLayout(FrameLayout.java:388)
at android.view.View.layout(View.java:14845)
at android.view.ViewGroup.layout(ViewGroup.java:4631)
at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1671)
at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1525)
at android.widget.LinearLayout.onLayout(LinearLayout.java:1434)
at android.view.View.layout(View.java:14845)
at android.view.ViewGroup.layout(ViewGroup.java:4631)
at android.widget.FrameLayout.layoutChildren(FrameLayout.java:453)
at android.widget.FrameLayout.onLayout(FrameLayout.java:388)
at android.view.View.layout(View.java:14845)
at android.view.ViewGroup.layout(ViewGroup.java:4631)
at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1671)
at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1525)
at android.widget.LinearLayout.onLayout(LinearLayout.java:1434)
at android.view.View.layout(View.java:14845)
at android.view.ViewGroup.layout(ViewGroup.java:4631)
at android.widget.FrameLayout.layoutChildren(FrameLayout.java:453)
at android.widget.FrameLayout.onLayout(FrameLayout.java:388)
at android.view.View.layout(View.java:14845)
at android.view.ViewGroup.layout(ViewGroup.java:4631)
at android.view.ViewRootImpl.performLayout(ViewRootImpl.java:2026)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1783)
at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1039)
at
android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:5648)
at
android.view.Choreographer$CallbackRecord.run(Choreographer.java:761)
at android.view.Choreographer.doCallbacks(Choreographer.java:574)
at android.view.Choreographer.doFrame(Choreographer.java:544)
at
android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:747)
at android.os.Handler.handleCallback(Handler.java:733)
at android.o
You are trying to read a value from an empty array
lang.IndexOutOfBoundsException: Invalid index 0, size is 0.
Verify that the array is not empty before accessing a value in your code.
It means you are not able to fetch data. First use log and check if output is shown if no then check your code also surround your code for fetching with try and catch.

Android crash ClassCastException but no project lines

My Application is crashing on an GT-P5110 Android 4.2.2 Samsung Tab 2 tablet. I'm currently searching all my code but can't find where it is called. I got the error output right here.
I can't find a listview which is casting this problem. I even disabled whole parts. Anyone got an idea?
java.lang.ClassCastException: android.widget.FrameLayout$LayoutParams cannot be cast to android.widget.AbsListView$LayoutParams
at android.widget.ListView.setupChild(ListView.java:1872)
at android.widget.ListView.makeAndAddView(ListView.java:1841)
at android.widget.ListView.fillDown(ListView.java:681)
at android.widget.ListView.fillFromTop(ListView.java:742)
at android.widget.ListView.layoutChildren(ListView.java:1645)
at android.widget.AbsListView.onLayout(AbsListView.java:2511)
at android.view.View.layout(View.java:14694)
at android.view.ViewGroup.layout(ViewGroup.java:4491)
at android.widget.RelativeLayout.onLayout(RelativeLayout.java:1021)
at android.view.View.layout(View.java:14694)
at android.view.ViewGroup.layout(ViewGroup.java:4491)
at android.support.v4.widget.DrawerLayout.onLayout(DrawerLayout.java:931)
at android.view.View.layout(View.java:14694)
at android.view.ViewGroup.layout(ViewGroup.java:4491)
at android.widget.FrameLayout.onLayout(FrameLayout.java:448)
at android.view.View.layout(View.java:14694)
at android.view.ViewGroup.layout(ViewGroup.java:4491)
at android.support.v7.internal.widget.ActionBarOverlayLayout.onLayout(ActionBarOverlayLayout.java:493)
at android.view.View.layout(View.java:14694)
at android.view.ViewGroup.layout(ViewGroup.java:4491)
at android.widget.FrameLayout.onLayout(FrameLayout.java:448)
at android.view.View.layout(View.java:14694)
at android.view.ViewGroup.layout(ViewGroup.java:4491)
at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1669)
at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1527)
at android.widget.LinearLayout.onLayout(LinearLayout.java:1440)
at android.view.View.layout(View.java:14694)
at android.view.ViewGroup.layout(ViewGroup.java:4491)
at android.widget.FrameLayout.onLayout(FrameLayout.java:448)
at android.view.View.layout(View.java:14694)
at android.view.ViewGroup.layout(ViewGroup.java:4491)
at android.view.ViewRootImpl.performLayout(ViewRootImpl.java:2200)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2014)
at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1227)
at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:4995)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:791)
at android.view.Choreographer.doCallbacks(Choreographer.java:591)
at android.view.Choreographer.doFrame(Choreographer.java:561)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:777)
at android.os.Handler.handleCallback(Handler.java:725)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:175)
at android.app.ActivityThread.main(ActivityThread.java:5279)
at java.lang.reflect.Method.invokeNative(Method.java)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1102)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:869)
at dalvik.system.NativeStart.main(NativeStart.java)

Reusing AndroidTV RowsFragment outside BrowseFragment

I'm trying to reuse the RowsFragment provided by AndroidTV Leanback outside of a BrowseFragment, to have a similar row interaction look & feel on a different layout, but I'm getting XML-inflation errors that I haven't been able to debug and solve.
The implementation itself is similar to what is implemented here: https://medium.com/building-for-android-tv , but in the blog he's replacing different fragments of the same kind inside a BrowseFragment. Is there something fundamentally wrong with my approach? If so, why? I've been reading through the Leanback sources and haven't been able to find anything that I would understand (although it's a large library) that would couple the fragments to that degree.
A reproduction of the relevant code:
https://gist.github.com/orbitbot/c9070ed00961c3abe4ca
02-26 12:12:26.950 4465-4527/com.my.client E/AndroidRuntime﹕ FATAL EXCEPTION: main
Process: com.my.client, PID: 4465
android.view.InflateException: Binary XML file line #18: Error inflating class <unknown>
at android.view.LayoutInflater.createView(LayoutInflater.java:620)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:696)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:755)
at android.view.LayoutInflater.inflate(LayoutInflater.java:462)
at android.view.LayoutInflater.inflate(LayoutInflater.java:397)
at android.view.LayoutInflater.inflate(LayoutInflater.java:353)
at android.support.v17.leanback.widget.RowContainerView.<init>(RowContainerView.java:48)
at android.support.v17.leanback.widget.RowContainerView.<init>(RowContainerView.java:37)
at android.support.v17.leanback.widget.RowPresenter.onCreateViewHolder(RowPresenter.java:169)
at android.support.v17.leanback.widget.ItemBridgeAdapter.onCreateViewHolder(ItemBridgeAdapter.java:247)
at android.support.v7.widget.RecyclerView$Adapter.createViewHolder(RecyclerView.java:4121)
at android.support.v7.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:3431)
at android.support.v7.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:3340)
at android.support.v17.leanback.widget.GridLayoutManager.getViewForPosition(GridLayoutManager.java:573)
at android.support.v17.leanback.widget.GridLayoutManager$2.createItem(GridLayoutManager.java:1057)
at android.support.v17.leanback.widget.StaggeredGrid.appendItemToRow(StaggeredGrid.java:242)
at android.support.v17.leanback.widget.StaggeredGridDefault.appendItems(StaggeredGridDefault.java:49)
at android.support.v17.leanback.widget.GridLayoutManager.appendOneVisibleItem(GridLayoutManager.java:1263)
at android.support.v17.leanback.widget.GridLayoutManager.appendVisibleItems(GridLayoutManager.java:1273)
at android.support.v17.leanback.widget.GridLayoutManager.onLayoutChildren(GridLayoutManager.java:1554)
at android.support.v7.widget.RecyclerView.dispatchLayout(RecyclerView.java:1988)
at android.support.v7.widget.RecyclerView.onLayout(RecyclerView.java:2237)
at android.view.View.layout(View.java:14817)
at android.view.ViewGroup.layout(ViewGroup.java:4631)
at android.support.v17.leanback.widget.ScaleFrameLayout.onLayout(ScaleFrameLayout.java:135)
at android.view.View.layout(View.java:14817)
at android.view.ViewGroup.layout(ViewGroup.java:4631)
at android.widget.FrameLayout.layoutChildren(FrameLayout.java:453)
at android.widget.FrameLayout.onLayout(FrameLayout.java:388)
at android.view.View.layout(View.java:14817)
at android.view.ViewGroup.layout(ViewGroup.java:4631)
at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1671)
at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1525)
at android.widget.LinearLayout.onLayout(LinearLayout.java:1434)
at android.view.View.layout(View.java:14817)
at android.view.ViewGroup.layout(ViewGroup.java:4631)
at android.widget.FrameLayout.layoutChildren(FrameLayout.java:453)
at android.widget.FrameLayout.onLayout(FrameLayout.java:388)
at android.view.View.layout(View.java:14817)
at android.view.ViewGroup.layout(ViewGroup.java:4631)
at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1671)
at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1525)
at android.widget.LinearLayout.onLayout(LinearLayout.java:1434)
at android.view.View.layout(View.java:14817)
at android.view.ViewGroup.layout(ViewGroup.java:4631)
at android.widget.FrameLayout.layoutChildren(FrameLayout.java:453)
at android.widget.FrameLayout.onLayout(FrameLayout.java:388)
at android.view.View.layout(View.java:14817)
at android.view.ViewGroup.layout(ViewGroup.java:4631)
at android.view.ViewRootImpl.performLayout(ViewRootImpl.java:1989)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1746)
at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1000)
at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:5672)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:772
Make sure that your ChangePicActivity has proper theme in AndroidManifest.xml
Add android:theme="#style/Theme.Leanback" to relevant activity tag.
Like this
<activity
android:name=".ChangePicActivity"
android:theme="#style/Theme.Leanback"
>
[...]

Android App crashing due to classcastexception when using sliding menu library [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 8 years ago.
Improve this question
I am getting this error when my app crashes due to Sliding Menu Library
12-31 14:02:54.319: E/AndroidRuntime(4121): java.lang.ClassCastException: android.view.ViewGroup$LayoutParams cannot be cast to android.widget.AbsListView$LayoutParams
12-31 14:02:54.319: E/AndroidRuntime(4121): at android.widget.ListView.setupChild(ListView.java:1826)
12-31 14:02:54.319: E/AndroidRuntime(4121): at android.widget.ListView.makeAndAddView(ListView.java:1793)
12-31 14:02:54.319: E/AndroidRuntime(4121): at android.widget.ListView.fillSpecific(ListView.java:1337)
12-31 14:02:54.319: E/AndroidRuntime(4121): at android.widget.ListView.layoutChildren(ListView.java:1620)
12-31 14:02:54.319: E/AndroidRuntime(4121): at android.widget.AbsListView.onLayout(AbsListView.java:2087)
12-31 14:02:54.319: E/AndroidRuntime(4121): at android.view.View.layout(View.java:14817)
12-31 14:02:54.319: E/AndroidRuntime(4121): at android.view.ViewGroup.layout(ViewGroup.java:4631)
12-31 14:02:54.319: E/AndroidRuntime(4121): at android.widget.RelativeLayout.onLayout(RelativeLayout.java:1055)
12-31 14:02:54.319: E/AndroidRuntime(4121): at android.view.View.layout(View.java:14817)
12-31 14:02:54.319: E/AndroidRuntime(4121): at android.view.ViewGroup.layout(ViewGroup.java:4631)
12-31 14:02:54.319: E/AndroidRuntime(4121): at android.widget.RelativeLayout.onLayout(RelativeLayout.java:1055)
12-31 14:02:54.319: E/AndroidRuntime(4121): at android.view.View.layout(View.java:14817)
12-31 14:02:54.319: E/AndroidRuntime(4121): at android.view.ViewGroup.layout(ViewGroup.java:4631)
12-31 14:02:54.319: E/AndroidRuntime(4121): at android.widget.RelativeLayout.onLayout(RelativeLayout.java:1055)
12-31 14:02:54.319: E/AndroidRuntime(4121): at android.view.View.layout(View.java:14817)
12-31 14:02:54.319: E/AndroidRuntime(4121): at android.view.ViewGroup.layout(ViewGroup.java:4631)
12-31 14:02:54.319: E/AndroidRuntime(4121): at android.widget.FrameLayout.layoutChildren(FrameLayout.java:453)
12-31 14:02:54.319: E/AndroidRuntime(4121): at android.widget.FrameLayout.onLayout(FrameLayout.java:388)
12-31 14:02:54.319: E/AndroidRuntime(4121): at android.view.View.layout(View.java:14817)
12-31 14:02:54.319: E/AndroidRuntime(4121): at android.view.ViewGroup.layout(ViewGroup.java:4631)
12-31 14:02:54.319: E/AndroidRuntime(4121): at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1671)
12-31 14:02:54.319: E/AndroidRuntime(4121): at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1525)
12-31 14:02:54.319: E/AndroidRuntime(4121): at android.widget.LinearLayout.onLayout(LinearLayout.java:1434)
12-31 14:02:54.319: E/AndroidRuntime(4121): at android.view.View.layout(View.java:14817)
12-31 14:02:54.319: E/AndroidRuntime(4121): at android.view.ViewGroup.layout(ViewGroup.java:4631)
12-31 14:02:54.319: E/AndroidRuntime(4121): at com.jeremyfeinstein.slidingmenu.lib.CustomViewAbove.onLayout(CustomViewAbove.java:476)
12-31 14:02:54.319: E/AndroidRuntime(4121): at android.view.View.layout(View.java:14817)
12-31 14:02:54.319: E/AndroidRuntime(4121): at android.view.ViewGroup.layout(ViewGroup.java:4631)
12-31 14:02:54.319: E/AndroidRuntime(4121): at android.widget.RelativeLayout.onLayout(RelativeLayout.java:1055)
12-31 14:02:54.319: E/AndroidRuntime(4121): at android.view.View.layout(View.java:14817)
12-31 14:02:54.319: E/AndroidRuntime(4121): at android.view.ViewGroup.layout(ViewGroup.java:4631)
12-31 14:02:54.319: E/AndroidRuntime(4121): at android.widget.FrameLayout.layoutChildren(FrameLayout.java:453)
12-31 14:02:54.319: E/AndroidRuntime(4121): at android.widget.FrameLayout.onLayout(FrameLayout.java:388)
12-31 14:02:54.319: E/AndroidRuntime(4121): at android.view.View.layout(View.java:14817)
12-31 14:02:54.319: E/AndroidRuntime(4121): at android.view.ViewGroup.layout(ViewGroup.java:4631)
12-31 14:02:54.319: E/AndroidRuntime(4121): at android.view.ViewRootImpl.performLayout(ViewRootImpl.java:1983)
12-31 14:02:54.319: E/AndroidRuntime(4121): at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1740)
12-31 14:02:54.319: E/AndroidRuntime(4121): at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:996)
12-31 14:02:54.319: E/AndroidRuntime(4121): at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:5600)
12-31 14:02:54.319: E/AndroidRuntime(4121): at android.view.Choreographer$CallbackRecord.run(Choreographer.java:761)
12-31 14:02:54.319: E/AndroidRuntime(4121): at android.view.Choreographer.doCallbacks(Choreographer.java:574)
12-31 14:02:54.319: E/AndroidRuntime(4121): at android.view.Choreographer.doFrame(Choreographer.java:544)
12-31 14:02:54.319: E/AndroidRuntime(4121): at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:747)
12-31 14:02:54.319: E/AndroidRuntime(4121): at android.os.Handler.handleCallback(Handler.java:733)
12-31 14:02:54.319: E/AndroidRuntime(4121): at android.os.Handler.dispatchMessage(Handler.java:95)
12-31 14:02:54.319: E/AndroidRuntime(4121): at android.os.Looper.loop(Looper.java:136)
12-31 14:02:54.319: E/AndroidRuntime(4121): at android.app.ActivityThread.main(ActivityThread.java:5001)
12-31 14:02:54.319: E/AndroidRuntime(4121): at java.lang.reflect.Method.invokeNative(Native Method)
12-31 14:02:54.319: E/AndroidRuntime(4121): at java.lang.reflect.Method.invoke(Method.java:515)
12-31 14:02:54.319: E/AndroidRuntime(4121): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785)
12-31 14:02:54.319: E/AndroidRuntime(4121): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
12-31 14:02:54.319: E/AndroidRuntime(4121): at dalvik.system.NativeStart.main(Native Method)
can anyone help me in this issue. i tried to download fresh copy of library and use, but even then it is not solved. im compiling all my project dependent projects and app with android 5.0
Check/Organise your imports(ctrl + shift + o, in Eclipse) in CustomViewAbove.java and ensure that if LayoutParams have been used anywhere, they are from the package of android.widget.AbsListView.
Basically that is what your error is telling you:
12-31 14:02:54.319: E/AndroidRuntime(4121): java.lang.ClassCastException:
android.view.ViewGroup$LayoutParams cannot be cast to android.widget.AbsListView$LayoutParams
If LayoutParams are being used at multiple places(other than line no. 476), then need to import both packages accordingly.

Categories

Resources