Multiple Dex Files Define Landroid/Support/V4/Accessibilityservice/Accessibilityserviceinfocompat

Multiple dex files define Landroid/support/v4/accessibilityservice/AccessibilityServiceInfoCompat

Run gradle -q dependencies (or gradle -q :projectName:dependencies) to generate a dependency report. You should see where r7 is coming from, such as:

compile - Classpath for compiling the main sources.
+--- com.commonsware.cwac:camera-v9:0.5.4
| +--- com.actionbarsherlock:actionbarsherlock:4.4.0
| | \--- com.google.android:support-v4:r7
| +--- com.commonsware.cwac:camera:0.5.4
| \--- com.android.support:support-v4:18.0.+ -> 18.0.0
\--- com.android.support:support-v4:18.0.+ -> 18.0.0

Then, use the exclude directive to block that dependency. In my case, it is coming from my CWAC-Camera library, and so I use:

dependencies {
compile('com.commonsware.cwac:camera-v9:0.5.4') {
exclude module: 'support-v4'
}

compile 'com.android.support:support-v4:18.0.+'
}

(where the second compile statement indicates what version you actually want)

That should clear matters up, as you will see if you run the dependency report again:

compile - Classpath for compiling the main sources.
+--- com.commonsware.cwac:camera-v9:0.5.4
| +--- com.actionbarsherlock:actionbarsherlock:4.4.0
| \--- com.commonsware.cwac:camera:0.5.4
\--- com.android.support:support-v4:18.0.+ -> 18.0.0

Android Studio build error - Multiple dex files define Landroid/support/v4/

For anyone who is interested, I solved my own problem. My mistake was that I had pasted android-support-v4.jar and google-play-services.jar in all of my project's module lib folders (my project consists of 3 modules). What I had to do instead was to paste these jars only into my main module's lib folder, and the other modules would automatically reference them.

Multiple dex files define Landroid/support/v4/accessibilityservice/AccessibilityServiceInfoCompat with Gradle

The problem was in apkLib dependency and confuse msg from Gradle. It was solved like in this answer putting Android-PullToRefresh into separate android library project in Gradle.

multiple dex files define Landroid/support/v4/

the library authors should fix them



Related Topics



Leave a reply



Submit