问题
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