Problem:
When my Robolectric test executes the following line it crashes (it doesn't crash on the actual device).
Note: I have gotten rid of any usages of LinearLayout as suggested here: https://stackoverflow.com/a/11493550/1859486
java.lang.ClassCastException: android.widget.LinearLayout$LayoutParams cannot be cast to android.widget.AbsListView$LayoutParams
at android.widget.ListView.clearRecycledState(ListView.java:532)
at android.widget.ListView.resetList(ListView.java:519)
at android.widget.ListView.setAdapter(ListView.java:462)
at se.emilsjolander.stickylistheaders.StickyListHeadersListView.setAdapter(StickyListHeadersListView.java:722)
Update
I've traced the root cause and isolated it to this line:
Interestingly enough, it only causes failures when running @Config(sdk = Build.VERSION_CODES.KITKAT) or @Config(sdk = Build.VERSION_CODES.O). It works fine on @Config(sdk = Build.VERSION_CODES.P)
Problem: When my Robolectric test executes the following line it crashes (it doesn't crash on the actual device). Note: I have gotten rid of any usages of LinearLayout as suggested here: https://stackoverflow.com/a/11493550/1859486
My setup Plugins:
Dependences:
Test dependencies:
Stacktrace:
Update I've traced the root cause and isolated it to this line:
Interestingly enough, it only causes failures when running @Config(sdk = Build.VERSION_CODES.KITKAT) or @Config(sdk = Build.VERSION_CODES.O). It works fine on @Config(sdk = Build.VERSION_CODES.P)
list_footer.xml: