Error inflating class android.support.design.widget.NavigationView when adding Drawer Navigation -


there many answers on stackoverflow error , have read many of them none helped me. following tutorial drawer navigation. have tried appcompat , design version 23.4.0, 23.1.1, 23.2.0 , minsdkversion 21, 19 nothing changed.

i have added app:itemtextcolor="@color/colorprimary" navigationview.

here gradle:

apply plugin: 'com.android.application'  android {     compilesdkversion 23     buildtoolsversion '25.0.2'     defaultconfig {         applicationid "com.example.nishant.book"         minsdkversion 21         targetsdkversion 23         versioncode 1         versionname "1.0"         testinstrumentationrunner "android.support.test.runner.androidjunitrunner"     }     buildtypes {         release {             minifyenabled false             proguardfiles getdefaultproguardfile('proguard-android.txt'), 'proguard-rules.pro'         }     } }  dependencies {     compile filetree(include: ['*.jar'], dir: 'libs')     androidtestcompile('com.android.support.test.espresso:espresso-core:2.2.2', {         exclude group: 'com.android.support', module: 'support-annotations'     })     compile 'com.android.support:appcompat-v7:23.4.0'     compile 'com.android.support:support-v4:23.4.0'     compile 'com.android.support:design:23.4.0'     compile 'com.google.firebase:firebase-database:10.0.1'     compile 'com.firebaseui:firebase-ui-auth:1.0.1'     compile 'com.android.support.constraint:constraint-layout:1.0.2'     testcompile 'junit:junit:4.12' } apply plugin: 'com.google.gms.google-services' 

here activity_main.xml

<?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"     android:id="@+id/drawer_layout"     android:layout_width="match_parent"     android:layout_height="match_parent">      <android.support.design.widget.coordinatorlayout         xmlns:android="http://schemas.android.com/apk/res/android"         xmlns:tools="http://schemas.android.com/tools"         android:layout_width="match_parent"         android:layout_height="match_parent"         android:fitssystemwindows="true"         tools:context="com.example.nishant.book.mainactivity">          <android.support.design.widget.coordinatorlayout             android:layout_width="match_parent"             android:layout_height="match_parent">              <include layout="@layout/content_main" />          </android.support.design.widget.coordinatorlayout>      </android.support.design.widget.coordinatorlayout>      <android.support.design.widget.navigationview         android:id="@+id/navigation_view"         android:layout_width="240dp"         android:layout_height="match_parent"         android:layout_gravity="start"         app:headerlayout="@layout/drawer_header_layout"         app:menu="@array/drawer_array"         app:itemtextcolor="@color/colorprimary"         android:fitssystemwindows="true">      </android.support.design.widget.navigationview>  </android.support.v4.widget.drawerlayout> 

here logcat:

