Binary XML file line #16: Error inflating class android.Unterstützung.design.- widget.NavigationView
Bereitstellen, wenn ich meine app auf einem Gerät mit einer Android-Version unter Android 5.0 bekam ich diese Fehlermeldung. Ich habe die app mit die Android Studio Projekt-Assistentin und sagte: minSdkVersion=14, also sollte es kompatibel sein. Können Sie mir helfen?
Gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "opunktschmidt.weightcontrol"
minSdkVersion 14
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
packagingOptions {
exclude 'META-INF/DEPENDENCIES.txt'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/notice.txt'
exclude 'META-INF/license.txt'
exclude 'META-INF/dependencies.txt'
exclude 'META-INF/LGPL2.1'
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.0.1'
compile 'com.android.support:design:23.0.1'
compile 'joda-time:joda-time:2.8.2'
compile 'org.apache.commons:commons-lang3:3.4'
}
Fehler:
03-12 02:15:15.141 27894-27894/opunktschmidt.weightcontrol E/AndroidRuntime:
FATAL EXCEPTION: main
Process: opunktschmidt.weightcontrol, PID: 27894
java.lang.RuntimeException: Unable to start activity ComponentInfo{opunktschmidt.weightcontrol/opunktschmidt.weightcontrol.UI.CalorieDiaryActivity}: android.view.InflateException: Binary XML file line #16: Error inflating class android.support.design.widget.NavigationView
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2334)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2392)
at android.app.ActivityThread.access$900(ActivityThread.java:169)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1280)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:146)
at android.app.ActivityThread.main(ActivityThread.java:5487)
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 #16: Error inflating class android.support.design.widget.NavigationView
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.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:256)
at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:109)
at opunktschmidt.weightcontrol.UI.CalorieDiaryActivity.onCreate(CalorieDiaryActivity.java:52)
at android.app.Activity.performCreate(Activity.java:5451)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1093)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2298)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2392)
at android.app.ActivityThread.access$900(ActivityThread.java:169)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1280)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:146)
at android.app.ActivityThread.main(ActivityThread.java:5487)
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
XML-Datei Enthält NavigationView:
<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
tools:openDrawer="start">
<include
layout="@layout/app_bar_caloriediary"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<android.support.design.widget.NavigationView
android:id="@+id/nav_view"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="start"
android:fitsSystemWindows="true"
app:itemTextColor="?android:textColorPrimary"
app:menu="@menu/activity_main_drawer" />
</android.support.v4.widget.DrawerLayout>
legen Sie die xml-Datei enthält die NavigationView
In den ersten post
In den ersten post
InformationsquelleAutor OPunktSchmidt | 2016-02-27
Du musst angemeldet sein, um einen Kommentar abzugeben.
Den Grund gefunden für das problem: Android KitKat: android.Blick.InflateException: Error inflating class android.Unterstützung.design.- widget.NavigationView
Ich verstehe nicht, warum Android Studio lassen Sie erstellen ein Android-4.0-kompatibles Projekt, die nicht kompatibel zu Android 4.0. -.- Sie haben zu untersuchen, um es Android 4.0 kompatibel (sorry für schlechtes Englisch).
InformationsquelleAutor OPunktSchmidt
Das problem ist, Ihr Projekt fehlt, ist die raster-Ressourcen für pre-lollipop-Versionen.
Check, wenn du die Datei
values/drawables.xml
. Es scheint, dass Sie kopiert einige Quelle, aber nicht diese Datei. Die Datei enthält Verweise auf Rasterbilder, die als alternativen zu den Vektor-Bilder:InformationsquelleAutor Jakub Michalko
Habe versucht, alle Lösungen auf stack overflow, nichts funktionierte.
Das problem war: ich habe nur eine dimens.xml(v21) Datei in der Werte Ordner. Meine App funktioniert auf den Lutscher und oben, aber es stürzte auf android-version 4 und weniger.
Nun die app arbeitet auf android-version 4 & weniger.
InformationsquelleAutor yahme3