What steps will reproduce the problem?
1. Set up an activity that contains a RecyclerView exactly as shown in the
official examples.
2. Run the app and see that it works.
3. Write a test that starts that activity with the following dependencies:
androidTestCompile 'com.android.support.test:runner:0.2'
androidTestCompile 'com.android.support.test:rules:0.2'
androidTestCompile 'com.android.support.test.espresso:espresso-core:2.2'
androidTestCompile 'com.android.support.test.espresso:espresso-intents:2.2'
4. Run the test and see that there are no problems.
5. Add the following dependency:
androidTestCompile 'com.android.support.test.espresso:espresso-contrib:2.2'
6. Run the test and see that the RecyclerView could not be inflated because the
LayoutManager instance couldn't be found.
What is the expected output? What do you see instead?
The test should work exactly as it did before espresso-contrib was included in
the dependencies. Instead, the test raise an IllegalStateException:
android.view.InflateException: Binary XML file line #33: Error inflating class
android.support.v7.widget.RecyclerView
at android.view.LayoutInflater.createView(LayoutInflater.java:633)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:743)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:806)
at android.view.LayoutInflater.inflate(LayoutInflater.java:504)
at android.view.LayoutInflater.inflate(LayoutInflater.java:414)
at android.view.LayoutInflater.inflate(LayoutInflater.java:365)
at
android.support.v7.app.AppCompatDelegateImplV7.setContentView(AppCompatDelegateI
mplV7.java:249)
at
android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:1
06)
...
Caused by: java.lang.IllegalStateException: Binary XML file line #33: Unable to
find LayoutManager android.support.v7.widget.@2131296518
at
android.support.v7.widget.RecyclerView.createLayoutManager(RecyclerView.java:500
)
at android.support.v7.widget.RecyclerView.<init>(RecyclerView.java:438)
at android.support.v7.widget.RecyclerView.<init>(RecyclerView.java:404)
...
Caused by: java.lang.ClassNotFoundException: Didn't find class
"android.support.v7.widget.@2131296518" on path: DexPathList[[zip file
"/system/framework/android.test.runner.jar", zip file
"/data/app/com.myapp.debug.test-1/base.apk", zip file
"/data/app/com.myapp.debug-1/base.apk"],nativeLibraryDirectories=[/vendor/lib,
/system/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
at
android.support.v7.widget.RecyclerView.createLayoutManager(RecyclerView.java:480
)
...
Suppressed: java.lang.ClassNotFoundException: Invalid name:
android.support.v7.widget.@2131296518
at java.lang.Class.classForName(Native Method)
at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
What version of the product are you using? On what operating system?
Using following versions:
compileSdkVersion 22
gradle plugin 1.2.3
buildTools 22.0.1
minSdkVersion 16
recyclerview-v7:22.2.0
appcompat-v7:22.2.0
design:22.2.0
Mac OSX 10.10.3
Android Studio 1.3.0-preview2
Please provide any additional information below.
Stack Overflow question:
https://stackoverflow.com/questions/30578243/why-would-adding-espresso-contrib-c
ause-an-inflateexception
Original issue reported on code.google.com by kovach...@gmail.com on 2 Jun 2015 at 4:08
Original issue reported on code.google.com by
kovach...@gmail.com
on 2 Jun 2015 at 4:08