dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile('com.google.android.gms:play-services-gcm:8.4.0') {
exclude group: 'com.android.support', module: 'support-v4'
exclude group: 'com.google.android.gms'
}
compile ('com.google.android.gms:play-services-base:8.4.0') {
exclude group: 'com.android.support', module: 'support-v4'
exclude group: 'com.google.android.gms'
}
compile('com.android.support:appcompat-v7:23.2.0') {
exclude module: 'animated-vector-drawable'
}
compile 'com.jakewharton:butterknife:7.0.1'
compile 'se.emilsjolander:stickylistheaders:2.7.0'
compile 'com.google.code.gson:gson:2.5'
compile('com.koushikdutta.ion:ion:2.+') {
exclude module: 'gson'
}
compile 'com.github.JakeWharton:ViewPagerIndicator:2.4.1@aar'
compile 'com.github.androidprogresslayout:library:2.0.2@aar'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.nineoldandroids:library:2.4.0'
compile 'com.daimajia.slider:library:1.1.5@aar'
}
but every time I get this error:
Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'.
> com.android.build.api.transform.TransformException:
java.util.zip.ZipException:
duplicate entry: android/support/v4/widget/SimpleCursorAdapter$CursorToStringConverter.class
Here is the gradlew -q dependencies App:dependencies --configuration compile
result:
From the bottom that you can see, I've not added com.google.android.gms:play-services-measurement
lib, yet it's shown with no reason?
FOUND THE SOLUTION
I check gradle's console while its dexing the dependencies and I saw;
Dexing \app\build\intermediates\exploded-aar\com.github.JakeWharton\ViewPagerIndicator\2.4.1\jars\libs\android-support-v4.jar took 1499
Which is adding the oldest support-v4 lib as a jar. I've deleted the ViewPagerIndicator dependency from build.gradle and add it's classes manually.
Now the weirdest problem got solved.
You are adding twice the support-library v4.
It happens because you are using
compile 'com.github.JakeWharton:ViewPagerIndicator:2.4.1@aar'
You are getting this library from the jitpack.
This library adds the support library as a jar and not as a gradle dependency.
It means that the pom file doesn't have a dependency and you can't exclude the jar file with gradle because the jar is inside the aar file (without a pom how can gradle know that these files should be excluded?).
You can check the files in the jitpack repo: