android - Espresso InflateException NavigationView -
i'm trying setup dummy test begin android project. i'm unable make app run espresso. without tests, app working fine.
here backtrace:
running tests test running started android.view.inflateexception: binary xml file line #30: error inflating class android.support.design.widget.navigationview @ android.view.layoutinflater.createview(layoutinflater.java:633) @ android.view.layoutinflater.createviewfromtag(layoutinflater.java:743) @ android.view.layoutinflater.rinflate(layoutinflater.java:806) @ android.view.layoutinflater.inflate(layoutinflater.java:504) @ android.view.layoutinflater.inflate(layoutinflater.java:414) @ android.view.layoutinflater.inflate(layoutinflater.java:365) @ android.support.v7.app.appcompatdelegateimplv7.setcontentview(appcompatdelegateimplv7.java:256) @ android.support.v7.app.appcompatactivity.setcontentview(appcompatactivity.java:109) @ com.plop.remote.mainactivity.oncreate(mainactivity.java:62) @ android.app.activity.performcreate(activity.java:5953) @ android.app.instrumentation.callactivityoncreate(instrumentation.java:1128) @ android.support.test.runner.monitoringinstrumentation.callactivityoncreate(monitoringinstrumentation.java:534) @ android.app.activitythread.performlaunchactivity(activitythread.java:2267) @ android.app.activitythread.handlelaunchactivity(activitythread.java:2388) @ android.app.activitythread.access$800(activitythread.java:148) @ android.app.activitythread$h.handlemessage(activitythread.java:1292) @ android.os.handler.dispatchmessage(handler.java:102) @ android.os.looper.loop(looper.java:135) @ android.app.activitythread.main(activitythread.java:5312) @ java.lang.reflect.method.invoke(native method) @ java.lang.reflect.method.invoke(method.java:372) @ com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:901) @ com.android.internal.os.zygoteinit.main(zygoteinit.java:696) caused by: java.lang.reflect.invocationtargetexception @ java.lang.reflect.constructor.newinstance(native method) @ java.lang.reflect.constructor.newinstance(constructor.java:288) @ android.view.layoutinflater.createview(layoutinflater.java:607) ... 22 more caused by: android.view.inflateexception: binary xml file line #17: error inflating class android.support.design.internal.navigationmenuview @ android.view.layoutinflater.createview(layoutinflater.java:633) @ android.view.layoutinflater.createviewfromtag(layoutinflater.java:743) @ android.view.layoutinflater.inflate(layoutinflater.java:482) @ android.view.layoutinflater.inflate(layoutinflater.java:414) @ android.support.design.internal.navigationmenupresenter.getmenuview(navigationmenupresenter.java:97) @ android.support.design.widget.navigationview.<init>(navigationview.java:165) @ android.support.design.widget.navigationview.<init>(navigationview.java:94) ... 25 more caused by: java.lang.reflect.invocationtargetexception @ java.lang.reflect.constructor.newinstance(native method) @ java.lang.reflect.constructor.newinstance(constructor.java:288) @ android.view.layoutinflater.createview(layoutinflater.java:607) ... 31 more caused by: java.lang.illegalstateexception: binary xml file line #17: unable find layoutmanager android.support.v7.widget.@2131296535 @ android.support.v7.widget.recyclerview.createlayoutmanager(recyclerview.java:506) @ android.support.v7.widget.recyclerview.<init>(recyclerview.java:444) @ android.support.design.internal.navigationmenuview.<init>(navigationmenuview.java:40) @ android.support.design.internal.navigationmenuview.<init>(navigationmenuview.java:36) ... 34 more caused by: java.lang.classnotfoundexception: didn't find class "android.support.v7.widget.@2131296535" on path: dexpathlist[[zip file "/system/framework/android.test.runner.jar", zip file "/data/app/com.plop.remote.test-1/base.apk", zip file "/data/app/com.plop.remote-2/base.apk"],nativelibrarydirectories=[/vendor/lib, /system/lib]] @ dalvik.system.basedexclassloader.findclass(basedexclassloader.java:56) @ java.lang.classloader.loadclass(classloader.java:511) @ java.lang.classloader.loadclass(classloader.java:469) @ android.support.v7.widget.recyclerview.createlayoutmanager(recyclerview.java:486) ... 37 more suppressed: java.lang.classnotfoundexception: invalid name: android.support.v7.widget.@2131296535 @ java.lang.class.classforname(native method) @ java.lang.bootclassloader.findclass(classloader.java:781) @ java.lang.bootclassloader.loadclass(classloader.java:841) @ java.lang.classloader.loadclass(classloader.java:504) ... 39 more java.lang.runtimeexception: unable start activity componentinfo{com.plop.remote/com.plop.remote.mainactivity}: android.view.inflateexception: binary xml file line #30: error inflating class android.support.design.widget.navigationview @ android.app.activitythread.performlaunchactivity(activitythread.java:2314) @ android.app.activitythread.handlelaunchactivity(activitythread.java:2388) @ android.app.activitythread.access$800(activitythread.java:148) @ android.app.activitythread$h.handlemessage(activitythread.java:1292) @ android.os.handler.dispatchmessage(handler.java:102) @ android.os.looper.loop(looper.java:135) @ android.app.activitythread.main(activitythread.java:5312) @ java.lang.reflect.method.invoke(native method) @ java.lang.reflect.method.invoke(method.java:372) @ com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:901) @ com.android.internal.os.zygoteinit.main(zygoteinit.java:696) caused by: android.view.inflateexception: binary xml file line #30: error inflating class android.support.design.widget.navigationview @ android.view.layoutinflater.createview(layoutinflater.java:633) @ android.view.layoutinflater.createviewfromtag(layoutinflater.java:743) @ android.view.layoutinflater.rinflate(layoutinflater.java:806) @ android.view.layoutinflater.inflate(layoutinflater.java:504) @ android.view.layoutinflater.inflate(layoutinflater.java:414) @ android.view.layoutinflater.inflate(layoutinflater.java:365) @ android.support.v7.app.appcompatdelegateimplv7.setcontentview(appcompatdelegateimplv7.java:256) @ android.support.v7.app.appcompatactivity.setcontentview(appcompatactivity.java:109) @ com.plop.remote.mainactivity.oncreate(mainactivity.java:62) @ android.app.activity.performcreate(activity.java:5953) @ android.app.instrumentation.callactivityoncreate(instrumentation.java:1128) @ android.support.test.runner.monitoringinstrumentation.callactivityoncreate(monitoringinstrumentation.java:534) @ android.app.activitythread.performlaunchactivity(activitythread.java:2267) ... 10 more caused by: java.lang.reflect.invocationtargetexception @ java.lang.reflect.constructor.newinstance(native method) @ java.lang.reflect.constructor.newinstance(constructor.java:288) @ android.view.layoutinflater.createview(layoutinflater.java:607) ... 22 more caused by: android.view.inflateexception: binary xml file line #17: error inflating class android.support.design.internal.navigationmenuview @ android.view.layoutinflater.createview(layoutinflater.java:633) @ android.view.layoutinflater.createviewfromtag(layoutinflater.java:743) @ android.view.layoutinflater.inflate(layoutinflater.java:482) @ android.view.layoutinflater.inflate(layoutinflater.java:414) @ android.support.design.internal.navigationmenupresenter.getmenuview(navigationmenupresenter.java:97) @ android.support.design.widget.navigationview.<init>(navigationview.java:165) @ android.support.design.widget.navigationview.<init>(navigationview.java:94) ... 25 more caused by: java.lang.reflect.invocationtargetexception @ java.lang.reflect.constructor.newinstance(native method) @ java.lang.reflect.constructor.newinstance(constructor.java:288) @ android.view.layoutinflater.createview(layoutinflater.java:607) ... 31 more caused by: java.lang.illegalstateexception: binary xml file line #17: unable find layoutmanager android.support.v7.widget.@2131296535 @ android.support.v7.widget.recyclerview.createlayoutmanager(recyclerview.java:506) @ android.support.v7.widget.recyclerview.<init>(recyclerview.java:444) @ android.support.design.internal.navigationmenuview.<init>(navigationmenuview.java:40) @ android.support.design.internal.navigationmenuview.<init>(navigationmenuview.java:36) ... 34 more caused by: java.lang.classnotfoundexception: didn't find class "android.support.v7.widget.@2131296535" on path: dexpathlist[[zip file "/system/framework/android.test.runner.jar", zip file "/data/app/com.plop.remote.test-1/base.apk", zip file "/data/app/com.plop.remote-2/base.apk"],nativelibrarydirectories=[/vendor/lib, /system/lib]] @ dalvik.system.basedexclassloader.findclass(basedexclassloader.java:56) @ java.lang.classloader.loadclass(classloader.java:511) @ java.lang.classloader.loadclass(classloader.java:469) @ android.support.v7.widget.recyclerview.createlayoutmanager(recyclerview.java:486) ... 37 more suppressed: java.lang.classnotfoundexception: invalid name: android.support.v7.widget.@2131296535 @ java.lang.class.classforname(native method) @ java.lang.bootclassloader.findclass(classloader.java:781) @ java.lang.bootclassloader.loadclass(classloader.java:841) @ java.lang.classloader.loadclass(classloader.java:504) ... 39 more test running failed: instrumentation run failed due 'java.lang.classnotfoundexception'
my build.gradle:
android { compilesdkversion 23 buildtoolsversion "23.0.2" defaultconfig { applicationid "com.plop.remote" minsdkversion 15 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 project(':box') compile filetree(dir: 'libs', include: ['*.jar']) testcompile 'junit:junit:4.12' compile 'com.android.support:appcompat-v7:23.1.1' compile 'com.android.support:design:23.1.1' compile 'com.android.support:support-v4:23.1.1' compile 'me.neavo:volley:2014.12.09' compile 'com.google.code.gson:gson:2.3.1' androidtestcompile('com.android.support.test.espresso:espresso-core:2.2.1') { exclude group: 'com.android.support', module: 'support-annotations' } androidtestcompile('com.android.support.test:runner:0.4.1') { exclude group: 'com.android.support', module: 'support-annotations' } androidtestcompile('com.android.support.test.espresso:espresso-contrib:2.2.1') { exclude group: 'com.android.support', module: 'support-annotations' exclude module: 'support-v4' } }
and xml seems issue
<?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/main_content" android:layout_width="match_parent" android:layout_height="match_parent" android:fitssystemwindows="true" tools:context="com.plop.remote.mainactivity"> <com.plop.remote.nonswipeableviewpager android:id="@+id/pager" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingtop="50dp"> </com.plop.remote.nonswipeableviewpager> <surfaceview android:layout_width="0px" android:layout_height="0px" android:visibility="gone" /> <include layout="@layout/app_bar_main" 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" android:background="@color/menubackground" app:headerlayout="@layout/nav_header_main" app:itemtextcolor="@color/textcolor" app:menu="@menu/menu_main_drawer" /> </android.support.v4.widget.drawerlayout>
i tried lot stuff in gradle file without success far. instance feel :
why adding espresso-contrib cause inflateexception?
is similar me, except gradle file app still running fine without tests.
same problem , solved this:
androidtestcompile ("com.android.support.test.espresso:espresso-core:$espressoversion"){ exclude group: 'com.android.support', module: 'appcompat-v7' exclude group: 'com.android.support', module: 'support-v4' exclude module: 'recyclerview-v7' } androidtestcompile ("com.android.support.test.espresso:espresso-contrib:$espressoversion"){ exclude group: 'com.android.support', module: 'appcompat-v7' exclude group: 'com.android.support', module: 'support-v4' exclude group: 'com.android.support', module: 'design' exclude module: 'recyclerview-v7' }
Comments
Post a Comment