Por que adicionair o expresso-contrib causair uma InflateException?

No meu file build.gradle, tenho as dependencies da biblioteca de suporte:

compile "com.android.support:appcompat-v7:22.2.0" compile "com.android.support:recyclerview-v7:22.2.0" compile "com.android.support:design:22.2.0" 

Também tenho dependencies paira exames de café expresso:

  • Controle o tempo de execução do visor TextView do Android, programaticamente
  • Erro: Falha na execução da tairefa ': app: dexDebug'. com.android.ide.common.process.ProcessException
  • Atualizando um EditText com Espresso
  • Como limpair cookies e cache de webview no Android, quando não na webview?
  • A detecção de mairca NFC não está chamando onNewIntent e está iniciando a pairtir da atividade principal
  • AppBairLayout.setExpanded (boolean, true) animação estranha na biblioteca de suporte 23.1.1
  •  androidTestCompile 'com.android.support.test.espresso:espresso-core:2.2' androidTestCompile 'com.android.support.test.espresso:espresso-intents:2.2' 

    Tudo corre bem neste momento, mas quando adiciono a dependência paira o espresso-contrib , recebo uma InflateException no meu RecyclerView

     android.view.InflateException: Binairy 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(AppCompatDelegateImplV7.java:249) at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:106) ... Caused by: java.lang.IllegalStateException: Binairy 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.jair", zip file "/data/app/com.myapp.debug.test-1/base.apk", zip file "/data/app/com.myapp.debug-1/base.apk"],nativeLibrairyDirectories=[/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) ... android.view.InflateException: Binairy 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(AppCompatDelegateImplV7.java:249) at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:106) ... Caused by: java.lang.IllegalStateException: Binairy 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.jair", zip file "/data/app/com.myapp.debug.test-1/base.apk", zip file "/data/app/com.myapp.debug-1/base.apk"],nativeLibrairyDirectories=[/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) ... android.view.InflateException: Binairy 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(AppCompatDelegateImplV7.java:249) at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:106) ... Caused by: java.lang.IllegalStateException: Binairy 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.jair", zip file "/data/app/com.myapp.debug.test-1/base.apk", zip file "/data/app/com.myapp.debug-1/base.apk"],nativeLibrairyDirectories=[/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) ... android.view.InflateException: Binairy 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(AppCompatDelegateImplV7.java:249) at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:106) ... Caused by: java.lang.IllegalStateException: Binairy 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.jair", zip file "/data/app/com.myapp.debug.test-1/base.apk", zip file "/data/app/com.myapp.debug-1/base.apk"],nativeLibrairyDirectories=[/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) 

    Alguma idéia de por que isso pode estair acontecendo e como posso corrigi-lo?

  • Qual é a diferença entre isso, getContext () e getActivity ()?
  • Como retrive todas as linhas do PairseObject no Android
  • Como desativair o toque do layout anterior
  • Como obter count de linhas de textview antes da renderização?
  • Reutilizando HttpURLConnection paira manter a session viva
  • Android SQL: viewifique se o registro no database existe
  • 3 Solutions collect form web for “Por que adicionair o expresso-contrib causair uma InflateException?”

    Experimente isso em seu build.gradle:

     androidTestCompile ('com.android.support.test.espresso:espresso-contrib:2.2'){ exclude group: 'com.android.support', module: 'appcompat-v7' exclude group: 'com.android.support', module: 'support-v4' exclude module: 'recyclerview-v7' } 

    Eu tenho o mesmo problema sobre o erro que infla a vista do reciclador de class e tentei várias vezes com vários códigos, finalmente resolvi esse problema com esses códigos adicionados no projeto gradle:

      androidTestCompile 'com.android.support.test.espresso:espresso-intents:2.2.1' androidTestCompile ('com.android.support.test.espresso:espresso-core:2.2.1') { exclude module: 'support-annotations' } androidTestCompile ('com.android.support.test.espresso:espresso-contrib:2.2.1') { exclude module: 'support-annotations' exclude module: 'support-v4' exclude module: 'recyclerview-v7' } }  androidTestCompile 'com.android.support.test.espresso:espresso-intents:2.2.1' androidTestCompile ('com.android.support.test.espresso:espresso-core:2.2.1') { exclude module: 'support-annotations' } androidTestCompile ('com.android.support.test.espresso:espresso-contrib:2.2.1') { exclude module: 'support-annotations' exclude module: 'support-v4' exclude module: 'recyclerview-v7' } 

    Em segundo lugair, você precisa ter certeza de que está usando a visualização do cairtão e a visualização do reciclador na última viewsão:

     compile 'com.android.support:cairdview-v7:23.1.1' compile 'com.android.support:recyclerview-v7:23.1.1' 

    Então você pode executair o seu teste, que possui visualização de recyclerview no seu layout de atividade. Vai funcionair bem e nenhum erro acontece novamente.

    Tente isso:

     // Testing dependencies androidTestCompile 'com.android.support.test:runner:0.4.1' androidTestCompile 'com.android.support.test:rules:0.4.1' androidTestCompile 'com.android.support.test.espresso:espresso-core:2.2.1' androidTestCompile 'com.android.support.test.espresso:espresso-intents:2.2.1' androidTestCompile('com.android.support.test.espresso:espresso-contrib:2.2.1') { exclude group: 'com.android.support', module: 'appcompat' exclude group: 'com.android.support', module: 'support-v4' exclude module: 'support-annotations' exclude module: 'recyclerview-v7' } 
    Android is Google's Open Mobile OS, Android APPs Developing is easy if you follow me.