java.lang.runtimeexception: unable start activity componentinfo{com.example.nishant.book/com.example.nishant.book.mainactivity}: android.view.inflateexception: binary xml file line #26: binary xml file line #26: error inflating class android.support.design.widget.navigationview                                                                                      @ android.app.activitythread.performlaunchactivity(activitythread.java:2449)                                                                                      @ android.app.activitythread.handlelaunchactivity(activitythread.java:2509)                                                                                      @ android.app.activitythread.access$1000(activitythread.java:153)                                                                                      @ android.app.activitythread$h.handlemessage(activitythread.java:1373)                                                                                      @ android.os.handler.dispatchmessage(handler.java:102)                                                                                      @ android.os.looper.loop(looper.java:154)                                                                                      @ android.app.activitythread.main(activitythread.java:5529)                                                                                      @ java.lang.reflect.method.invoke(native method)                                                                                      @ com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:739)                                                                                      @ com.android.internal.os.zygoteinit.main(zygoteinit.java:629)                                                                                   caused by: android.view.inflateexception: binary xml file line #26: binary xml file line #26: error inflating class android.support.design.widget.navigationview                                                                                      @ android.view.layoutinflater.inflate(layoutinflater.java:543)                                                                                      @ android.view.layoutinflater.inflate(layoutinflater.java:427)                                                                                      @ android.view.layoutinflater.inflate(layoutinflater.java:374)                                                                                      @ android.support.v7.app.appcompatdelegateimplv9.setcontentview(appcompatdelegateimplv9.java:284)                                                                                      @ android.support.v7.app.appcompatactivity.setcontentview(appcompatactivity.java:143)                                                                                      @ com.example.nishant.book.mainactivity.createmainview(mainactivity.java:57)                                                                                      @ com.example.nishant.book.mainactivity.oncreate(mainactivity.java:50)                                                                                      @ android.app.activity.performcreate(activity.java:6303)                                                                                      @ android.app.instrumentation.callactivityoncreate(instrumentation.java:1108)                                                                                      @ android.app.activitythread.performlaunchactivity(activitythread.java:2402)                                                                                      @ android.app.activitythread.handlelaunchactivity(activitythread.java:2509)                                                                                       @ android.app.activitythread.access$1000(activitythread.java:153)                                                                                       @ android.app.activitythread$h.handlemessage(activitythread.java:1373)                                                                                       @ android.os.handler.dispatchmessage(handler.java:102)                                                                                       @ android.os.looper.loop(looper.java:154)                                                                                       @ android.app.activitythread.main(activitythread.java:5529)                                                                                       @ java.lang.reflect.method.invoke(native method)                                                                                       @ com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:739)                                                                                       @ com.android.internal.os.zygoteinit.main(zygoteinit.java:629)                                                                                    caused by: android.view.inflateexception: binary xml file line #26: error inflating class android.support.design.widget.navigationview                                                                                      @ android.view.layoutinflater.createview(layoutinflater.java:649)                                                                                      @ android.view.layoutinflater.createviewfromtag(layoutinflater.java:768)                                                                                      @ android.view.layoutinflater.createviewfromtag(layoutinflater.java:708)                                                                                      @ android.view.layoutinflater.rinflate(layoutinflater.java:839)                                                                                      @ android.view.layoutinflater.rinflatechildren(layoutinflater.java:802)                                                                                      @ android.view.layoutinflater.inflate(layoutinflater.java:519)                                                                                      @ android.view.layoutinflater.inflate(layoutinflater.java:427)                                                                                       @ android.view.layoutinflater.inflate(layoutinflater.java:374)                                                                                       @ android.support.v7.app.appcompatdelegateimplv9.setcontentview(appcompatdelegateimplv9.java:284)                                                                                       @ android.support.v7.app.appcompatactivity.setcontentview(appcompatactivity.java:143)                                                                                       @ com.example.nishant.book.mainactivity.createmainview(mainactivity.java:57)                                                                                       @ com.example.nishant.book.mainactivity.oncreate(mainactivity.java:50)                                                                                       @ android.app.activity.performcreate(activity.java:6303)                                                                                       @ android.app.instrumentation.callactivityoncreate(instrumentation.java:1108)                                                                                       @ android.app.activitythread.performlaunchactivity(activitythread.java:2402)                                                                                       @ android.app.activitythread.handlelaunchactivity(activitythread.java:2509)                                                                                       @ android.app.activitythread.access$1000(activitythread.java:153)                                                                                       @ android.app.activitythread$h.handlemessage(activitythread.java:1373)                                                                                       @ android.os.handler.dispatchmessage(handler.java:102)                                                                                       @ android.os.looper.loop(looper.java:154)                                                                                       @ android.app.activitythread.main(activitythread.java:5529)                                                                                       @ java.lang.reflect.method.invoke(native method)                                                                                       @ com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:739)                                                                                       @ com.android.internal.os.zygoteinit.main(zygoteinit.java:629)                                                                                    caused by: java.lang.reflect.invocationtargetexception                                                                                      @ java.lang.reflect.constructor.newinstance(native method)                                                                                      @ android.view.layoutinflater.createview(layoutinflater.java:623)                                                                                      @ android.view.layoutinflater.createviewfromtag(layoutinflater.java:768)                                                                                       @ android.view.layoutinflater.createviewfromtag(layoutinflater.java:708)                                                                                       @ android.view.layoutinflater.rinflate(layoutinflater.java:839)                                                                                       @ android.view.layoutinflater.rinflatechildren(layoutinflater.java:802)                                                                                       @ android.view.layoutinflater.inflate(layoutinflater.java:519)                                                                                       @ android.view.layoutinflater.inflate(layoutinflater.java:427)                                                                                       @ android.view.layoutinflater.inflate(layoutinflater.java:374)                                                                                       @ android.support.v7.app.appcompatdelegateimplv9.setcontentview(appcompatdelegateimplv9.java:284)                                                                                       @ android.support.v7.app.appcompatactivity.setcontentview(appcompatactivity.java:143)                                                                                       @ com.example.nishant.book.mainactivity.createmainview(mainactivity.java:57)                                                                                       @ com.example.nishant.book.mainactivity.oncreate(mainactivity.java:50)                                                                                       @ android.app.activity.performcreate(activity.java:6303)                                                                                       @ android.app.instrumentation.callactivityoncreate(instrumentation.java:1108)                                                                                       @ android.app.activitythread.performlaunchactivity(activitythread.java:2402)                                                                                       @ android.app.activitythread.handlelaunchactivity(activitythread.java:2509)                                                                                       @ android.app.activitythread.access$1000(activitythread.java:153)                                                                                       @ android.app.activitythread$h.handlemessage(activitythread.java:1373)                                                                                       @ android.os.handler.dispatchmessage(handler.java:102)                                                                                       @ android.os.looper.loop(looper.java:154)                                                                                       @ android.app.activitythread.main(activitythread.java:5529)                                                                                       @ java.lang.reflect.method.invoke(native method)                                                                                       @ com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:739)                                                                                       @ com.android.internal.os.zygoteinit.main(zygoteinit.java:629)                                                                                    caused by: android.content.res.resources$notfoundexception: resource id #0x7f0e0001                                                                                      @ android.content.res.resources.getvalue(resources.java:1369)                                                                                      @ android.content.res.miuiresources.getvalue(miuiresources.java:145)                                                                                      @ android.content.res.resources.loadxmlresourceparser(resources.java:2824)                                                                                      @ android.content.res.resources.getlayout(resources.java:1183)                                                                                      @ android.support.v7.view.supportmenuinflater.inflate(supportmenuinflater.java:119)                                                                                      @ android.support.design.widget.navigationview.inflatemenu(navigationview.java:250)                                                                                      @ android.support.design.widget.navigationview.<init>(navigationview.java:174)                                                                                      @ android.support.design.widget.navigationview.<init>(navigationview.java:100)                                                                                      @ java.lang.reflect.constructor.newinstance(native method)                                                                                       @ android.view.layoutinflater.createview(layoutinflater.java:623)                                                                                       @ android.view.layoutinflater.createviewfromtag(layoutinflater.java:768)                                                                                       @ android.view.layoutinflater.createviewfromtag(layoutinflater.java:708)                                                                                       @ android.view.layoutinflater.rinflate(layoutinflater.java:839)                                                                                       @ android.view.layoutinflater.rinflatechildren(layoutinflater.java:802)                                                                                       @ android.view.layoutinflater.inflate(layoutinflater.java:519)                                                                                       @ android.view.layoutinflater.inflate(layoutinflater.java:427)                                                                                       @ android.view.layoutinflater.inflate(layoutinflater.java:374)                                                                                       @ android.support.v7.app.appcompatdelegateimplv9.setcontentview(appcompatdelegateimplv9.java:284)                                                                                       @ android.support.v7.app.appcompatactivity.setcontentview(appcompatactivity.java:143)                                                                                       @ com.example.nishant.book.mainactivity.createmainview(mainactivity.java:57)                                                                                       @ com.example.nishant.book.mainactivity.oncreate(mainactivity.java:50)                                                                                       @ android.app.activity.performcreate(activity.java:6303)                                                                                       @ android.app.instrumentation.callactivityoncreate(instrumentation.java:1108)                                                                                       @ android.app.activitythread.performlaunchactivity(activitythread.java:2402)                                                                                       @ android.app.activitythread.handlelaunchactivity(activitythread.java:2509)                                                                                       @ android.app.activitythread.access$1000(activitythread.java:153)                                                                                       @ android.app.activitythread$h.handlemessage(activitythread.java:1373)                                                                                       @ android.os.handler.dispatchmessage(handler.java:102)                                                                                       @ android.os.looper.loop(looper.java:154)                                                                                       @ android.app.activitythread.main(activitythread.java:5529)                                                                                       @ java.lang.reflect.method.invoke(native method) 

i think problem app:menu="@array/drawer_array" . should passing menu instead of array.

navigation view:

<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:headerlayout="@layout/nav_header_home"             app:menu="@menu/activity_home_drawer" /> 

under res/menu have activity_home_drawer.xml

<?xml version="1.0" encoding="utf-8"?> <menu xmlns:android="http://schemas.android.com/apk/res/android">      <group android:checkablebehavior="single">         <item             android:id="@+id/nav_favorites"             android:icon="@drawable/ic_favorite_white"             android:title="@string/favorites" />          <item             android:id="@+id/nav_about"             android:icon="@drawable/ic_about"             android:title="@string/about" />     </group>   </menu> 

let me know if works you!


Comments

Popular posts from this blog

node.js - Node js - Trying to send POST request, but it is not loading javascript content -

javascript - Replicate keyboard event with html button -

javascript - Web audio api 5.1 surround example not working in firefox -