When running my app on a tablet rather then on a phone (which I've never tried before) I get this stack trace when I start a certain activity. I have looked through the .xml files of that activity to look for anything that might be 0 at runtime, and replaced everything that came to mind (like for example ?attr/actionBarSize
) but it didn't change anything. My biggest problem: The stack trace is too long to get to the origin of the exception. Any ideas how I can find my mistake?
PS: I don't know of any Bitmap in that activity, which makes it even more confusing
java.lang.IllegalArgumentException: width and height must be > 0
at android.graphics.Bitmap.createBitmap(Bitmap.java:933)
at android.graphics.Bitmap.createBitmap(Bitmap.java:912)
at android.graphics.Bitmap.createBitmap(Bitmap.java:879)
at android.graphics.drawable.VectorDrawable$VectorDrawableState.createCachedBitmapIfNeeded(VectorDrawable.java:711)
at android.graphics.drawable.VectorDrawable.draw(VectorDrawable.java:278)
at android.graphics.drawable.DrawableContainer.draw(DrawableContainer.java:76)
at android.widget.ExpandableListView.dispatchDraw(ExpandableListView.java:460)
at android.view.View.draw(View.java:16272)
at android.widget.AbsListView.draw(AbsListView.java:5983)
at android.view.View.updateDisplayListIfDirty(View.java:15192)
at android.view.View.getDisplayList(View.java:15215)
at android.view.View.draw(View.java:15990)
at android.view.ViewGroup.drawChild(ViewGroup.java:3708)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3502)
at android.view.View.draw(View.java:16272)
at android.view.View.updateDisplayListIfDirty(View.java:15192)
at android.view.View.getDisplayList(View.java:15215)
at android.view.View.draw(View.java:15990)
at android.view.ViewGroup.drawChild(ViewGroup.java:3708)
at android.support.design.widget.CoordinatorLayout.drawChild(CoordinatorLayout.java:1127)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3502)
at android.view.View.updateDisplayListIfDirty(View.java:15187)
at android.view.View.getDisplayList(View.java:15215)
at android.view.View.draw(View.java:15990)
at android.view.ViewGroup.drawChild(ViewGroup.java:3708)
at android.support.v4.widget.DrawerLayout.drawChild(DrawerLayout.java:1369)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3502)
at android.view.View.draw(View.java:16272)
at android.view.View.updateDisplayListIfDirty(View.java:15192)
at android.view.View.getDisplayList(View.java:15215)
at android.view.View.draw(View.java:15990)
at android.view.ViewGroup.drawChild(ViewGroup.java:3708)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3502)
at android.view.View.updateDisplayListIfDirty(View.java:15187)
at android.view.View.getDisplayList(View.java:15215)
at android.view.View.draw(View.java:15990)
at android.view.ViewGroup.drawChild(ViewGroup.java:3708)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3502)
at android.view.View.updateDisplayListIfDirty(View.java:15187)
at android.view.View.getDisplayList(View.java:15215)
at android.view.View.draw(View.java:15990)
at android.view.ViewGroup.drawChild(ViewGroup.java:3708)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3502)
at android.view.View.updateDisplayListIfDirty(View.java:15187)
at android.view.View.getDisplayList(View.java:15215)
at android.view.View.draw(View.java:15990)
at android.view.ViewGroup.drawChild(ViewGroup.java:3708)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3502)
at android.view.View.updateDisplayListIfDirty(View.java:15187)
at android.view.View.getDisplayList(View.java:15215)
at android.view.View.draw(View.java:15990)
at android.view.ViewGroup.drawChild(ViewGroup.java:3708)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3502)
at android.view.View.draw(View.java:16272)
at android.widget.FrameLayout.draw(FrameLayout.java:592)
at com.android.internal.policy.impl.PhoneWindow$DecorView.draw(PhoneWindow.java:3047)
at android.view.View.updateDisplayListIfDirty(View.java:15192)
at android.view.View.getDisplayList(View.java:15215)
at android.view.ThreadedRenderer.updateViewTreeDisplayList(ThreadedRenderer.java:307)
at android.view.ThreadedRenderer.updateRootDisplayList(ThreadedRenderer.java:313)
at android.view.ThreadedRenderer.draw(ThreadedRenderer.java:352)
at android.view.ViewRootImpl.draw(ViewRootImpl.java:2815)
at android.view.ViewRootImpl.performDraw(ViewRootImpl.java:2638)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2226)
at android.view.ViewRootImpl.doTraversal(ViewRootIm
Well, and here are my depenencies from gradle, I'm now using the 24 support libraries but the error persist...
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
wearApp project(':wear')
testCompile 'junit:junit:4.12'
compile 'com.google.android.gms:play-services:9.4.0'
compile 'org.postgresql:postgresql:9.4.1208.jre7'
compile 'com.google.android.gms:play-services-ads:9.4.0'
compile 'com.google.android.gms:play-services-identity:9.4.0'
compile 'com.google.android.gms:play-services-gcm:9.4.0'
compile 'com.android.support:multidex:1.0.0'
compile 'com.google.android.support:wearable:1.4.0'
compile 'com.google.firebase:firebase-core:9.4.0'
compile 'com.google.firebase:firebase-crash:9.4.0'
compile 'com.google.firebase:firebase-messaging:9.4.0'
compile 'com.android.support:support-v4:24.2.1'
compile 'com.android.support:recyclerview-v7:24.2.1'
compile 'com.android.support:design:24.2.1'
compile 'com.android.support:palette-v7:24.2.1'
}
And here comes the .xml code for the activity that crashes:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/colorPrimary"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
tools:context="org.pbdevelopement.cineapp.SpielplanActivity"
tools:showIn="@layout/app_bar_spielplan">
<ExpandableListView
android:id="@+id/spielplan_list_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:divider="@color/Grey600"
android:dividerHeight="1dp"
android:groupIndicator="@drawable/group_selector_icon"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true" />
</RelativeLayout>
It sounds like you may be using the support library? I had the same error and traced it to a bug with DrawableCompat.wrap() in 23.4.0 that doesn't exist in earlier & later versions of the support library. This bug incorrectly sets the drawable bounds to 0 (or negative in the case of an inset drawable). I've seen this cause a crash on Android 5.1.
I didn't see a specific issue opened for this, but looking at the code for DrawableWrapperDonut/DrawableWrapperGingerbread, I can see that the problem was introduced around 23.4.0 and later fixed, so if you were using the buggy version, switching to a good version should fix this crash.
Maybe you have solved the problem, but it is also left for later people.
If you use <inset>
drawable leading an abnormality or crash on Android 5.1, you should try use <layer-list>
drawable to instead of , it works for me. The drawable is normal display.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With