RuntimeException : Width (0) and height (0) cannot be <= 0

我们两清 提交于 2020-05-31 03:02:17

问题


I have got this type of error, How may I resolve this issue.

java.lang.RuntimeException: java.lang.RuntimeException: Error while processing D:\Android Project\AttendanceApp\app\src\main\res\drawable\ic_arrow_back.xml : Width (0) and height (0) cannot be <= 0

ic_arrow_back.xml

<vector android:height="@dimen/_25sdp" android:tint="#FFFFFF"
    android:viewportHeight="24.0" android:viewportWidth="24.0"
    android:width="@dimen/_25sdp" xmlns:android="http://schemas.android.com/apk/res/android">
    <path android:fillColor="#FF000000" android:pathData="M20,11H7.83l5.59,-5.59L12,4l-8,8 8,8 1.41,-1.41L7.83,13H20v-2z"/>
</vector>

回答1:


You need to add certain attributes on your app's build.gradle.

android {  
   defaultConfig {  
     vectorDrawables.useSupportLibrary = true  
    }  
 } 



回答2:


try to enable vectorDrawables.useSupportLibrary in your build.gradle

 android {  
   defaultConfig {  
     vectorDrawables.useSupportLibrary = true  
    }  
 } 

and in your layout.xml :

 <ImageView
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        app:srcCompat ="@drawable/ic_arrow_back"
        />


来源:https://stackoverflow.com/questions/58871173/runtimeexception-width-0-and-height-0-cannot-be-0

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!