在平板电脑上运行我的应用程序而不是手机(我之前从未尝试过)时,我会在开始某项活动时获得此堆栈跟踪。我查看了该活动的.xml文件,以查找在运行时可能为0的任何内容,并替换了所有想到的内容(例如?attr/actionBarSize
),但它没有改变任何内容。我最大的问题:堆栈跟踪太长,无法到达异常的原点。我有什么想法可以找到我的错误?
PS:我不知道该活动中的任何Bitmap,这使得它更加令人困惑
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
嗯,这是我从gradle的依赖,我现在正在使用24个支持库,但错误仍然存在...
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'
}
以下是崩溃活动的.xml代码:
<?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>
答案 0 :(得分:3)
听起来您可能正在使用支持库?我有同样的错误,并将其追溯到23.4.0中的DrawableCompat.wrap()中的一个错误,该错误在早期版本中并不存在。更高版本的支持库。此错误错误地将可绘制边界设置为0(或者在插入可绘制的情况下为负)。我已经看到这会导致Android 5.1崩溃。
我没有看到为此打开的具体问题,但是查看DrawableWrapperDonut / DrawableWrapperGingerbread的代码,我可以看到问题是在23.4.0左右引入的,后来修复了,所以如果你使用的是bug版本,切换到一个好的版本应该解决这个崩溃。
答案 1 :(得分:1)
也许你已经解决了问题,但也留给后人。
如果您在 Android 5.1 上使用 <inset>
drawable 导致异常或崩溃,您应该尝试使用 <layer-list>
drawable 代替 ,它对我有用。 drawable 正常显示。