139

I'm trying to run some Android tests, however, the compiler complains that multiple dex files exist.

Multiple dex files define Lorg/hamcrest/MatcherAssert;

So I'm trying to filter duplicated dependencies: $ ./gradlew -q dependencies app:dependencies --configuration androidTestCompile

However I get the following output:

------------------------------------------------------------
Project :app
------------------------------------------------------------

androidTestCompile - Classpath for compiling the androidTest sources.
+--- org.mockito:mockito-core:1.9.5
|    +--- org.hamcrest:hamcrest-core:1.1 -> 1.3
|    \--- org.objenesis:objenesis:1.0 -> 2.1
+--- com.google.dexmaker:dexmaker-mockito:1.2
|    +--- com.google.dexmaker:dexmaker:1.2
|    \--- org.mockito:mockito-core:1.9.5 (*)
+--- com.android.support.test.espresso:espresso-core:2.0
|    +--- com.squareup:javawriter:2.1.1
|    +--- org.hamcrest:hamcrest-integration:1.1
|    |    \--- org.hamcrest:hamcrest-core:1.1 -> 1.3
|    +--- org.hamcrest:hamcrest-library:1.1
|    |    \--- org.hamcrest:hamcrest-core:1.1 -> 1.3
|    +--- javax.inject:javax.inject:1
|    +--- com.android.support.test.espresso:espresso-idling-resource:2.0
|    +--- com.android.support.test:testing-support-lib:0.1
|    |    \--- junit:junit-dep:4.10
|    |         \--- org.hamcrest:hamcrest-core:1.1 -> 1.3
|    +--- com.google.code.findbugs:jsr305:2.0.1
|    +--- javax.annotation:javax.annotation-api:1.2
|    \--- org.hamcrest:hamcrest-core:1.1 -> 1.3
+--- com.android.support.test:testing-support-lib:0.1 (*)
+--- org.powermock:powermock-module-junit4:1.5.6
|    +--- junit:junit:4.11
|    |    \--- org.hamcrest:hamcrest-core:1.3
|    \--- org.powermock:powermock-module-junit4-common:1.5.6
|         +--- junit:junit:4.4 -> 4.11 (*)
|         +--- org.powermock:powermock-core:1.5.6
|         |    +--- org.powermock:powermock-reflect:1.5.6
|         |    |    \--- org.objenesis:objenesis:2.1
|         |    \--- org.javassist:javassist:3.18.2-GA
|         \--- org.powermock:powermock-reflect:1.5.6 (*)
\--- org.powermock:powermock-api-mockito:1.5.6
     \--- org.powermock:powermock-api-support:1.5.6
          +--- org.powermock:powermock-core:1.5.6 (*)
          \--- org.powermock:powermock-reflect:1.5.6 (*)

(*) - dependencies omitted (listed previously)

I'm confused as what the arrows (->) mean. What do they mean?

Opal
  • 81,889
  • 28
  • 189
  • 210
Some Noob Student
  • 14,186
  • 13
  • 65
  • 103

1 Answers1

207

It means that dependency graph contains multiple dependencies with the same group and module but different versions for e.g. org.hamcrest:hamcrest-core. Gradle tries to resolve conflicted versions automatically - by default the latest version is chosen. On the left side of -> is the requested version, on the right the version that will be picked. Here similar question can be found.

Opal
  • 81,889
  • 28
  • 189
  • 210
  • 1
    I have upvoted, can you explain what dependencies omitted means? – java123999 Jan 11 '16 at 12:56
  • 1
    It means that elsewhere in the report, the dependency was already presented with the whole subdependencies, hence here it's root only. – Opal Jan 11 '16 at 13:01
  • 4
    @java123999. A dependency may have it's own dependencies. Iy also may happen that a dependency is listed twice. In such a case only dependencies for the first entry will be printed while the second entry will be marked with `(*)`. – Opal Jan 11 '16 at 13:42
  • 1
    So the * basically indicates duplicate dependencies? – java123999 Jan 11 '16 at 14:21
  • 1
    If I wouldn't have to write at least x signs Inwould just write: yes. – Opal Jan 11 '16 at 14:30
  • How do you know which dependencies are in conflict – pain Jul 12 '22 at 05:12