當在平板電腦上運行我的應用程序而不是在手機上時(我以前從未嘗試過),當我開始某個活動時收到此堆棧跟蹤。我查看了該活動的.xml文件以查找運行時可能爲0的任何內容,並替換了想到的所有內容(例如?attr/actionBarSize
),但它沒有改變任何內容。我最大的問題:堆棧跟蹤太長,無法找到例外的原點。任何想法如何找到我的錯誤? PS:我不知道該活動的任何位圖,這使得它更加混亂IllegalArgumentException:活動中的寬度和高度必須大於0
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
好了,這裏是我的depenencies從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>
你能發佈你的佈局XML和活動代碼嗎? –
@MobileDeveloper添加了xml,您感興趣的是哪部分活動代碼?這是相當一堆...... – Maverick283