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'
}
但每次我得到这个错误:
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
结果如下gradlew -q dependencies App:dependencies --configuration compile
:
从底部可以看到,我没有添加com.google.android.gms:play-services-measurement
lib,但它却无缘无故显示?
找到解决方案
我检查了 gradle 的控制台,同时它对依赖项进行 dexing,我看到了;
Dexing \app\build\intermediates\exploded-aar\com.github.JakeWharton\ViewPagerIndicator\2.4.1\jars\libs\android-support-v4.jar took 1499
它将最旧的 support-v4 lib 添加为 jar。我已经从 build.gradle 中删除了 ViewPagerIndicator 依赖项并手动添加它的类。
现在最奇怪的问题得到了解决。