How to solve Multiple dex files define Landroid/support/v4/accessibilityservice/AccessibilityServiceInfoCompat

cover from https://stackoverflow.com/questions/20989317/multiple-dex-files-define-landroid-support-v4-accessibilityservice-accessibility

|

176

<a class="vote-down-off" title="This question does not show any research effort; it is unclear or not useful" style="margin: 0px auto 10px; padding: 0px; border: 0px; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; font-size: 1px; line-height: inherit; font-family: inherit; vertical-align: baseline; color: rgb(0, 119, 204); text-decoration: none; cursor: pointer; background-image: url("img/sprites.svg?v=1b3cdae197be"), none; background-size: initial; background-repeat: no-repeat; overflow: hidden; display: block; text-indent: -9999em; width: 40px; height: 30px; background-position: 0px -220px;">down vote</a>favorite

85

|

If I run

gradle assembleDebug

from the command line, I am suddenly getting this error:

UNEXPECTED TOP-LEVEL EXCEPTION:
com.android.dx.util.DexException: Multiple dex files define Landroid/support/v4/accessibilityservice/AccessibilityServiceInfoCompat$AccessibilityServiceInfoVersionImpl;
    at com.android.dx.merge.DexMerger.readSortableTypes(DexMerger.java:592)
    at com.android.dx.merge.DexMerger.getSortedTypes(DexMerger.java:550)
    at com.android.dx.merge.DexMerger.mergeClassDefs(DexMerger.java:531)
    at com.android.dx.merge.DexMerger.mergeDexBuffers(DexMerger.java:168)
    at com.android.dx.merge.DexMerger.merge(DexMerger.java:186)
    at com.android.dx.command.dexer.Main.mergeLibraryDexBuffers(Main.java:300)
    at com.android.dx.command.dexer.Main.run(Main.java:232)
    at com.android.dx.command.dexer.Main.main(Main.java:174)
    at com.android.dx.command.Main.main(Main.java:91)

If I grep for v4 I see two files inside my build folder.

Binary file build/pre-dexed/debug/support-v4-19.0.0-2ba5fdd60a6c3836b3104a863fe42897da1fa9d1.jar matches
Binary file build/pre-dexed/debug/support-v4-r7-227d905d79b23b20866531d4f700446c040a2ccb.jar matches

My gradle file includes only this support library:

compile 'com.android.support:support-v13:19.0.0'

I am stumped as to how the r7 library is included somehow. I've run

gradle clean

and it always appears there when I rerun assembleDebug.

If I grep for r7 inside the build directory, I see it inside the file:

Binary file build/exploded-bundles/ComGoogleAndroidGmsPlayServices4030.aar/classes.jar matches

If I don't include v13, then other things don't compile.

But doesn't v13 include v4 support library?

Is this an incompatibility between play services AAR bundle and the v13 library?

I grabbed the gradle file from gradleplease.appspot.com.

Removing play services does not fix it; same error.

My dependencies inside build.gradle:

 dependencies {

 // Google Play Services
//compile 'com.google.android.gms:play-services:4.0.30'

// Support Libraries
//compile 'com.android.support:support-v4:19.0.0'
///compile 'com.android.support:appcompat-v7:19.0.0'
//compile 'com.android.support:gridlayout-v7:19.0.0'
compile 'com.android.support:support-v13:19.0.0'
compile 'org.eclipse.mylyn.github:org.eclipse.egit.github.core:2.1.5'
compile 'commons-codec:commons-codec:1.9'
compile 'com.madgag:markdownj-core:0.4.1'
compile 'com.wu-man:android-oauth-client:0.0.2'
compile 'com.google.http-client:google-http-client-jackson2:1.17.0-rc'
compile 'org.apache.commons:commons-lang3:3.2'
compile 'com.google.code.gson:gson:2.2.4'
}

