Есть ImageView, в качестве изображения я использую вектор, но приложение выдает ошибку
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
Разметка<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/AppTheme.AppBarOverlay">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar_main"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="@color/colorWhite"
<android.support.v7.widget.AppCompatImageView
android:id="@+id/image"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginStart="100dp"
android:layout_marginEnd="100dp"
app:srcCompat="@drawable/ic_logo"
/>
</android.support.v7.widget.Toolbar>
</android.support.design.widget.AppBarLayout>
Gradleapply 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: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'
}
Так же на всякий случай добавил в MainActivity
static {
AppCompatDelegate.setCompatVectorFromResourcesEnabled(true);
}
Пытался программно ставить - то же самое.
ImageView image = findViewById(R.id.image);
Drawable drawable = VectorDrawableCompat.create(getResources(),R.drawable.ic_logo, null);
image.setImageDrawable(drawable);
LogCatjava.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)