How to use vector in the toolbar?

There is an ImageView, the image quality I'm using vector, but the app gives an error

Caused by: android.view.InflateException: Binary XML file line #12: Binary XML file line #28: Error inflating class android.support.v7.widget.AppCompatImageView
Caused by: android.view.InflateException: Binary XML file line #28: Error inflating class android.support.v7.widget.AppCompatImageView

Markup
<android.support.design.widget.AppBarLayout
android:layout_width="parent"
android:layout_height="wrap content"
android:theme="@style/AppTheme.AppBarOverlay">

<android.support.v7.widget.Toolbar
android:id="@+id/toolbar_main"
android:layout_width="parent"
android:layout_height="?attr/actionBarSize"
android:background="@color/colorWhite"

<android.support.v7.widget.AppCompatImageView

android:id="@+id/image"
android:layout_width="parent"
android:layout_height="parent"
android:layout_marginStart="100dp"
android:layout_marginEnd="100dp"
app:srcCompat="@drawable/ic_logo"
/>

</android.support.v7.widget.Toolbar>
 </android.support.design.widget.AppBarLayout>


Gradle
apply plugin: 'com.android.application'

android {
 compileSdkVersion 28
 defaultConfig {
 applicationId "com.mccorporation.mcjores.askmollyproject"
 minSdkVersion 17
 targetSdkVersion 28
 versionCode 1
 versionName "1.0"
 testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
 vectorDrawables.useSupportLibrary = true
}
 buildTypes {
 release {
 minifyEnabled false
 proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}

dependencies {
 implementation fileTree(dir: 'libs', include: ['*.jar'])
 implementation 'com.android.support:appcompat-v7:28.0.0'
 implementation 'com.android.support:design:28.0.0'
 implementation 'com.android.support.constraint:a constraint-layout:1.1.3'
 implementation "com.android.support:support-vector-drawable:28.0.0"
 testImplementation 'junit:junit:4.12'
 androidTestImplementation 'com.android.support.test:runner:1.0.2'
 androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}


Also just in case added in MainActivity
static {
AppCompatDelegate.setCompatVectorFromResourcesEnabled(true);
 }


Tried to programmatically set the same way.
ImageView image = findViewById(R. id.image);
 Drawable drawable = VectorDrawableCompat.create(getResources(),R. drawable.ic_logo, null);
 image.setImageDrawable(drawable);


LogCat
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.mccorporation.mcjores.askmollyproject/com.mccorporation.mcjores.askmollyproject.MainActivity}android.view.InflateException: Binary XML file line #12: Binary XML file line #28: Error inflating class android.support.v7.widget.AppCompatImageView
 at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2856)
 at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2931)
 at android.app.ActivityThread.-wrap11(Unknown Source:0)
 at android.app.ActivityThread$H. handleMessage(ActivityThread.java:1620)
 at android.os.Handler.dispatchMessage(Handler.java:105)
 at android.os.Looper.loop(Looper.java:173)
 at android.app.ActivityThread.main(ActivityThread.java:6698)
 at java.lang.reflect.Method.invoke(Native Method)
 at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
 at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:782)
 Caused by: android.view.InflateException: Binary XML file line #12: Binary XML file line #28: Error inflating class android.support.v7.widget.AppCompatImageView
 Caused by: android.view.InflateException: Binary XML file line #28: Error inflating class android.support.v7.widget.AppCompatImageView
 Caused by: java.lang.reflect.InvocationTargetException
 at java.lang.reflect.Constructor.newInstance0(Native Method)
 at java.lang.reflect.Constructor.newInstance(Constructor.java:334)
 at android.view.LayoutInflater.createView(LayoutInflater.java:651)
 at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:794)
 at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:734)
 at android.view.LayoutInflater.rInflate(LayoutInflater.java:867)
 at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:828)
 at android.view.LayoutInflater.rInflate(LayoutInflater.java:870)
 at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:828)
 at android.view.LayoutInflater.rInflate(LayoutInflater.java:870)
 at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:828)
 at android.view.LayoutInflater.parseInclude(LayoutInflater.java:999)
 at android.view.LayoutInflater.rInflate(LayoutInflater.java:863)
 at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:
 Caused by: android.content.Res. Resources$NotFoundException: Drawable com.mccorporation.mcjores.askmollyproject:drawable/ic_logo with resource ID #0x7f070073
 Caused by: android.content.Res. Resources$NotFoundException: File res/drawable/ic_logo.xml from drawable resource ID #0x7f070073
 at android.content.Res. ResourcesImpl.loadDrawableForCookie(ResourcesImpl.java:804)
2019-06-03 23:07:37.655 29177-29177/? E/AndroidRuntime: at android.content.Res. ResourcesImpl.loadDrawable(ResourcesImpl.java:617)
 at android.content.Res. MiuiResourcesImpl.loadDrawable(MiuiResourcesImpl.java:316)
 at android.content.Res. Resources.getDrawableForDensity(Resources.java:890)
 at android.content.Res. Resources.getDrawable(Resources.java:832)
 at android.content.Context.getDrawable(Context.java:614)
March 23rd 20 at 18:58
1 answer
March 23rd 20 at 19:00
Solution
Had a similar problem with the icons from the material.io

The problem was the SVG file (or in the Studio that it was wrong to skonvertiruet) - the path is the number 1.9 1.1.9 - because of this, jumped NotFoundException. The latest version of Studio shows these locations in red that says there is an error, the old version no.

But the problem appeared not on all devices - on most were, but some - so far.

Find more questions by tags Android