2

I'm using a vector file on left drawable of textview:

<vector xmlns:android="http://schemas.android.com/apk/res/android"
    android:width="24dp"
    android:height="24dp"
    android:viewportWidth="24.0"
    android:viewportHeight="24.0">
    <path
         android:fillColor="#FFFFFFFF"
         android:pathData="M7,10l5,5 5,-5z"/>
</vector>

Which is causing a forced close in Android version below 5.0 (this FC).

 Caused by: android.content.res.Resources$NotFoundException: File res/drawable-nodpi-v4/ic_arrow_drop_down.xml from drawable resource ID #0x7f0200ac
 Caused by: org.xmlpull.v1.XmlPullParserException: Binary XML file line #1: invalid drawable tag vector

It's working fine with Android version 5.0.

FATAL EXCEPTION: main

Process: com.SocialMob, PID: 2681
                                         java.lang.RuntimeException: Unable to start activity ComponentInfo{com.SocialMob/com.SocialMob.Activities.MusicPlayerTwoActivity}: android.view.InflateException: Binary XML file line #38: Error inflating class <unknown>
                                             at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2412)
                                             at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2470)
                                             at android.app.ActivityThread.access$900(ActivityThread.java:174)
                                             at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1307)
                                             at android.os.Handler.dispatchMessage(Handler.java:102)
                                             at android.os.Looper.loop(Looper.java:146)
                                             at android.app.ActivityThread.main(ActivityThread.java:5593)
                                             at java.lang.reflect.Method.invokeNative(Native Method)
                                             at java.lang.reflect.Method.invoke(Method.java:515)
                                             at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1283)
                                             at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1099)
                                             at dalvik.system.NativeStart.main(Native Method)
                                          Caused by: android.view.InflateException: Binary XML file line #38: Error inflating class <unknown>
                                             at android.view.LayoutInflater.createView(LayoutInflater.java:626)
                                             at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:702)
                                             at android.view.LayoutInflater.rInflate(LayoutInflater.java:761)
                                             at android.view.LayoutInflater.rInflate(LayoutInflater.java:769)
                                             at android.view.LayoutInflater.rInflate(LayoutInflater.java:769)
                                             at android.view.LayoutInflater.rInflate(LayoutInflater.java:769)
                                             at android.view.LayoutInflater.rInflate(LayoutInflater.java:769)
                                             at android.view.LayoutInflater.inflate(LayoutInflater.java:498)
                                             at android.view.LayoutInflater.inflate(LayoutInflater.java:398)
                                             at android.view.LayoutInflater.inflate(LayoutInflater.java:354)
                                             at android.support.v7.app.AppCompatDelegateImplV7.setContentView(AppCompatDelegateImplV7.java:280)
                                             at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:140)
                                             at com.SocialMob.Activities.MusicPlayerTwoActivity.onCreate(MusicPlayerTwoActivity.java:86)
                                             at android.app.Activity.performCreate(Activity.java:5458)
                                             at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1093)
                                             at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2376)
                                             at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2470) 
                                             at android.app.ActivityThread.access$900(ActivityThread.java:174) 
                                             at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1307) 
                                             at android.os.Handler.dispatchMessage(Handler.java:102) 
                                             at android.os.Looper.loop(Looper.java:146) 
                                             at android.app.ActivityThread.main(ActivityThread.java:5593) 
                                             at java.lang.reflect.Method.invokeNative(Native Method) 
                                             at java.lang.reflect.Method.invoke(Method.java:515) 
                                             at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1283) 
                                             at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1099) 
                                             at dalvik.system.NativeStart.main(Native Method) 
                                          Caused by: java.lang.reflect.InvocationTargetException
                                             at java.lang.reflect.Constructor.constructNative(Native Method)
                                             at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
                                             at android.view.LayoutInflater.createView(LayoutInflater.java:600)
                                             at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:702) 
                                             at android.view.LayoutInflater.rInflate(LayoutInflater.java:761) 
                                             at android.view.LayoutInflater.rInflate(LayoutInflater.java:769) 
                                             at android.view.LayoutInflater.rInflate(LayoutInflater.java:769) 
                                             at android.view.LayoutInflater.rInflate(LayoutInflater.java:769) 
                                             at android.view.LayoutInflater.rInflate(LayoutInflater.java:769) 
                                             at android.view.LayoutInflater.inflate(LayoutInflater.java:498) 
                                             at android.view.LayoutInflater.inflate(LayoutInflater.java:398) 
                                             at android.view.LayoutInflater.inflate(LayoutInflater.java:354) 
                                             at android.support.v7.app.AppCompatDelegateImplV7.setContentView(AppCompatDelegateImplV7.java:280) 
                                             at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:140) 
                                             at com.SocialMob.Activities.MusicPlayerTwoActivity.onCreate(MusicPlayerTwoActivity.java:86) 
                                             at android.app.Activity.performCreate(Activity.java:5458) 
                                             at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1093) 
                                             at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2376) 
                                             at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2470) 
                                             at android.app.ActivityThread.access$900(ActivityThread.java:174) 
                                             at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1307) 
                                             at android.os.Handler.dispatchMessage(Handler.java:102) 
                                             at android.os.Looper.loop(Looper.java:146) 
                                             at android.app.ActivityThread.main(ActivityThread.java:5593) 
                                             at java.lang.reflect.Method.invokeNative(Native Method) 
                                             at java.lang.reflect.Method.invoke(Method.java:515) 
                                             at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1283) 
                                             at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1099) 
                                             at dalvik.system.NativeStart.main(Native Method) 
                                          Caused by: android.content.res.Resources$NotFoundException: File res/drawable-nodpi-v4/ic_arrow_drop_down.xml from drawable resource ID #0x7f0200ac
                                             at android.content.res.Resources.loadDrawable(Resources.java:3443)
                                             at android.content.res.TypedArray.getDrawable(TypedArray.java:602)
                                             at android.widget.TextView.<init>(TextView.java:1229)
                                             at android.support.v7.widget.AppCompatTextView.<init>(AppCompatTextView.java:60)
                                             at android.support.v7.widget.AppCompatTextView.<init>(AppCompatTextView.java:56)
                                             at com.SocialMob.CustomViews.CustomTextView.<init>(CustomTextView.java:22)
                                             at java.lang.reflect.Constructor.constructNative(Native Method) 
                                             at java.lang.reflect.Constructor.newInstance(Constructor.java:423) 
                                             at android.view.LayoutInflater.createView(LayoutInflater.java:600) 
                                             at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:702) 
                                             at android.view.LayoutInflater.rInflate(LayoutInflater.java:761) 
                                             at android.view.LayoutInflater.rInflate(LayoutInflater.java:769) 
                                             at android.view.LayoutInflater.rInflate(LayoutInflater.java:769) 
                                             at android.view.LayoutInflater.rInflate(LayoutInflater.java:769) 
                                             at android.view.LayoutInflater.rInflate(LayoutInflater.java:769) 
                                             at android.view.LayoutInflater.inflate(LayoutInflater.java:498) 
                                             at android.view.LayoutInflater.inflate(LayoutInflater.java:398) 
                                             at android.view.LayoutInflater.inflate(LayoutInflater.java:354) 
                                             at android.support.v7.app.AppCompatDelegateImplV7.setContentView(AppCompatDelegateImplV7.java:280) 
                                             at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:140) 
                                             at com.SocialMob.Activities.MusicPlayerTwoActivity.onCreate(MusicPlayerTwoActivity.java:86) 
                                             at android.app.Activity.performCreate(Activity.java:5458) 
                                             at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1093) 
                                             at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2376) 
                                             at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2470) 
                                             at android.app.ActivityThread.access$900(ActivityThread.java:174) 
                                             at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1307) 
                                             at android.os.Handler.dispatchMessage(Handler.java:102) 
                                             at android.os.Looper.loop(Looper.java:146) 
                                             at android.app.ActivityThread.main(ActivityThread.java:5593) 
                                             at java.lang.reflect.Method.invokeNative(Native Method) 
                                             at java.lang.reflect.Method.invoke(Method.java:515) 
                                             at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1283) 
                                             at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1099) 
                                             at dalvik.system.NativeStart.main(Native Method) 
                                          Caused by: org.xmlpull.v1.XmlPullParserException: Binary XML file line #1: invalid drawable tag vector
                                             at android.graphics.drawable.Drawable.createFromXmlInner(Drawable.java:986)
                                             at android.graphics.drawable.Drawable.createFromXml(Drawable.java:930)
                                             at android.content.res.Resources.loadDrawable(Resources.java:3439)
                                             at android.content.res.TypedArray.getDrawable(TypedArray.java:602) 
                                             at android.widget.TextView.<init>(TextView.java:1229) 
                                             at android.support.v7.widget.AppCompatTextView.<init>(AppCompatTextView.java:60) 
                                             at android.support.v7.widget.AppCompatTextView.<init>(AppCompatTextView.java:56) 
                                             at com.SocialMob.CustomViews.CustomTextView.<init>(CustomTextView.java:22) 
                                             at java.lang.reflect.Constructor.constructNative(Native Method) 
                                             at java.lang.reflect.Constructor.newInstance(Constructor.java:423) 
                                             at android.view.LayoutInflater.createView(LayoutInflater.java:600) 
                                             at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:702) 
                                             at android.view.LayoutInflater.rInflate(LayoutInflater.java:761) 
                                             at android.view.LayoutInflater.rInflate(LayoutInflater.java:769) 
                                             at android.view.LayoutInflater.rInflate(LayoutInflater.java:769) 
                                             at android.view.LayoutInflater.rInflate(LayoutInflater.java:769) 
                                             at android.view.LayoutInflater.rInflate(LayoutInflater.java:769) 
                                             at android.view.LayoutInflater.inflate(LayoutInflater.java:498) 
                                             at android.view.LayoutInflater.inflate(LayoutInflater.java:398) 
                                             at android.view.LayoutInflater.inflate(LayoutInflater.java:354) 
                                             at android.support.v7.app.AppCompatDelegateImplV7.setContentView(AppCompatDelegateImplV7.java:280) 
                                             at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:140) 
                                             at com.SocialMob.Activities.MusicPlayerTwoActivity.onCreate(MusicPlayerTwoActivity.java:86) 
                                             at android.app.Activity.performCreate(Activity.java:5458) 
                                             at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1093) 
                                             at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2376) 
                                             at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2470) 
                                             at android.app.ActivityThread.access$900(ActivityThread.java:174) 
                                             at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1307) 
                                             at android.os.Handler.dispatchMessage(Handler.java:102) 
                                             at android.os.Looper.loop(Looper.java:146) 
                                             at android.app.ActivityThread.main(ActivityThread.java:5593) 
                                             at java.lang.reflect.Method.invokeNative(Native Method) 
                                             at java.lang.reflect.Method.invoke(Method.java:515) 
                                             at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1283) 
                                             at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1099) 
                                             at dalvik.system.NativeStart.main(Native Method) 
Darish
  • 11,032
  • 5
  • 50
  • 70

1 Answers1

1

According to this blog post the way to solve this bug is to create a drawable resource file that references the vector:

<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:drawable="@drawable/ic_chat_black_24dp" />
</selector>

,which solved the problem for me. See also: Using android vector Drawables on pre Lollipop crash.

Elliott Beach
  • 10,459
  • 9
  • 28
  • 41