我在构建期间遇到此异常。
:transformClassesWithJarMergingForDebug FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':transformClassesWithJarMergingForDebug'.
> com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: org/apache/commons/io/comparator/DefaultFileComparator.class
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
我已将其追溯到这两个图书馆之间的冲突。
compile 'org.ros.rosjava_core:rosjava_geometry:0.2.1'
compile 'commons-io:commons-io:2.4'
我已经看到使用"排除组解决了其他类似的问题:"或类似build.gradle中的类似内容。但是,他们从未说明如何找到要排除的组。如果这甚至是正确的答案。
以下是依赖项的完整列表。
ext {
playServicesVersion = '9.4.0'
supportLibVersion = '24.2.0'
qbSdkVersion = '2.6'
}
dependencies {
compile "com.android.support:support-v4:${supportLibVersion}"
compile "com.android.support:appcompat-v7:${supportLibVersion}"
//Android ros support - https://github.com/rosjava/android_core/tree/indigo
compile project(':AndroidRosJava')
//Serial Library to talk to Arduino over USB OTG
compile project(':usbSerialForAndroid')
//Protobuf
compile files('libs/protobuf-java-2.6.1.jar')
//Crashlytics
compile('com.crashlytics.sdk.android:crashlytics:2.5.6@aar') {
transitive = true;
}
//Face Tracking
compile "com.google.android.gms:play-services-vision:${playServicesVersion}"
//User authentication
compile "com.google.android.gms:play-services-auth:${playServicesVersion}"
compile "com.google.android.gms:play-services-plus:${playServicesVersion}"
//App Invites
compile "com.google.android.gms:play-services-appinvite:${playServicesVersion}"
//Nearby Connections - Local networking
compile "com.google.android.gms:play-services-nearby:${playServicesVersion}"
//RecyclerView
compile "com.android.support:recyclerview-v7:${supportLibVersion}"
//WebRTC
compile "com.quickblox:quickblox-android-sdk-core:${qbSdkVersion}@aar"
compile("com.quickblox:quickblox-android-sdk-chat:${qbSdkVersion}@aar") {
transitive = true
}
compile "com.quickblox:quickblox-android-sdk-videochat-webrtc:${qbSdkVersion}@aar"
compile 'com.android.support:multidex:1.0.1'
compile 'com.google.code.gson:gson:2.3.1'
//AI
compile 'ai.api:sdk:1.9.0@aar'
//TODO: Disabled until http://stackoverflow.com/questions/39195771/zipexception-duplicate-entry-during-android-build
compile 'commons-io:commons-io:2.4'
//Firebase - cloud data storage
compile "com.google.firebase:firebase-core:${playServicesVersion}"
compile "com.google.firebase:firebase-database:${playServicesVersion}"
compile "com.google.firebase:firebase-auth:${playServicesVersion}"
compile "com.google.firebase:firebase-storage:${playServicesVersion}"
//Bluetooth beacon detection
compile 'org.altbeacon:android-beacon-library:2.9.1'
//Houndify - Voice recognition and backup AI
compile ('hound.android:hound-sdk:0.2.15@aar'){
transitive=true
}
compile ('hound.android:phrasespotter:1.4.0'){
transitive=true
}
//Testing
testCompile 'junit:junit:4.12'
androidTestCompile "com.android.support:support-annotations:${supportLibVersion}"
// UI testing with Espresso
androidTestCompile 'com.android.support.test.espresso:espresso-core:2.2.1'
androidTestCompile 'com.android.support.test:runner:0.4.1'
androidTestCompile 'com.android.support.test:rules:0.4.1'
androidTestCompile 'tools.fastlane:screengrab:0.3.2'
// Required -- JUnit 4 framework
testCompile 'junit:junit:4.12'
androidTestCompile 'junit:junit:4.12'
}
AndroidRosJava(添加此项目库后启动)
dependencies {
compile 'org.ros.rosjava_core:rosjava_geometry:[0.2,0.3)'
compile "com.android.support:support-v4:${supportLibVersion}"
compile 'org.ros.rosjava_messages:visualization_msgs:[1.11,1.12)'
compile "org.ros.rosjava_messages:diagnostic_msgs:[1.11,1.12)"
compile "org.ros.rosjava_messages:sensor_msgs:[1.11,1.12)"
}