0

I've trying to remove a module from a dependency: accessibility-test-framework

org.robolectric:robolectric:3.2.2 uses

com.google.android.apps.common.testing.accessibility.framework:accessibility-test-framework:2.1

com.android.support.test.espresso:espresso-contrib:2.2.2 uses

com.google.android.apps.common.testing.accessibility.framework:accessibility-test-framework:2.0

My gradle file looks like this:

compile 'com.android.support.test.espresso:espresso-core:2.2.2'


testCompile ("org.robolectric:robolectric:3.2.2") {
    exclude module: 'accessibility-test-framework'
}

I can see the error:

Warning:Conflict with dependency 'com.google.android.apps.common.testing.accessibility.framework:accessibility-test-framework'. Resolved versions for app (2.0) and test app (2.1) differ. See http://g.co/androidstudio/app-test-app-conflict for details.

When I cd into the app's working directory and preform a

./gradlew -q app:dependencies

Please see the last line:

_mockDebugUnitTestCompile - ## Internal use, do not manually configure ##
+--- com.android.support:support-annotations:25.1.1
+--- com.android.support:design:25.1.1
|    +--- com.android.support:support-v4:25.1.1
|    |    +--- com.android.support:support-compat:25.1.1
|    |    |    \--- com.android.support:support-annotations:25.1.1
|    |    +--- com.android.support:support-media-compat:25.1.1
|    |    |    +--- com.android.support:support-annotations:25.1.1
|    |    |    \--- com.android.support:support-compat:25.1.1 (*)
|    |    +--- com.android.support:support-core-utils:25.1.1
|    |    |    +--- com.android.support:support-annotations:25.1.1
|    |    |    \--- com.android.support:support-compat:25.1.1 (*)
|    |    +--- com.android.support:support-core-ui:25.1.1
|    |    |    +--- com.android.support:support-annotations:25.1.1
|    |    |    \--- com.android.support:support-compat:25.1.1 (*)
|    |    \--- com.android.support:support-fragment:25.1.1
|    |         +--- com.android.support:support-compat:25.1.1 (*)
|    |         +--- com.android.support:support-media-compat:25.1.1 (*)
|    |         +--- com.android.support:support-core-ui:25.1.1 (*)
|    |         \--- com.android.support:support-core-utils:25.1.1 (*)
|    +--- com.android.support:appcompat-v7:25.1.1
|    |    +--- com.android.support:support-annotations:25.1.1
|    |    +--- com.android.support:support-v4:25.1.1 (*)
|    |    +--- com.android.support:support-vector-drawable:25.1.1
|    |    |    +--- com.android.support:support-annotations:25.1.1
|    |    |    \--- com.android.support:support-compat:25.1.1 (*)
|    |    \--- com.android.support:animated-vector-drawable:25.1.1
|    |         \--- com.android.support:support-vector-drawable:25.1.1 (*)
|    +--- com.android.support:recyclerview-v7:25.1.1
|    |    +--- com.android.support:support-annotations:25.1.1
|    |    +--- com.android.support:support-compat:25.1.1 (*)
|    |    \--- com.android.support:support-core-ui:25.1.1 (*)
|    \--- com.android.support:transition:25.1.1
|         +--- com.android.support:support-annotations:25.1.1
|         \--- com.android.support:support-v4:25.1.1 (*)
+--- org.mockito:mockito-core:2.0.111-beta
|    +--- net.bytebuddy:byte-buddy:1.4.17
|    \--- org.objenesis:objenesis:2.4
+--- org.powermock:powermock-api-mockito:1.6.1
|    +--- org.mockito:mockito-all:1.10.8
|    \--- org.powermock:powermock-api-support:1.6.1
|         +--- org.powermock:powermock-core:1.6.1
|         |    +--- org.powermock:powermock-reflect:1.6.1
|         |    |    \--- org.objenesis:objenesis:2.1 -> 2.4
|         |    \--- org.javassist:javassist:3.18.2-GA
|         \--- org.powermock:powermock-reflect:1.6.1 (*)
+--- org.powermock:powermock-module-junit4-rule-agent:1.6.1
|    +--- org.powermock:powermock-module-javaagent:1.6.1
|    |    \--- org.powermock:powermock-core:1.6.1 (*)
|    \--- org.powermock:powermock-core:1.6.1 (*)
+--- org.powermock:powermock-module-junit4-rule:1.6.1
|    +--- org.powermock:powermock-classloading-base:1.6.1
|    |    +--- org.powermock:powermock-api-support:1.6.1 (*)
|    |    \--- org.powermock:powermock-reflect:1.6.1 (*)
|    \--- org.powermock:powermock-core:1.6.1 (*)
+--- org.powermock:powermock-module-junit4:1.6.1
|    +--- junit:junit:4.12
|    |    \--- org.hamcrest:hamcrest-core:1.3
|    \--- org.powermock:powermock-module-junit4-common:1.6.1
|         +--- junit:junit:4.4 -> 4.12 (*)
|         +--- org.powermock:powermock-core:1.6.1 (*)
|         \--- org.powermock:powermock-reflect:1.6.1 (*)
+--- org.robolectric:robolectric:3.2.2
|    +--- org.robolectric:robolectric-annotations:3.2.2
|    +--- org.robolectric:robolectric-resources:3.2.2
|    |    +--- org.robolectric:robolectric-utils:3.2.2
|    |    |    +--- org.ow2.asm:asm:5.0.1
|    |    |    +--- org.ow2.asm:asm-commons:5.0.1
|    |    |    |    \--- org.ow2.asm:asm-tree:5.0.1
|    |    |    |         \--- org.ow2.asm:asm:5.0.1
|    |    |    +--- org.robolectric:robolectric-annotations:3.2.2
|    |    |    \--- com.google.android.apps.common.testing.accessibility.framework:accessibility-test-framework:2.1

Any idea?

Gabriele Mariotti
  • 320,139
  • 94
  • 887
  • 841
Killesk
  • 2,734
  • 3
  • 22
  • 29

1 Answers1

1

You are using different version in your app and in your test.

You can force the library in your app using:

compile 'com.google.android.apps.common.testing.accessibility.framework:accessibility-test-framework:2.1.0'

or can use the espresso framework only on the test to avoid the issue:

androidTestcompile 'com.android.support.test.espresso:espresso-core:2.2.2'
Gabriele Mariotti
  • 320,139
  • 94
  • 887
  • 841
  • Hi Gabtiele, thanks for your comment. I've another question regarding moving espresso-core into android TestCompile -> http://stackoverflow.com/questions/42510579/android-androidtestcompile-espresso-core-causing-filenotfoundexception-r-txt – Killesk Mar 01 '17 at 13:09
  • But, I tried your first response and it works. You need to take the last .0 out though -> compile 'com.google.android.apps.common.testing.accessibility.framework:accessibility-test-framework:2. – Killesk Mar 01 '17 at 13:11
  • Hey guys, you declared test dependency in compile scope, are you sure? – Eugen Martynov Mar 01 '17 at 19:29
  • Not the best option and I suggest the second option. But he is declaring other test dependencies in the app. – Gabriele Mariotti Mar 01 '17 at 19:47