Coder Social home page Coder Social logo

Espresso-contrib cannot inflate RecyclerView with IllegalStateException (Unable to find LayoutManager) about android-test-kit HOT 5 OPEN

GoogleCodeExporter avatar GoogleCodeExporter commented on May 27, 2024
Espresso-contrib cannot inflate RecyclerView with IllegalStateException (Unable to find LayoutManager)

from android-test-kit.

Comments (5)

GoogleCodeExporter avatar GoogleCodeExporter commented on May 27, 2024
Can you please bump the runner/rules dep to 0.3:

androidTestCompile 'com.android.support.test:runner:0.3'
androidTestCompile 'com.android.support.test:rules:0.3'
androidTestCompile 'com.android.support.test.espresso:espresso-core:2.2'
androidTestCompile 'com.android.support.test.espresso:espresso-intents:2.2'

Does this fix the issue?

Original comment by [email protected] on 8 Jun 2015 at 3:37

from android-test-kit.

GoogleCodeExporter avatar GoogleCodeExporter commented on May 27, 2024
Bumping rules/runner to 0.3 doesn't seem to change anything.

As an experiment, I also tried to set the LayoutManager in the xml:

    <android.support.v7.widget.RecyclerView
        android:id="@+id/my_list"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:scrollbars="vertical"
        android.support.v7.recyclerview:layoutManager="android.support.v7.widget.LinearLayoutManager"
        tools:listItem="@layout/my_list_item" />

This made no difference. I've also played with adding/removing different 
attributes on the RecyclerView, but still haven't had any luck.

I've attached screenshots to show exactly what is happening where the error 
occurs.

It appears the version of recyclerview that is included by espresso-contrib is 
messing with the version I've included in my dependencies (22.2.0), and is 
attempting to reference a default layoutmanager resource that doesn't exist in 
my project. I am able to work around the issue by excluding transitive 
dependencies for espresso-contrib:

    androidTestCompile('com.android.support.test.espresso:espresso-contrib:2.2') {
        exclude group: 'com.android.support'
    }


Original comment by [email protected] on 9 Jun 2015 at 12:21

Attachments:

from android-test-kit.

GoogleCodeExporter avatar GoogleCodeExporter commented on May 27, 2024
espresso-contrib uses 22.2.0 for android.support.*, so this should not be an 
issue. I'll have a closer look and try to reproduce it.

Original comment by [email protected] on 9 Jun 2015 at 2:44

from android-test-kit.

GoogleCodeExporter avatar GoogleCodeExporter commented on May 27, 2024
Same thing here:

android.view.InflateException: Binary XML file line #17: Error inflating class 
android.support.v7.widge
                            t.RecyclerView
                         E      at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2325)
                         E      at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2390)
                         E      at android.app.ActivityThread.access$800(ActivityThread.java:151)
                         E      at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1303)
                         E      at android.os.Handler.dispatchMessage(Handler.java:102)
                         E      at android.os.Looper.loop(Looper.java:135)
                         E      at android.app.ActivityThread.main(ActivityThread.java:5257)
                         E      at java.lang.reflect.Method.invoke(Native Method)
                         E      at java.lang.reflect.Method.invoke(Method.java:372)
                         E      at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903)
                         E      at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)
                         E  Caused by: android.view.InflateException: Binary XML file line #17: Error inflating class android.support.v7.widget.RecyclerView
                         E      at android.view.LayoutInflater.createView(LayoutInflater.java:633)
                         E      at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:743)
                         E      at android.view.LayoutInflater.rInflate(LayoutInflater.java:806)
                         E      at android.view.LayoutInflater.rInflate(LayoutInflater.java:809)
                         E      at android.view.LayoutInflater.inflate(LayoutInflater.java:504)
                         E      at android.view.LayoutInflater.inflate(LayoutInflater.java:414)
                         E      at android.view.LayoutInflater.inflate(LayoutInflater.java:365)
                         E      at android.support.v7.app.AppCompatDelegateImplV7.setContentView(AppCompatDelegateImplV7.java:249)
                         E      at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:106)
                         E      at com.bizzby.app.refactor.presentation.jobcreator.JobCreatorActivity.onCreate(JobCreatorActivity.java:66)
                         E      at android.app.Activity.performCreate(Activity.java:5990)
                         E      at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1106)
                         E      at android.support.test.runner.MonitoringInstrumentation.callActivityOnCreate(MonitoringInstrumentation.java:494)
                         E      at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2278)
                         E      ... 10 more
                         E  Caused by: java.lang.reflect.InvocationTargetException
                         E      at java.lang.reflect.Constructor.newInstance(Native Method)
                         E      at java.lang.reflect.Constructor.newInstance(Constructor.java:288)
                         E      at android.view.LayoutInflater.createView(LayoutInflater.java:607)
                         E      ... 23 more
                         E  Caused by: java.lang.IllegalStateException: Binary XML file line #17: Unable to find LayoutManager android.support.v7.widget.@2131
                            427752
                         E      at android.support.v7.widget.RecyclerView.createLayoutManager(RecyclerView.java:500)
                         E      at android.support.v7.widget.RecyclerView.<init>(RecyclerView.java:438)
                         E      at android.support.v7.widget.RecyclerView.<init>(RecyclerView.java:404)
                         E      ... 26 more
                         E  Caused by: java.lang.ClassNotFoundException: Didn't find class "android.support.v7.widget.@2131427752" on path: DexPathList[[zip f
                            ile "/system/framework/android.test.runner.jar", zip file "/data/app/com.bizzby.app.debug.test-1/base.apk", zip file "/data/app/co
                            m.bizzby.app.debug-1/base.apk"],nativeLibraryDirectories=[/data/app/com.bizzby.app.debug-1/lib/x86, /vendor/lib, /system/lib]]
                         E      at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
                         E      at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
                         E      at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
                         E      at android.support.v7.widget.RecyclerView.createLayoutManager(RecyclerView.java:480)
                         E      ... 28 more
                         E      Suppressed: java.lang.ClassNotFoundException: Invalid name: android.support.v7.widget.@2131427752
                         E          at java.lang.Class.classForName(Native Method)
                         E          at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
                         E          at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
                         E          at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
                         E          ... 30 more


Using:

    androidTestCompile 'com.android.support.test:runner:0.3'
    androidTestCompile 'com.android.support.test:rules:0.3'
    androidTestCompile 'com.android.support.test.espresso:espresso-core:2.2'
    androidTestCompile('com.android.support.test.espresso:espresso-contrib:2.2') 

Original comment by [email protected] on 11 Jun 2015 at 5:46

from android-test-kit.

GoogleCodeExporter avatar GoogleCodeExporter commented on May 27, 2024
In case anybody has the same issue, I found this trick that seems to fix the 
problem:
androidTestCompile('com.android.support.test.espresso:espresso-contrib:2.0') {
    exclude group: 'com.android.support', module: 'appcompat'
    exclude group: 'com.android.support', module: 'support-v4'
    exclude module: 'recyclerview-v7'
}

Source of the trick:
https://androidresearch.wordpress.com/2015/04/04/an-introduction-to-espresso/

Original comment by [email protected] on 18 Jun 2015 at 4:53

from android-test-kit.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.