[
image

android](https://stackoverflow.com/questions/tagged/android "show questions tagged 'android'")

gradle

android-support-library

android-gradle

|

share

improve this question

|

[edited

Jan 13 '14 at 19:08](https://stackoverflow.com/posts/20989317/revisions "show all edits to this post")

CommonsWare

687k

117

1666

1716

|

asked

Jan 8 '14 at 7:20

xrd

1,672

4

17

21

|

|
| |

|

|

1

| |

|

I tried all the solutions, and It happened all of them didn't work. Than I just created a new project with the same name, and copied all the files from the old project. And It works great now. Hope it helps.

Sam003

Mar 25 '15 at 20:01

|

<a class="js-add-link comments-link disabled-link " title="Use comments to ask for more information or suggest improvements. Avoid answering questions in comments." style="margin: 0px; padding: 0px 3px 2px; border: 0px; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; font-size: inherit; line-height: inherit; font-family: inherit; vertical-align: baseline; color: rgb(132, 141, 149); text-decoration: none; cursor: pointer; opacity: 0.6;">add a comment</a>

|

<a name="tab-top" style="margin: 0px; padding: 0px; border: 0px; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; font-size: inherit; line-height: inherit; font-family: inherit; vertical-align: baseline; color: rgb(0, 119, 204); text-decoration: none; cursor: pointer;"></a>

21 Answers

activeoldestvotes

<a name="21100040" style="margin: 0px; padding: 0px; border: 0px; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; font-size: inherit; line-height: inherit; font-family: inherit; vertical-align: baseline; color: rgb(0, 119, 204); text-decoration: none; cursor: pointer;"></a>

|

<a class="vote-up-off" title="This answer is useful" style="margin: 0px auto 2px; padding: 0px; border: 0px; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; font-size: 1px; line-height: inherit; font-family: inherit; vertical-align: baseline; color: rgb(0, 119, 204); text-decoration: none; cursor: pointer; background-image: url("img/sprites.svg?v=1b3cdae197be"), none; background-size: initial; background-repeat: no-repeat; overflow: hidden; display: block; text-indent: -9999em; width: 40px; height: 30px; background-position: 0px -170px;">up vote</a>

263

<a class="vote-down-off" title="This answer is not useful" style="margin: 0px auto 10px; padding: 0px; border: 0px; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; font-size: 1px; line-height: inherit; font-family: inherit; vertical-align: baseline; color: rgb(0, 119, 204); text-decoration: none; cursor: pointer; background-image: url("img/sprites.svg?v=1b3cdae197be"), none; background-size: initial; background-repeat: no-repeat; overflow: hidden; display: block; text-indent: -9999em; width: 40px; height: 30px; background-position: 0px -220px;">down vote</a>

accepted

|

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

|

share

improve this answer

|

[edited

Nov 17 '14 at 16:35](https://stackoverflow.com/posts/21100040/revisions "show all edits to this post")

|

answered

Jan 13 '14 at 19:47

CommonsWare

687k

117

1666

1716

|

|
| |

|

|

3

| |

|

Is there a method for inspecting/excluding modules from .jar dependencies not available on Maven?

gradle dependencies

seems to not report dependencies added with

compile files('libs/example.jar')

dbro

Jan 21 '14 at 20:47

|
|

|

3

| |

|

Let's say I have two

libs/*.jar

dependencies with a module in common, neither is available as an artifact. Any way to perform a similar dependency inspection / class exclusion?

dbro

Jan 21 '14 at 20:59

|
|

|

2

| |

|

@dbro: Not that I am aware of, but, then again, I have not researched this point. IMHO, off the cuff, one or both of those JAR files feel mis-packaged, as the module in common should be factored out into its own JAR.

CommonsWare

Jan 21 '14 at 21:15

|
|

|

10

| |

|

./gradlew -q :projectName:dependencies worked for me

Defuera

Nov 17 '14 at 16:28

|
|

|

14

| |

|

Quick tip for those exlucing a module from a module dependency: You have to turn your

compile project(':foo')

into

compile(project(':foo')) { exclude module: 'support-v4' }. Note the parenthesis.

espinchi

Nov 22 '14 at 17:28

|

[show

25

more comments](https://stackoverflow.com/questions/20989317/multiple-dex-files-define-landroid-support-v4-accessibilityservice-accessibility# "expand to show all comments on this post")

|

<a name="24025291" style="margin: 0px; padding: 0px; border: 0px; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; font-size: inherit; line-height: inherit; font-family: inherit; vertical-align: baseline; color: rgb(0, 119, 204); text-decoration: none; cursor: pointer;"></a>

|

<a class="vote-up-off" title="This answer is useful" style="margin: 0px auto 2px; padding: 0px; border: 0px; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; font-size: 1px; line-height: inherit; font-family: inherit; vertical-align: baseline; color: rgb(0, 119, 204); text-decoration: none; cursor: pointer; background-image: url("img/sprites.svg?v=1b3cdae197be"), none; background-size: initial; background-repeat: no-repeat; overflow: hidden; display: block; text-indent: -9999em; width: 40px; height: 30px; background-position: 0px -170px;">up vote</a>

108

<a class="vote-down-off" title="This answer is not useful" style="margin: 0px auto 10px; padding: 0px; border: 0px; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; font-size: 1px; line-height: inherit; font-family: inherit; vertical-align: baseline; color: rgb(0, 119, 204); text-decoration: none; cursor: pointer; background-image: url("img/sprites.svg?v=1b3cdae197be"), none; background-size: initial; background-repeat: no-repeat; overflow: hidden; display: block; text-indent: -9999em; width: 40px; height: 30px; background-position: 0px -220px;">down vote</a>

|

I solved similar error by adding following piece of code to my

build.gradle

file inside the android block.

android {
    dexOptions {
        preDexLibraries = false
    }
}

|

share

improve this answer

|

[edited

Jan 21 '16 at 0:26](https://stackoverflow.com/posts/24025291/revisions "show all edits to this post")

Sebas Hollow

85

7

|

answered

Jun 3 '14 at 21:32

mike.tihonchik

3,732

3

21

34

|

|
| |

|

|

4

| |

|

Worked for me! Is there any down sides of doing it this way?

Barrie Galitzky

Jul 23 '14 at 5:00

|
|

| | |

|

@BarrieGalitzky I haven't ran into any issues so far

mike.tihonchik

Jul 23 '14 at 13:13

|
|

|

3

| |

|

Thanks man, this worked perfectly to solve the issue! Anyway, I think that it has some side effects.. The assembleDebug task became 3 times slower!

marino

Oct 23 '14 at 0:40

|
|

|

5

| |

|

Wondering what @CommonsWare would have to say about this solution...

treesAreEverywhere

Aug 28 '15 at 18:16

|
|

|

2

| |

|

After adding this, I got "Translation has been interrupted" error. Guess I've to give CommonsWare method a try.

DroidHeaven

May 20 at 9:26

|

[show

9

more comments](https://stackoverflow.com/questions/20989317/multiple-dex-files-define-landroid-support-v4-accessibilityservice-accessibility# "expand to show all comments on this post")

|

<a name="23391996" style="margin: 0px; padding: 0px; border: 0px; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; font-size: inherit; line-height: inherit; font-family: inherit; vertical-align: baseline; color: rgb(0, 119, 204); text-decoration: none; cursor: pointer;"></a>

|

<a class="vote-up-off" title="This answer is useful" style="margin: 0px auto 2px; padding: 0px; border: 0px; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; font-size: 1px; line-height: inherit; font-family: inherit; vertical-align: baseline; color: rgb(0, 119, 204); text-decoration: none; cursor: pointer; background-image: url("img/sprites.svg?v=1b3cdae197be"), none; background-size: initial; background-repeat: no-repeat; overflow: hidden; display: block; text-indent: -9999em; width: 40px; height: 30px; background-position: 0px -170px;">up vote</a>

32

<a class="vote-down-off" title="This answer is not useful" style="margin: 0px auto 10px; padding: 0px; border: 0px; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; font-size: 1px; line-height: inherit; font-family: inherit; vertical-align: baseline; color: rgb(0, 119, 204); text-decoration: none; cursor: pointer; background-image: url("img/sprites.svg?v=1b3cdae197be"), none; background-size: initial; background-repeat: no-repeat; overflow: hidden; display: block; text-indent: -9999em; width: 40px; height: 30px; background-position: 0px -220px;">down vote</a>

|

Also to note you can see your android dependencies, by going to your Android Studio Gradle view, and selecting the target "androidDependencies".

One more tip: I was having this issue, until I removed the v4 support lib from the libs folder in both the project and my related module/library project(s).

|

share

improve this answer

|

answered

Apr 30 '14 at 15:20

edsappfactory.com

359

3

7

|

|
| |

|

|

3

| |

|

More specific instruction? Can't find "androidDependencies". Thx

CopperCash

Jul 9 '14 at 2:37

|
|

| | |

|

Go to the Gradle view, then find the heading All tasks, drill down on your app's name, then drill down on ":app", you will find "androidDependencies" there.

AutoM8R

Dec 7 '14 at 20:08

|
|

|

1

| |

|

Where is the Gradle view?

Paul Beusterien

Feb 4 '15 at 22:08

|
|

|

3

| |

|

@PaulBeusterien If you look to the far right side of the window, there's a sideways tab marked Gradle. Click it to open a pinned view. The androidDependencies is actually a gradle task

JCricket

Feb 5 '15 at 16:01

|
|

| | |

|

thank you man, i posted screenshots explaining your answer to make it easier.

MBH

Jan 18 '16 at 9:37

|

<a class="js-add-link comments-link disabled-link " title="Use comments to ask for more information or suggest improvements. Avoid comments like “+1” or “thanks”." style="margin: 0px; padding: 0px 3px 2px; border: 0px; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; font-size: inherit; line-height: inherit; font-family: inherit; vertical-align: baseline; color: rgb(132, 141, 149); text-decoration: none; cursor: pointer; opacity: 0.6;">add a comment</a>

|

<a name="34851393" style="margin: 0px; padding: 0px; border: 0px; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; font-size: inherit; line-height: inherit; font-family: inherit; vertical-align: baseline; color: rgb(0, 119, 204); text-decoration: none; cursor: pointer;"></a>

|

<a class="vote-up-off" title="This answer is useful" style="margin: 0px auto 2px; padding: 0px; border: 0px; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; font-size: 1px; line-height: inherit; font-family: inherit; vertical-align: baseline; color: rgb(0, 119, 204); text-decoration: none; cursor: pointer; background-image: url("img/sprites.svg?v=1b3cdae197be"), none; background-size: initial; background-repeat: no-repeat; overflow: hidden; display: block; text-indent: -9999em; width: 40px; height: 30px; background-position: 0px -170px;">up vote</a>

23

<a class="vote-down-off" title="This answer is not useful" style="margin: 0px auto 10px; padding: 0px; border: 0px; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; font-size: 1px; line-height: inherit; font-family: inherit; vertical-align: baseline; color: rgb(0, 119, 204); text-decoration: none; cursor: pointer; background-image: url("img/sprites.svg?v=1b3cdae197be"), none; background-size: initial; background-repeat: no-repeat; overflow: hidden; display: block; text-indent: -9999em; width: 40px; height: 30px; background-position: 0px -220px;">down vote</a>

|

Since

A picture is worth a thousand words

To make it easier and faster to get this task done with beginners like me. this is the screenshots that shows the answer posted by

@edsappfactory.com

that worked for me:

First

open the Gradle view on the right side of Androidstudio:

Second

you will see something like this :

The main reason i posted this that it was not easy to know where to execute a

gradle

task or the commands posted above. So this is where to excute them as well.

SO, to execute gradle command:

First:

Second:

Easy as it is.

Thats it.

Thank you.

|

share

improve this answer

|

answered

Jan 18 '16 at 9:36

MBH

5,337

8

52

95

|

|
| |

<a class="js-add-link comments-link disabled-link " title="Use comments to ask for more information or suggest improvements. Avoid comments like “+1” or “thanks”." style="margin: 0px; padding: 0px 3px 2px; border: 0px; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; font-size: inherit; line-height: inherit; font-family: inherit; vertical-align: baseline; color: rgb(132, 141, 149); text-decoration: none; cursor: pointer; opacity: 0.6;">add a comment</a>

|

<a name="30297509" style="margin: 0px; padding: 0px; border: 0px; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; font-size: inherit; line-height: inherit; font-family: inherit; vertical-align: baseline; color: rgb(0, 119, 204); text-decoration: none; cursor: pointer;"></a>

|

<a class="vote-up-off" title="This answer is useful" style="margin: 0px auto 2px; padding: 0px; border: 0px; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; font-size: 1px; line-height: inherit; font-family: inherit; vertical-align: baseline; color: rgb(0, 119, 204); text-decoration: none; cursor: pointer; background-image: url("img/sprites.svg?v=1b3cdae197be"), none; background-size: initial; background-repeat: no-repeat; overflow: hidden; display: block; text-indent: -9999em; width: 40px; height: 30px; background-position: 0px -170px;">up vote</a>

9

<a class="vote-down-off" title="This answer is not useful" style="margin: 0px auto 10px; padding: 0px; border: 0px; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; font-size: 1px; line-height: inherit; font-family: inherit; vertical-align: baseline; color: rgb(0, 119, 204); text-decoration: none; cursor: pointer; background-image: url("img/sprites.svg?v=1b3cdae197be"), none; background-size: initial; background-repeat: no-repeat; overflow: hidden; display: block; text-indent: -9999em; width: 40px; height: 30px; background-position: 0px -220px;">down vote</a>

|

In case anyone finds out that the answer from

CommonsWare

could not be applied to android library project, here is the snippet to fix

compile

(project(':yourAndroidLibrary')){ exclude module: 'support-v13' }

You will find problems

Unsupported Gradle DSL method found: 'exclude()'

if you use compile

project(':yourAndroidLibrary'){ exclude module: 'support-v13' }

The differences are the bracelet

"("

and

")"

before

"project".

|

share

improve this answer

|

[edited

May 23 at 11:33](https://stackoverflow.com/posts/30297509/revisions "show all edits to this post")

Community

1

1

|

answered

May 18 '15 at 7:36

[图片上传失败...(image-e501b4-1511851863363)]

Tony Thompson

106

2

8

|

|
| |

|

| | |

|

Thanks, was missing double parenthesis!

Marko

Jul 7 '15 at 10:59

|

<a class="js-add-link comments-link disabled-link " title="Use comments to ask for more information or suggest improvements. Avoid comments like “+1” or “thanks”." style="margin: 0px; padding: 0px 3px 2px; border: 0px; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; font-size: inherit; line-height: inherit; font-family: inherit; vertical-align: baseline; color: rgb(132, 141, 149); text-decoration: none; cursor: pointer; opacity: 0.6;">add a comment</a>

|

<a name="31309556" style="margin: 0px; padding: 0px; border: 0px; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; font-size: inherit; line-height: inherit; font-family: inherit; vertical-align: baseline; color: rgb(0, 119, 204); text-decoration: none; cursor: pointer;"></a>

|

<a class="vote-up-off" title="This answer is useful" style="margin: 0px auto 2px; padding: 0px; border: 0px; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; font-size: 1px; line-height: inherit; font-family: inherit; vertical-align: baseline; color: rgb(0, 119, 204); text-decoration: none; cursor: pointer; background-image: url("img/sprites.svg?v=1b3cdae197be"), none; background-size: initial; background-repeat: no-repeat; overflow: hidden; display: block; text-indent: -9999em; width: 40px; height: 30px; background-position: 0px -170px;">up vote</a>

7

<a class="vote-down-off" title="This answer is not useful" style="margin: 0px auto 10px; padding: 0px; border: 0px; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; font-size: 1px; line-height: inherit; font-family: inherit; vertical-align: baseline; color: rgb(0, 119, 204); text-decoration: none; cursor: pointer; background-image: url("img/sprites.svg?v=1b3cdae197be"), none; background-size: initial; background-repeat: no-repeat; overflow: hidden; display: block; text-indent: -9999em; width: 40px; height: 30px; background-position: 0px -220px;">down vote</a>

|

exclude module: 'support-v4'

Would not work for me with a project dependency, the only way I could get it to work was via the following syntax:

configurations {
    dependencies {
        compile(project(':Android-SDK')) {
            compile.exclude module: 'support-v4'
        }
    }
}

Where :Android-SDK is your project name.

|

share

improve this answer

|

answered

Jul 9 '15 at 6:18

[图片上传失败...(image-a9218f-1511851863363)]

Pellet

836

12

12

|

|
| |

<a class="js-add-link comments-link disabled-link " title="Use comments to ask for more information or suggest improvements. Avoid comments like “+1” or “thanks”." style="margin: 0px; padding: 0px 3px 2px; border: 0px; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; font-size: inherit; line-height: inherit; font-family: inherit; vertical-align: baseline; color: rgb(132, 141, 149); text-decoration: none; cursor: pointer; opacity: 0.6;">add a comment</a>

|

<a name="42381058" style="margin: 0px; padding: 0px; border: 0px; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; font-size: inherit; line-height: inherit; font-family: inherit; vertical-align: baseline; color: rgb(0, 119, 204); text-decoration: none; cursor: pointer;"></a>

|

<a class="vote-up-off" title="This answer is useful" style="margin: 0px auto 2px; padding: 0px; border: 0px; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; font-size: 1px; line-height: inherit; font-family: inherit; vertical-align: baseline; color: rgb(0, 119, 204); text-decoration: none; cursor: pointer; background-image: url("img/sprites.svg?v=1b3cdae197be"), none; background-size: initial; background-repeat: no-repeat; overflow: hidden; display: block; text-indent: -9999em; width: 40px; height: 30px; background-position: 0px -170px;">up vote</a>

6

<a class="vote-down-off" title="This answer is not useful" style="margin: 0px auto 10px; padding: 0px; border: 0px; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; font-size: 1px; line-height: inherit; font-family: inherit; vertical-align: baseline; color: rgb(0, 119, 204); text-decoration: none; cursor: pointer; background-image: url("img/sprites.svg?v=1b3cdae197be"), none; background-size: initial; background-repeat: no-repeat; overflow: hidden; display: block; text-indent: -9999em; width: 40px; height: 30px; background-position: 0px -220px;">down vote</a>

|

I started getting this error when upgrading to ButterKnife 8.5.1. None of the other answers here worked for me.

I used

gradle -q :app:dependencies

to see the tree, and then looked through jar files until I found the conflict. The conflict was that butterknife's dependency on

com.android.support:support-compat:25.1.0

contains a version of the accessibility class, and

com.android.support:support-v4:23.1.1

also contains the class.

I solved it by changing my dependency from this:

compile 'com.jakewharton:butterknife:8.5.1'

to this:

compile('com.jakewharton:butterknife:8.5.1') {
    exclude module: 'support-compat'
}

It doesn't seem to affect ButterKnife's operation so far.

Edit: There is a better solution, which was to upgrade my android support libraries to match ButterKnife's:

compile('com.android.support:appcompat-v7:25.2.0')
compile('com.android.support:design:25.2.0')
compile 'com.jakewharton:butterknife:8.5.1'

|

share

improve this answer

|

[edited

Feb 22 at 18:16](https://stackoverflow.com/posts/42381058/revisions "show all edits to this post")

|

answered

Feb 22 at 1:27

user3562927

251

5

11

|

|
| |

|

| | |

|

keep the support version to be same is simple solution and exclude module is not work for me.

Jay

Mar 16 at 9:19

|
|

|

1

| |

|

I solved with th second solution, thank you!

Mitro

Mar 16 at 10:48

|

<a class="js-add-link comments-link disabled-link " title="Use comments to ask for more information or suggest improvements. Avoid comments like “+1” or “thanks”." style="margin: 0px; padding: 0px 3px 2px; border: 0px; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; font-size: inherit; line-height: inherit; font-family: inherit; vertical-align: baseline; color: rgb(132, 141, 149); text-decoration: none; cursor: pointer; opacity: 0.6;">add a comment</a>

|

<a name="31673865" style="margin: 0px; padding: 0px; border: 0px; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; font-size: inherit; line-height: inherit; font-family: inherit; vertical-align: baseline; color: rgb(0, 119, 204); text-decoration: none; cursor: pointer;"></a>

|

<a class="vote-up-off" title="This answer is useful" style="margin: 0px auto 2px; padding: 0px; border: 0px; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; font-size: 1px; line-height: inherit; font-family: inherit; vertical-align: baseline; color: rgb(0, 119, 204); text-decoration: none; cursor: pointer; background-image: url("img/sprites.svg?v=1b3cdae197be"), none; background-size: initial; background-repeat: no-repeat; overflow: hidden; display: block; text-indent: -9999em; width: 40px; height: 30px; background-position: 0px -170px;">up vote</a>

5

<a class="vote-down-off" title="This answer is not useful" style="margin: 0px auto 10px; padding: 0px; border: 0px; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; font-size: 1px; line-height: inherit; font-family: inherit; vertical-align: baseline; color: rgb(0, 119, 204); text-decoration: none; cursor: pointer; background-image: url("img/sprites.svg?v=1b3cdae197be"), none; background-size: initial; background-repeat: no-repeat; overflow: hidden; display: block; text-indent: -9999em; width: 40px; height: 30px; background-position: 0px -220px;">down vote</a>

|

I had the same error on a legacy project. My fault was that the support-library was included twice: Once inside google-play-services lib, and another as standalone.

This is how I fixed it:

BAD build.gradle:

dependencies {
   compile files('libs/android-support-v4.jar') 
   compile files('libs/core-2.2.jar')
   compile files('libs/universal-image-loader-1.8.5-with-sources.jar')
   compile 'com.google.android.gms:play-services:3.2.65'
}

GOOD build.gradle:

dependencies {
   // compile files('libs/android-support-v4.jar')  // not needed 
   compile files('libs/core-2.2.jar')
   compile files('libs/universal-image-loader-1.8.5-with-sources.jar')
   compile 'com.google.android.gms:play-services:3.2.65'
}

Hope it helps someone :-)

|

share

improve this answer

|

[edited

Aug 9 at 11:50](https://stackoverflow.com/posts/31673865/revisions "show all edits to this post")

cricket_007

52.8k

7

28

69

|

answered

Jul 28 '15 at 10:36

voghDev

2,063

17

26

|

|
| |

<a class="js-add-link comments-link disabled-link " title="Use comments to ask for more information or suggest improvements. Avoid comments like “+1” or “thanks”." style="margin: 0px; padding: 0px 3px 2px; border: 0px; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; font-size: inherit; line-height: inherit; font-family: inherit; vertical-align: baseline; color: rgb(132, 141, 149); text-decoration: none; cursor: pointer; opacity: 0.6;">add a comment</a>

|

<a name="22667489" style="margin: 0px; padding: 0px; border: 0px; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; font-size: inherit; line-height: inherit; font-family: inherit; vertical-align: baseline; color: rgb(0, 119, 204); text-decoration: none; cursor: pointer;"></a>

|

<a class="vote-up-off" title="This answer is useful" style="margin: 0px auto 2px; padding: 0px; border: 0px; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; font-size: 1px; line-height: inherit; font-family: inherit; vertical-align: baseline; color: rgb(0, 119, 204); text-decoration: none; cursor: pointer; background-image: url("img/sprites.svg?v=1b3cdae197be"), none; background-size: initial; background-repeat: no-repeat; overflow: hidden; display: block; text-indent: -9999em; width: 40px; height: 30px; background-position: 0px -170px;">up vote</a>

4

<a class="vote-down-off" title="This answer is not useful" style="margin: 0px auto 10px; padding: 0px; border: 0px; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; font-size: 1px; line-height: inherit; font-family: inherit; vertical-align: baseline; color: rgb(0, 119, 204); text-decoration: none; cursor: pointer; background-image: url("img/sprites.svg?v=1b3cdae197be"), none; background-size: initial; background-repeat: no-repeat; overflow: hidden; display: block; text-indent: -9999em; width: 40px; height: 30px; background-position: 0px -220px;">down vote</a>

|

I had this same error but it was because I had recently changed from using v4 to v13. So all I had to do was clean the project.

|

share

improve this answer

|

answered

Mar 26 '14 at 16:35

ashishduh

4,372

2

17

30

|

|
| |

|

|

1

| |

|

Had the same error after upgrading intellij, cleaning the project fixed the issue.

Vlad Spreys

Apr 25 '14 at 1:51

|

<a class="js-add-link comments-link disabled-link " title="Use comments to ask for more information or suggest improvements. Avoid comments like “+1” or “thanks”." style="margin: 0px; padding: 0px 3px 2px; border: 0px; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; font-size: inherit; line-height: inherit; font-family: inherit; vertical-align: baseline; color: rgb(132, 141, 149); text-decoration: none; cursor: pointer; opacity: 0.6;">add a comment</a>

|

<a name="33720738" style="margin: 0px; padding: 0px; border: 0px; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; font-size: inherit; line-height: inherit; font-family: inherit; vertical-align: baseline; color: rgb(0, 119, 204); text-decoration: none; cursor: pointer;"></a>

|

<a class="vote-up-off" title="This answer is useful" style="margin: 0px auto 2px; padding: 0px; border: 0px; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; font-size: 1px; line-height: inherit; font-family: inherit; vertical-align: baseline; color: rgb(0, 119, 204); text-decoration: none; cursor: pointer; background-image: url("img/sprites.svg?v=1b3cdae197be"), none; background-size: initial; background-repeat: no-repeat; overflow: hidden; display: block; text-indent: -9999em; width: 40px; height: 30px; background-position: 0px -170px;">up vote</a>

4

<a class="vote-down-off" title="This answer is not useful" style="margin: 0px auto 10px; padding: 0px; border: 0px; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; font-size: 1px; line-height: inherit; font-family: inherit; vertical-align: baseline; color: rgb(0, 119, 204); text-decoration: none; cursor: pointer; background-image: url("img/sprites.svg?v=1b3cdae197be"), none; background-size: initial; background-repeat: no-repeat; overflow: hidden; display: block; text-indent: -9999em; width: 40px; height: 30px; background-position: 0px -220px;">down vote</a>

|

I had the same problem and it seems that my app had too many methods because of the libraries:http://developer.android.com/tools/building/multidex.html

Solved it with:

android {
   defaultConfig {
   ...
   multiDexEnabled = true
   }
}

More here

Error:Execution failed for task ':app:dexDebug'. > comcommand finished with non-zero exit value 2

|

share

improve this answer

|

answered

Nov 15 '15 at 14:22

Giannis P

41

1

|

|
| |

|

|

1

| |

|

Multidexing can make your app start up speed slower, only use it if you really have to.

James Goodwin

Dec 6 '15 at 14:41

|

<a class="js-add-link comments-link disabled-link " title="Use comments to ask for more information or suggest improvements. Avoid comments like “+1” or “thanks”." style="margin: 0px; padding: 0px 3px 2px; border: 0px; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; font-size: inherit; line-height: inherit; font-family: inherit; vertical-align: baseline; color: rgb(132, 141, 149); text-decoration: none; cursor: pointer; opacity: 0.6;">add a comment</a>

|

<a name="40704183" style="margin: 0px; padding: 0px; border: 0px; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; font-size: inherit; line-height: inherit; font-family: inherit; vertical-align: baseline; color: rgb(0, 119, 204); text-decoration: none; cursor: pointer;"></a>

|

<a class="vote-up-off" title="This answer is useful" style="margin: 0px auto 2px; padding: 0px; border: 0px; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; font-size: 1px; line-height: inherit; font-family: inherit; vertical-align: baseline; color: rgb(0, 119, 204); text-decoration: none; cursor: pointer; background-image: url("img/sprites.svg?v=1b3cdae197be"), none; background-size: initial; background-repeat: no-repeat; overflow: hidden; display: block; text-indent: -9999em; width: 40px; height: 30px; background-position: 0px -170px;">up vote</a>

3

<a class="vote-down-off" title="This answer is not useful" style="margin: 0px auto 10px; padding: 0px; border: 0px; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; font-size: 1px; line-height: inherit; font-family: inherit; vertical-align: baseline; color: rgb(0, 119, 204); text-decoration: none; cursor: pointer; background-image: url("img/sprites.svg?v=1b3cdae197be"), none; background-size: initial; background-repeat: no-repeat; overflow: hidden; display: block; text-indent: -9999em; width: 40px; height: 30px; background-position: 0px -220px;">down vote</a>

|

In my case the problem was caused by

version inconsistency:

Build tools 25
compileSdk 24
targetSdk 24
Support library 24

The solution was simple: Make everything version 25

|

share

improve this answer

|

answered

Nov 20 '16 at 12:48

WindRider

6,046

2

34

39

|

|
| |

<a class="js-add-link comments-link disabled-link " title="Use comments to ask for more information or suggest improvements. Avoid comments like “+1” or “thanks”." style="margin: 0px; padding: 0px 3px 2px; border: 0px; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; font-size: inherit; line-height: inherit; font-family: inherit; vertical-align: baseline; color: rgb(132, 141, 149); text-decoration: none; cursor: pointer; opacity: 0.6;">add a comment</a>

|

<a name="42851575" style="margin: 0px; padding: 0px; border: 0px; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; font-size: inherit; line-height: inherit; font-family: inherit; vertical-align: baseline; color: rgb(0, 119, 204); text-decoration: none; cursor: pointer;"></a>

|

<a class="vote-up-off" title="This answer is useful" style="margin: 0px auto 2px; padding: 0px; border: 0px; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; font-size: 1px; line-height: inherit; font-family: inherit; vertical-align: baseline; color: rgb(0, 119, 204); text-decoration: none; cursor: pointer; background-image: url("img/sprites.svg?v=1b3cdae197be"), none; background-size: initial; background-repeat: no-repeat; overflow: hidden; display: block; text-indent: -9999em; width: 40px; height: 30px; background-position: 0px -170px;">up vote</a>

3

<a class="vote-down-off" title="This answer is not useful" style="margin: 0px auto 10px; padding: 0px; border: 0px; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; font-size: 1px; line-height: inherit; font-family: inherit; vertical-align: baseline; color: rgb(0, 119, 204); text-decoration: none; cursor: pointer; background-image: url("img/sprites.svg?v=1b3cdae197be"), none; background-size: initial; background-repeat: no-repeat; overflow: hidden; display: block; text-indent: -9999em; width: 40px; height: 30px; background-position: 0px -220px;">down vote</a>

|

A

similar

dex issue resolved method

gradle.build was containing:

compile files('libs/httpclient-4.2.1.jar')
compile 'org.apache.httpcomponents:httpclient:4.5'
compile group: 'org.apache.httpcomponents' , name: 'httpclient-android' , version: '4.3.5.1'

The issue was resolved when i removed

compile files('libs/httpclient-4.2.1.jar') 

My gradle now looks like:

apply plugin: 'com.android.application'

android {

compileSdkVersion 24
buildToolsVersion "24.0.3"

defaultConfig {
    applicationId "com.mmm.ll"
    minSdkVersion 16
    targetSdkVersion 24
    useLibrary  'org.apache.http.legacy'
}

buildTypes {
    release {
        minifyEnabled true
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
    }
}
}

dependencies {

compile 'com.google.android.gms:play-services:6.1.+'
compile files('libs/PayPalAndroidSDK.jar')
compile files('libs/ksoap2-android-assembly-3.0.0-RC.4-jar-with-dependencies.jar')
compile files('libs/picasso-2.1.1.jar')
compile files('libs/gcm.jar')
compile 'com.android.support:appcompat-v7:24.2.1'
compile 'org.apache.httpcomponents:httpclient:4.5'
compile group: 'org.apache.httpcomponents' , name: 'httpclient-android' , version: '4.3.5.1'
}

There was a

redundancy

in the JAR file and the compiled gradle project

So keenly look for dependency and jar files having same classes.

And remove redundancy.
This worked for me.

|

share

improve this answer

|

[edited

Aug 9 at 11:53](https://stackoverflow.com/posts/42851575/revisions "show all edits to this post")

cricket_007

52.8k

7

28

69

|

answered

Mar 17 at 7:25

shiny vn

51

3

|

|
| |

<a class="js-add-link comments-link disabled-link " title="Use comments to ask for more information or suggest improvements. Avoid comments like “+1” or “thanks”." style="margin: 0px; padding: 0px 3px 2px; border: 0px; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; font-size: inherit; line-height: inherit; font-family: inherit; vertical-align: baseline; color: rgb(132, 141, 149); text-decoration: none; cursor: pointer; opacity: 0.6;">add a comment</a>

|

<a name="32656846" style="margin: 0px; padding: 0px; border: 0px; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; font-size: inherit; line-height: inherit; font-family: inherit; vertical-align: baseline; color: rgb(0, 119, 204); text-decoration: none; cursor: pointer;"></a>

|

<a class="vote-up-off" title="This answer is useful" style="margin: 0px auto 2px; padding: 0px; border: 0px; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; font-size: 1px; line-height: inherit; font-family: inherit; vertical-align: baseline; color: rgb(0, 119, 204); text-decoration: none; cursor: pointer; background-image: url("img/sprites.svg?v=1b3cdae197be"), none; background-size: initial; background-repeat: no-repeat; overflow: hidden; display: block; text-indent: -9999em; width: 40px; height: 30px; background-position: 0px -170px;">up vote</a>

2

<a class="vote-down-off" title="This answer is not useful" style="margin: 0px auto 10px; padding: 0px; border: 0px; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; font-size: 1px; line-height: inherit; font-family: inherit; vertical-align: baseline; color: rgb(0, 119, 204); text-decoration: none; cursor: pointer; background-image: url("img/sprites.svg?v=1b3cdae197be"), none; background-size: initial; background-repeat: no-repeat; overflow: hidden; display: block; text-indent: -9999em; width: 40px; height: 30px; background-position: 0px -220px;">down vote</a>

|

If you have imported your project from

Eclipse.

1\. The select project 
2\. Go to File -> **Project Structure**
3\. Select app in **module** section on left hand panel
4\. Select **Dependency** tab
5\. Your able to see jars you have added in eclipse project for v4 and v13.
6\. Remove that jar by clicking on minus sign at bottom after selection
7\. Click on Plus sign select **Library Dependency** 
8\. Choose V4 and V13 if added
9\. Press Ok and Clean and Rebuild your project

The scenario I have faced after importing Eclipse project to Android studio.

Hope this helps..

|

share

improve this answer

|

answered

Sep 18 '15 at 16:28

MobileEvangelist

1,702

1

11

29

|

|
| |

<a class="js-add-link comments-link disabled-link " title="Use comments to ask for more information or suggest improvements. Avoid comments like “+1” or “thanks”." style="margin: 0px; padding: 0px 3px 2px; border: 0px; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; font-size: inherit; line-height: inherit; font-family: inherit; vertical-align: baseline; color: rgb(132, 141, 149); text-decoration: none; cursor: pointer; opacity: 0.6;">add a comment</a>

|

<a name="34269662" style="margin: 0px; padding: 0px; border: 0px; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; font-size: inherit; line-height: inherit; font-family: inherit; vertical-align: baseline; color: rgb(0, 119, 204); text-decoration: none; cursor: pointer;"></a>

|

<a class="vote-up-off" title="This answer is useful" style="margin: 0px auto 2px; padding: 0px; border: 0px; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; font-size: 1px; line-height: inherit; font-family: inherit; vertical-align: baseline; color: rgb(0, 119, 204); text-decoration: none; cursor: pointer; background-image: url("img/sprites.svg?v=1b3cdae197be"), none; background-size: initial; background-repeat: no-repeat; overflow: hidden; display: block; text-indent: -9999em; width: 40px; height: 30px; background-position: 0px -170px;">up vote</a>

2

<a class="vote-down-off" title="This answer is not useful" style="margin: 0px auto 10px; padding: 0px; border: 0px; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; font-size: 1px; line-height: inherit; font-family: inherit; vertical-align: baseline; color: rgb(0, 119, 204); text-decoration: none; cursor: pointer; background-image: url("img/sprites.svg?v=1b3cdae197be"), none; background-size: initial; background-repeat: no-repeat; overflow: hidden; display: block; text-indent: -9999em; width: 40px; height: 30px; background-position: 0px -220px;">down vote</a>

|

I'm using

com.google.android.gms:play-services-analytics:8.3.0

and

android-support-v13.jarand could not get

exclude module: 'support-v4'

to work.

What worked for me was using the

android-support-v13

artefact rather than the

android-support-v13.jar

file.

I.e. instead of

dependencies {
compile ('com.google.android.gms:play-services-analytics:8.3.0')
compile files('libs/android-support-v13.jar')

}

I used

dependencies {
compile ('com.google.android.gms:play-services-analytics:8.3.0')
compile ('com.google.android:android-support-v13')

}

|

share

improve this answer

|

answered

Dec 14 '15 at 14:38

barry

2,171

2

25

58

|

|
| |

<a class="js-add-link comments-link disabled-link " title="Use comments to ask for more information or suggest improvements. Avoid comments like “+1” or “thanks”." style="margin: 0px; padding: 0px 3px 2px; border: 0px; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; font-size: inherit; line-height: inherit; font-family: inherit; vertical-align: baseline; color: rgb(132, 141, 149); text-decoration: none; cursor: pointer; opacity: 0.6;">add a comment</a>

|

<a name="39679569" style="margin: 0px; padding: 0px; border: 0px; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; font-size: inherit; line-height: inherit; font-family: inherit; vertical-align: baseline; color: rgb(0, 119, 204); text-decoration: none; cursor: pointer;"></a>

|

<a class="vote-up-off" title="This answer is useful" style="margin: 0px auto 2px; padding: 0px; border: 0px; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; font-size: 1px; line-height: inherit; font-family: inherit; vertical-align: baseline; color: rgb(0, 119, 204); text-decoration: none; cursor: pointer; background-image: url("img/sprites.svg?v=1b3cdae197be"), none; background-size: initial; background-repeat: no-repeat; overflow: hidden; display: block; text-indent: -9999em; width: 40px; height: 30px; background-position: 0px -170px;">up vote</a>

2

<a class="vote-down-off" title="This answer is not useful" style="margin: 0px auto 10px; padding: 0px; border: 0px; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; font-size: 1px; line-height: inherit; font-family: inherit; vertical-align: baseline; color: rgb(0, 119, 204); text-decoration: none; cursor: pointer; background-image: url("img/sprites.svg?v=1b3cdae197be"), none; background-size: initial; background-repeat: no-repeat; overflow: hidden; display: block; text-indent: -9999em; width: 40px; height: 30px; background-position: 0px -220px;">down vote</a>

|

This is an annoying problem, that can take some time to find out the root case. The way you should proceed is @CommonsWare answer.

I faced this problem recently and found it hard to resolve.

My problem was i was including a library by "+" version in build.gradle. Latest version of library contained one of older dex and bang.

I reverted to older version of library and solved it.

It is good to run your androidDependencies and see what is really happening. Its also good to search in your build folder.

Above all

Android Studio 2.2

provide in build features to track this problem.

Happy Coding Guys

|

share

improve this answer

|

answered

Sep 24 '16 at 18:19

Arun C

7,913

1

20

34

|

|
| |

<a class="js-add-link comments-link disabled-link " title="Use comments to ask for more information or suggest improvements. Avoid comments like “+1” or “thanks”." style="margin: 0px; padding: 0px 3px 2px; border: 0px; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; font-size: inherit; line-height: inherit; font-family: inherit; vertical-align: baseline; color: rgb(132, 141, 149); text-decoration: none; cursor: pointer; opacity: 0.6;">add a comment</a>

|

<a name="28144571" style="margin: 0px; padding: 0px; border: 0px; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; font-size: inherit; line-height: inherit; font-family: inherit; vertical-align: baseline; color: rgb(0, 119, 204); text-decoration: none; cursor: pointer;"></a>

|

<a class="vote-up-off" title="This answer is useful" style="margin: 0px auto 2px; padding: 0px; border: 0px; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; font-size: 1px; line-height: inherit; font-family: inherit; vertical-align: baseline; color: rgb(0, 119, 204); text-decoration: none; cursor: pointer; background-image: url("img/sprites.svg?v=1b3cdae197be"), none; background-size: initial; background-repeat: no-repeat; overflow: hidden; display: block; text-indent: -9999em; width: 40px; height: 30px; background-position: 0px -170px;">up vote</a>

2

<a class="vote-down-off" title="This answer is not useful" style="margin: 0px auto 10px; padding: 0px; border: 0px; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; font-size: 1px; line-height: inherit; font-family: inherit; vertical-align: baseline; color: rgb(0, 119, 204); text-decoration: none; cursor: pointer; background-image: url("img/sprites.svg?v=1b3cdae197be"), none; background-size: initial; background-repeat: no-repeat; overflow: hidden; display: block; text-indent: -9999em; width: 40px; height: 30px; background-position: 0px -220px;">down vote</a>

|

In Android Studio, go to your build.gradle (check both project and modules build.gradle files) and search for duplicate dependencies.

Delete those your project does not need.

|

share

improve this answer

|

[edited

Aug 9 at 11:54](https://stackoverflow.com/posts/28144571/revisions "show all edits to this post")

[图片上传失败...(image-f725da-1511851863362)]

cricket_007

52.8k

7

28

69

|

answered

Jan 26 '15 at 3:50

KadoLakatt

35

5

|

|
| |

<a class="js-add-link comments-link disabled-link " title="Use comments to ask for more information or suggest improvements. Avoid comments like “+1” or “thanks”." style="margin: 0px; padding: 0px 3px 2px; border: 0px; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; font-size: inherit; line-height: inherit; font-family: inherit; vertical-align: baseline; color: rgb(132, 141, 149); text-decoration: none; cursor: pointer; opacity: 0.6;">add a comment</a>

|

<a name="32063049" style="margin: 0px; padding: 0px; border: 0px; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; font-size: inherit; line-height: inherit; font-family: inherit; vertical-align: baseline; color: rgb(0, 119, 204); text-decoration: none; cursor: pointer;"></a>

|

<a class="vote-up-off" title="This answer is useful" style="margin: 0px auto 2px; padding: 0px; border: 0px; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; font-size: 1px; line-height: inherit; font-family: inherit; vertical-align: baseline; color: rgb(0, 119, 204); text-decoration: none; cursor: pointer; background-image: url("img/sprites.svg?v=1b3cdae197be"), none; background-size: initial; background-repeat: no-repeat; overflow: hidden; display: block; text-indent: -9999em; width: 40px; height: 30px; background-position: 0px -170px;">up vote</a>

1

<a class="vote-down-off" title="This answer is not useful" style="margin: 0px auto 10px; padding: 0px; border: 0px; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; font-size: 1px; line-height: inherit; font-family: inherit; vertical-align: baseline; color: rgb(0, 119, 204); text-decoration: none; cursor: pointer; background-image: url("img/sprites.svg?v=1b3cdae197be"), none; background-size: initial; background-repeat: no-repeat; overflow: hidden; display: block; text-indent: -9999em; width: 40px; height: 30px; background-position: 0px -220px;">down vote</a>

|

I removed compile 'com.android.support:support-v4:18.0.+' in dependencies, and it works

|

share

improve this answer

|

answered

Aug 18 '15 at 3:29

albert

11

1

|

|
| |

|

|

2

| |

|

this should be a comment or else you should explain it in a better way.

Anirudh Sharma

Aug 18 '15 at 3:49

|

<a class="js-add-link comments-link disabled-link " title="Use comments to ask for more information or suggest improvements. Avoid comments like “+1” or “thanks”." style="margin: 0px; padding: 0px 3px 2px; border: 0px; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; font-size: inherit; line-height: inherit; font-family: inherit; vertical-align: baseline; color: rgb(132, 141, 149); text-decoration: none; cursor: pointer; opacity: 0.6;">add a comment</a>

|

<a name="38284491" style="margin: 0px; padding: 0px; border: 0px; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; font-size: inherit; line-height: inherit; font-family: inherit; vertical-align: baseline; color: rgb(0, 119, 204); text-decoration: none; cursor: pointer;"></a>

|

<a class="vote-up-off" title="This answer is useful" style="margin: 0px auto 2px; padding: 0px; border: 0px; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; font-size: 1px; line-height: inherit; font-family: inherit; vertical-align: baseline; color: rgb(0, 119, 204); text-decoration: none; cursor: pointer; background-image: url("img/sprites.svg?v=1b3cdae197be"), none; background-size: initial; background-repeat: no-repeat; overflow: hidden; display: block; text-indent: -9999em; width: 40px; height: 30px; background-position: 0px -170px;">up vote</a>

1

<a class="vote-down-off" title="This answer is not useful" style="margin: 0px auto 10px; padding: 0px; border: 0px; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; font-size: 1px; line-height: inherit; font-family: inherit; vertical-align: baseline; color: rgb(0, 119, 204); text-decoration: none; cursor: pointer; background-image: url("img/sprites.svg?v=1b3cdae197be"), none; background-size: initial; background-repeat: no-repeat; overflow: hidden; display: block; text-indent: -9999em; width: 40px; height: 30px; background-position: 0px -220px;">down vote</a>

|

Deleting all files from Gradle cache fixed my problem.

on Linux:

cd ~/.gradle  
rm -R -f *

|

share

improve this answer

|

answered

Jul 9 '16 at 17:35

Iuliia Ashomok

2,833

1

30

33

|

|
| |

<a class="js-add-link comments-link disabled-link " title="Use comments to ask for more information or suggest improvements. Avoid comments like “+1” or “thanks”." style="margin: 0px; padding: 0px 3px 2px; border: 0px; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; font-size: inherit; line-height: inherit; font-family: inherit; vertical-align: baseline; color: rgb(132, 141, 149); text-decoration: none; cursor: pointer; opacity: 0.6;">add a comment</a>

|

<a name="42841851" style="margin: 0px; padding: 0px; border: 0px; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; font-size: inherit; line-height: inherit; font-family: inherit; vertical-align: baseline; color: rgb(0, 119, 204); text-decoration: none; cursor: pointer;"></a>

|

<a class="vote-up-off" title="This answer is useful" style="margin: 0px auto 2px; padding: 0px; border: 0px; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; font-size: 1px; line-height: inherit; font-family: inherit; vertical-align: baseline; color: rgb(0, 119, 204); text-decoration: none; cursor: pointer; background-image: url("img/sprites.svg?v=1b3cdae197be"), none; background-size: initial; background-repeat: no-repeat; overflow: hidden; display: block; text-indent: -9999em; width: 40px; height: 30px; background-position: 0px -170px;">up vote</a>

0

<a class="vote-down-off" title="This answer is not useful" style="margin: 0px auto 10px; padding: 0px; border: 0px; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; font-size: 1px; line-height: inherit; font-family: inherit; vertical-align: baseline; color: rgb(0, 119, 204); text-decoration: none; cursor: pointer; background-image: url("img/sprites.svg?v=1b3cdae197be"), none; background-size: initial; background-repeat: no-repeat; overflow: hidden; display: block; text-indent: -9999em; width: 40px; height: 30px; background-position: 0px -220px;">down vote</a>

|

Finally, I solved it modifiying these attributes on the module gradle file

  1. compileSdkVersion 25
  2. targetSdkVersion 25
  3. compile 'com.android.support:appcompat-v7:+'
  4. compile 'com.android.support:recyclerview-v7:+'

|

share

improve this answer

|

answered

Mar 16 at 18:13

Val Martinez

128

1

8

|

|
| |

<a class="js-add-link comments-link disabled-link " title="Use comments to ask for more information or suggest improvements. Avoid comments like “+1” or “thanks”." style="margin: 0px; padding: 0px 3px 2px; border: 0px; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; font-size: inherit; line-height: inherit; font-family: inherit; vertical-align: baseline; color: rgb(132, 141, 149); text-decoration: none; cursor: pointer; opacity: 0.6;">add a comment</a>

|

<a name="44354927" style="margin: 0px; padding: 0px; border: 0px; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; font-size: inherit; line-height: inherit; font-family: inherit; vertical-align: baseline; color: rgb(0, 119, 204); text-decoration: none; cursor: pointer;"></a>

|

<a class="vote-up-off" title="This answer is useful" style="margin: 0px auto 2px; padding: 0px; border: 0px; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; font-size: 1px; line-height: inherit; font-family: inherit; vertical-align: baseline; color: rgb(0, 119, 204); text-decoration: none; cursor: pointer; background-image: url("img/sprites.svg?v=1b3cdae197be"), none; background-size: initial; background-repeat: no-repeat; overflow: hidden; display: block; text-indent: -9999em; width: 40px; height: 30px; background-position: 0px -170px;">up vote</a>

0

<a class="vote-down-off" title="This answer is not useful" style="margin: 0px auto 10px; padding: 0px; border: 0px; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; font-size: 1px; line-height: inherit; font-family: inherit; vertical-align: baseline; color: rgb(0, 119, 204); text-decoration: none; cursor: pointer; background-image: url("img/sprites.svg?v=1b3cdae197be"), none; background-size: initial; background-repeat: no-repeat; overflow: hidden; display: block; text-indent: -9999em; width: 40px; height: 30px; background-position: 0px -220px;">down vote</a>

|

I had the same problem when adding

react-native-palette

to my project, here is my dependencies tree:

./gradlew app:dependencies
+--- project :react-native-palette
|    +--- com.facebook.react:react-native:0.20.+ -> 0.44.2
|    |    +--- javax.inject:javax.inject:1
|    |    +--- com.android.support:appcompat-v7:23.0.1
|    |    |    \--- com.android.support:support-v4:23.0.1
|    |    |         \--- com.android.support:support-annotations:23.0.1 -> 24.2.1
...
|    \--- com.android.support:palette-v7:24.+ -> 24.2.1
|         +--- com.android.support:support-compat:24.2.1
|         |    \--- com.android.support:support-annotations:24.2.1
|         \--- com.android.support:support-core-utils:24.2.1
|              \--- com.android.support:support-compat:24.2.1 (*)
+--- com.android.support:appcompat-v7:23.0.1 (*)
\--- com.facebook.react:react-native:+ -> 0.44.2 (*)

I tried many solutons and could not fix it, until changing the

com.android.support:appcompatversion in

android/app/build.gradle, I wish this can help:

dependencies {
    compile project(':react-native-palette')
    compile project(':react-native-image-picker')
    compile project(':react-native-camera')
    compile fileTree(dir: "libs", include: ["*.jar"])
    // compile "com.android.support:appcompat-v7:23.0.1"
    compile "com.android.support:appcompat-v7:24.2.1"
    compile "com.facebook.react:react-native:+"
}

it seems that multiple entries is not a big problem, version mismatch is

|

share

improve this answer

|

answered

Jun 4 at 14:03

matrixer

1

1

|

|
| |

<a class="js-add-link comments-link disabled-link " title="Use comments to ask for more information or suggest improvements. Avoid comments like “+1” or “thanks”." style="margin: 0px; padding: 0px 3px 2px; border: 0px; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; font-size: inherit; line-height: inherit; font-family: inherit; vertical-align: baseline; color: rgb(132, 141, 149); text-decoration: none; cursor: pointer; opacity: 0.6;">add a comment</a>

|

<a name="45704955" style="margin: 0px; padding: 0px; border: 0px; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; font-size: inherit; line-height: inherit; font-family: inherit; vertical-align: baseline; color: rgb(0, 119, 204); text-decoration: none; cursor: pointer;"></a>

|

<a class="vote-up-off" title="This answer is useful" style="margin: 0px auto 2px; padding: 0px; border: 0px; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; font-size: 1px; line-height: inherit; font-family: inherit; vertical-align: baseline; color: rgb(0, 119, 204); text-decoration: none; cursor: pointer; background-image: url("img/sprites.svg?v=1b3cdae197be"), none; background-size: initial; background-repeat: no-repeat; overflow: hidden; display: block; text-indent: -9999em; width: 40px; height: 30px; background-position: 0px -170px;">up vote</a>

0

<a class="vote-down-off" title="This answer is not useful" style="margin: 0px auto 10px; padding: 0px; border: 0px; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; font-size: 1px; line-height: inherit; font-family: inherit; vertical-align: baseline; color: rgb(0, 119, 204); text-decoration: none; cursor: pointer; background-image: url("img/sprites.svg?v=1b3cdae197be"), none; background-size: initial; background-repeat: no-repeat; overflow: hidden; display: block; text-indent: -9999em; width: 40px; height: 30px; background-position: 0px -220px;">down vote</a>

|

Got it working for a

compile file('...')

conflict by increasing minSdkVersion to 21 and enabling multidex. Not sure if that is the best solution but the only way I could get it working in my case.

Note: for

compile file('...')

it appears that you cannot put in an

exclude

clause so that option was not available.

|

share

improve this answer

|

|

©著作权归作者所有,转载或内容合作请联系作者
  • 序言:七十年代末,一起剥皮案震惊了整个滨河市,随后出现的几起案子,更是在滨河造成了极大的恐慌,老刑警刘岩,带你破解...
    沈念sama阅读 162,475评论 4 372
  • 序言:滨河连续发生了三起死亡事件,死亡现场离奇诡异,居然都是意外死亡,警方通过查阅死者的电脑和手机,发现死者居然都...
    沈念sama阅读 68,744评论 2 307
  • 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
    开封第一讲书人阅读 112,101评论 0 254
  • 文/不坏的土叔 我叫张陵,是天一观的道长。 经常有香客问我,道长,这世上最难降的妖魔是什么? 我笑而不...
    开封第一讲书人阅读 44,732评论 0 221
  • 正文 为了忘掉前任,我火速办了婚礼,结果婚礼上,老公的妹妹穿的比我还像新娘。我一直安慰自己,他们只是感情好,可当我...
    茶点故事阅读 53,141评论 3 297
  • 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
    开封第一讲书人阅读 41,049评论 1 226
  • 那天,我揣着相机与录音,去河边找鬼。 笑死,一个胖子当着我的面吹牛,可吹牛的内容都是我干的。 我是一名探鬼主播,决...
    沈念sama阅读 32,188评论 2 320
  • 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
    开封第一讲书人阅读 30,965评论 0 213
  • 序言:老挝万荣一对情侣失踪,失踪者是张志新(化名)和其女友刘颖,没想到半个月后,有当地人在树林里发现了一具尸体,经...
    沈念sama阅读 34,716评论 1 250
  • 正文 独居荒郊野岭守林人离奇死亡,尸身上长有42处带血的脓包…… 初始之章·张勋 以下内容为张勋视角 年9月15日...
    茶点故事阅读 30,867评论 2 254
  • 正文 我和宋清朗相恋三年,在试婚纱的时候发现自己被绿了。 大学时的朋友给我发了我未婚夫和他白月光在一起吃饭的照片。...
    茶点故事阅读 32,341评论 1 265
  • 序言:一个原本活蹦乱跳的男人离奇死亡,死状恐怖,灵堂内的尸体忽然破棺而出,到底是诈尸还是另有隐情,我是刑警宁泽,带...
    沈念sama阅读 28,663评论 3 263
  • 正文 年R本政府宣布,位于F岛的核电站,受9级特大地震影响,放射性物质发生泄漏。R本人自食恶果不足惜,却给世界环境...
    茶点故事阅读 33,376评论 3 244
  • 文/蒙蒙 一、第九天 我趴在偏房一处隐蔽的房顶上张望。 院中可真热闹,春花似锦、人声如沸。这庄子的主人今日做“春日...
    开封第一讲书人阅读 26,200评论 0 8
  • 文/苍兰香墨 我抬头看了看天上的太阳。三九已至,却和暖如春,着一层夹袄步出监牢的瞬间,已是汗流浃背。 一阵脚步声响...
    开封第一讲书人阅读 26,990评论 0 201
  • 我被黑心中介骗来泰国打工, 没想到刚下飞机就差点儿被人妖公主榨干…… 1. 我叫王不留,地道东北人。 一个月前我还...
    沈念sama阅读 36,179评论 2 285
  • 正文 我出身青楼,却偏偏与公主长得像,于是被迫代替她去往敌国和亲。 传闻我的和亲对象是个残疾皇子,可洞房花烛夜当晚...
    茶点故事阅读 35,979评论 2 279

推荐阅读更多精彩内容

  • **2014真题Directions:Read the following text. Choose the be...
    又是夜半惊坐起阅读 8,626评论 0 23
  • 我曾经7次鄙视自己的灵魂:它本可以进取却故作谦卑;它在空虚时用爱欲填充;在困难和容易之间选择了容易;它犯了错,却借...
    RGKOKO阅读 481评论 0 1
  • 今天跟九哥聊到意义这件事。 他说: 很多人都还没有去尝试一件事就说这件事没有意义,这种说法让人很无语,因为很多事情...
    CJDUDU阅读 240评论 0 0
  • “鸣鸣”,谢灵扑在李澜海怀里哭了起来,“咳咳咳”这时,秦枫剧烈的咳嗽起来,谢灵看过去,秦枫醒了,谢灵一下子扑过去抱...
    身落情尘阅读 295评论 0 0
  • 最近,突然迷上了民国故事。 民国著名的几个女子,张爱玲、林徽因、孟小冬、陆小曼……唯一心生怜悯而又深感痛惜的,当属...
    哈鱼日志阅读 1,231评论 5 17