2

I have used vector drawable in an ImageView in android.

here is my code:

 <ImageView
        android:layout_width="320dp"
        android:layout_height="320dp"
        app:srcCompat="@drawable/app_logo"
        android:id="@+id/titleImageView"
        android:layout_alignParentTop="true"
        android:layout_alignParentStart="true"
        android:layout_marginTop="12dp" />

when running the app in API19 I got these error.

FATAL EXCEPTION: main
Process: com.nuvo.driver, PID: 4303
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.nuvo.driver/com.nuvo.driver.SignUp_Activity_}: android.view.InflateException: Binary XML file line #16: Error inflating class ImageButton

Thanks in advance for your time.

HassanUsman
  • 1,787
  • 1
  • 20
  • 38
muthugiridharan
  • 120
  • 1
  • 4

2 Answers2

1

You have to do two option to solve that :

  1. use android:src in place of app:srcCompat or
  2. use vectore dwable you have to change android.defaultConfig.vectorDrawables.useSupportLibrary = true in build.gridle file
Ravi Jat
  • 61
  • 1
  • 12
1

if you are using this code in build.gradle file:

android.defaultConfig.vectorDrawables.useSupportLibrary = true

i think you are using vector drawable for a button or textview or ... this act makes exception on your app for android below 5. if my guess is true use this structure: Is it possible to use VectorDrawable in Buttons and TextViews using android:DrawableRight?