android - Error in NavigationView methods after updating gradle dependencies -
i have (previously) functioning code:
if (navigationview.getheadercount() > 0) { navigationview.removeheaderview(navigationview.getheaderview(0)); }
after updating gradle dependencies, i'm getting following error:
which strange because can see there's nothing on documentation stating removed or something.
project gradle:
// top-level build file can add configuration options common sub-projects/modules. buildscript { repositories { jcenter() mavencentral() } dependencies { classpath 'com.android.tools.build:gradle:2.1.0' classpath 'com.google.gms:google-services:3.0.0' // note: not place application dependencies here; belong // in individual module build.gradle files } } allprojects { repositories { jcenter() maven { url "https://jitpack.io" } } } task clean(type: delete) { delete rootproject.builddir }
app module gradle (relevant parts only):
android { compilesdkversion 23 buildtoolsversion '23.0.3' defaultconfig { minsdkversion 16 targetsdkversion 23 } dependencies { compile 'com.android.support:appcompat-v7:23.1.0' compile 'com.android.support:design:23.1.0' compile 'com.android.support:support-v13:23.1.0' compile 'com.android.support:recyclerview-v7:23.1.0' compile 'com.android.support:support-v4:23.1.0' compile 'com.android.volley:volley:1.0.0' compile 'com.google.code.gson:gson:2.2.+' compile 'com.nineoldandroids:library:2.4.0' compile 'com.squareup.picasso:picasso:2.5.2' compile 'org.reflections:reflections:0.9.10' compile 'com.jakewharton:butterknife:7.0.1' compile 'com.fenchtose.nocropper:nocropper:0.1.4' compile 'com.squareup.okhttp:okhttp:2.7.5' compile 'com.makeramen:roundedimageview:2.2.1' compile 'com.daimajia.easing:library:1.0.1@aar' compile 'com.daimajia.androidanimations:library:1.1.3@aar' compile 'com.facebook.android:facebook-android-sdk:4.10.1' compile 'com.greysonparrelli.permiso:permiso:0.1.3' compile 'com.firebase:firebase-client-android:2.5.2' compile 'net.danlew:android.joda:2.9.3' compile 'com.google.android.gms:play-services-gcm:9.0.0' } apply plugin: 'com.google.gms.google-services'
edit
after cleaning/rebuilding/restarting, commented 2 lines, , app crashes:
05-28 22:02:43.634 12434-12434/com.example.myapp i/art: rejecting re-init on previously-failed class java.lang.class<android.support.design.internal.navigationmenupresenter> 05-28 22:02:43.637 12434-12434/com.example.myapp d/androidruntime: shutting down vm --------- beginning of crash 05-28 22:02:43.638 12434-12434/com.example.myapp e/androidruntime: fatal exception: main process: com.example.myapp, pid: 12434 java.lang.runtimeexception: unable start activity componentinfo{com.example.myapp/com.example.myapp.ui.maintabscreen.maintabbedactivity}: android.view.inflateexception: binary xml file line #15: binary xml file line #15: error inflating class android.support.design.widget.navigationview @ android.app.activitythread.performlaunchactivity(activitythread.java:2416) @ android.app.activitythread.handlelaunchactivity(activitythread.java:2476) @ android.app.activitythread.-wrap11(activitythread.java) @ android.app.activitythread$h.handlemessage(activitythread.java:1344) @ android.os.handler.dispatchmessage(handler.java:102) @ android.os.looper.loop(looper.java:148) @ android.app.activitythread.main(activitythread.java:5417) @ java.lang.reflect.method.invoke(native method) @ com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:726) @ com.android.internal.os.zygoteinit.main(zygoteinit.java:616) caused by: android.view.inflateexception: binary xml file line #15: binary xml file line #15: error inflating class android.support.design.widget.navigationview @ android.view.layoutinflater.inflate(layoutinflater.java:539) @ android.view.layoutinflater.inflate(layoutinflater.java:423) @ android.view.layoutinflater.inflate(layoutinflater.java:374) @ android.support.v7.app.appcompatdelegateimplv7.setcontentview(appcompatdelegateimplv7.java:256) @ android.support.v7.app.appcompatactivity.setcontentview(appcompatactivity.java:109) @ com.example.myapp.ui.maintabscreen.maintabbedactivity.oncreate(maintabbedactivity.java:74) @ android.app.activity.performcreate(activity.java:6237) @ android.app.instrumentation.callactivityoncreate(instrumentation.java:1107) @ android.app.activitythread.performlaunchactivity(activitythread.java:2369) @ android.app.activitythread.handlelaunchactivity(activitythread.java:2476) @ android.app.activitythread.-wrap11(activitythread.java) @ android.app.activitythread$h.handlemessage(activitythread.java:1344) @ android.os.handler.dispatchmessage(handler.java:102) @ android.os.looper.loop(looper.java:148) @ android.app.activitythread.main(activitythread.java:5417) @ java.lang.reflect.method.invoke(native method) @ com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:726) @ com.android.internal.os.zygoteinit.main(zygoteinit.java:616) caused by: android.view.inflateexception: binary xml file line #15: error inflating class android.support.design.widget.navigationview @ android.view.layoutinflater.createview(layoutinflater.java:645) @ android.view.layoutinflater.createviewfromtag(layoutinflater.java:764) @ android.view.layoutinflater.createviewfromtag(layoutinflater.java:704) @ android.view.layoutinflater.rinflate(layoutinflater.java:835) @ android.view.layoutinflater.rinflatechildren(layoutinflater.java:798) @ android.view.layoutinflater.inflate(layoutinflater.java:515) @ android.view.layoutinflater.inflate(layoutinflater.java:423) @ android.view.layoutinflater.inflate(layoutinflater.java:374) @ android.support.v7.app.appcompatdelegateimplv7.setcontentview(appcompatdelegateimplv7.java:256) @ android.support.v7.app.appcompatactivity.setcontentview(appcompatactivity.java:109) @ com.example.myapp.ui.maintabscreen.maintabbedactivity.oncreate(maintabbedactivity.java:74) @ android.app.activity.performcreate(activity.java:6237) @ android.app.instrumentation.callactivityoncreate(instrumentation.java:1107) @ android.app.activitythread.performlaunchactivity(activitythread.java:2369) @ android.app.activitythread.handlelaunchactivity(activitythread.java:2476) @ android.app.activitythread.-wrap11(activitythread.java) @ android.app.activitythread$h.handlemessage(activitythread.java:1344) @ android.os.handler.dispatchmessage(handler.java:102) @ android.os.looper.loop(looper.java:148) @ android.app.activitythread.main(activitythread.java:5417) @ java.lang.reflect.method.invoke(native method) @ com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:726) @ com.android.internal.os.zygoteinit.main(zygoteinit.java:616) caused by: java.lang.reflect.invocationtargetexception @ java.lang.reflect.constructor.newinstance(native method) @ android.view.layoutinflater.createview(layoutinflater.java:619) @ android.view.layoutinflater.createviewfromtag(layoutinflater.java:764) @ android.view.layoutinflater.createviewfromtag(layoutinflater.java:704) @ android.view.layoutinflater.rinflate(layoutinflater.java:835) @ android.view.layoutinflater.rinflatechildren(layoutinflater.java:798) @ android.view.layoutinflater.inflate(layoutinflater.java:515) @ android.view.layoutinflater.inflate(layoutinflater.java:423) @ android.view.layoutinflater.inflate(layoutinflater.java:374) @ android.support.v7.app.appcompatdelegateimplv7.setcontentview(appcompatdelegateimplv7.java:256) @ android.support.v7.app.appcompatactivity.setcontentview(appcompatactivity.java:109) @ com.example.myapp.ui.maintabscreen.maintabbedactivity.oncreate(maintabbedactivity.java:74) @ android.app.activity.performcreate(activity.java:6237) @ android.app.instrumentation.callactivityoncreate(instrumentation.java:1107) @ android.app.activitythread.performlaunchactivity(activitythread.java:2369) @ android.app.activitythread.handlelaunchactivity(activitythread.java:2476) @ android.app.activitythread.-wrap11(activitythread.java) @ android.app.activitythread$h.handlemessage(activitythread.java:1344) @ android.os.handler.dispatchmessage(handler.java:102) @ android.os.looper.loop(looper.java:148) @ android.app.activitythread.main(activitythread.java:5417) @ java.lang.reflect.method.invoke(native method) @ com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:726) @ com.android.internal.os.zygoteinit.main(zygoteinit.java:616) caused by: java.lang.noclassdeffounderror: android.support.design.internal.navigationmenupresenter @ android.support.design.widget.navigationview.<init>(navigationview.java:82) @ android.support.design.widget.navigationview.<init>(navigationview.java:94) @ java.lang.reflect.constructor.newinstance(native method) @ android.view.layoutinflater.createview(layoutinflater.java:619) @ android.view.layoutinflater.createviewfromtag(layoutinflater.java:764) @ android.view.layoutinflater.createviewfromtag(layoutinflater.java:704) @ android.view.layoutinflater.rinflate(layoutinflater.java:835) @ android.view.layoutinflater.rinflatechildren(layoutinflater.java:798) @ android.view.layoutinflater.inflate(layoutinflater.java:515) @ android.view.layoutinflater.inflate(layoutinflater.java:423) @ android.view.layoutinflater.inflate(layoutinflater.java:374) @ android.support.v7.app.appcompatdelegateimplv7.setcontentview(appcompatdelegateimplv7.java:256) @ android.support.v7.app.appcompatactivity.setcontentview(appcompatactivity.java:109) @ com.example.myapp.ui.maintabscreen.maintabbedactivity.oncreate(maintabbedactivity.java:74) @ android.app.activity.performcreate(activity.java:6237) @ android.app.instrumentation.callactivityoncreate(instrumentation.java:1107) @ android.app.activitythread.performlaunchactivity(activitythread.java:2369) @ android.app.activitythread.handlelaunchactivity(activitythread.java:2476) @ android.app.activitythread.-wrap11(activitythread.java) @ android.app.activitythread$h.handlemessage(activitythread.java:1344) @ android.os.handler.dispatchmessage(handler.java:102) @ android.os.looper.loop(looper.java:148) @ android.app.activitythread.main(activitythread.java:5417) @ java.lang.reflect.method.invoke(native method) @ com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:726) @ com.android.internal.os.zygoteinit.main(zygoteinit.java:616)
note line logged 20 times before crash:
05-28 22:02:43.634 12434-12434/com.example.myapp i/art: rejecting re-init on previously-failed class
after taking @ sdk build tools releases, saw version i'm using (23.3.0) released on march 2016.
the support library version using (23.1.0) from october 2015.
so changed support library version 1 released on may 2016 (23.4.0) , app compiled , ran correctly:
compilesdkversion 23 buildtoolsversion '23.0.3' compile 'com.android.support:appcompat-v7:23.4.0' compile 'com.android.support:design:23.4.0' compile 'com.android.support:support-v13:23.4.0' compile 'com.android.support:recyclerview-v7:23.4.0' compile 'com.android.support:support-v4:23.4.0'
Comments
Post a Comment