我的项目使用一些库/模块。
在其中的两个库中,每个库/模块上都有“nineoldandroids”用于“compile'com.nineoldandroids:library:2.4.0”!
如果我想在android studio中用“build-generate signed apk”打包一个apk,我总是会得到“proguard”错误“duplicateclases”,错误如下:

Error:Execution failed for task ':xxxxx:proguardRelease'.
> java.io.IOException: Can't write
 [F:\Projekte\Android_Studio\xxxx\build\intermediates\classes-proguard\
release\classes.jar] (Can't read
 [F:\Projekte\Android_Studio\xxxx\build\intermediates\exploded-aar\
Android_Studio\library_SwipeListView\unspecified\libs\
nineoldandroids-2.4.0.jar(;;;;;;!META-INF/MANIFEST.MF)]
(Duplicate zip entry [com/b/a/b.class == nineoldandroids-2.4.0.jar:com
/nineoldandroids/animation/Animator$AnimatorListener.class]))

如何解决此错误?
泳道视图:
dependencies {
compile 'com.android.support:support-v4:20.0.0'
compile 'com.nineoldandroids:library:2.4.0'

}
数字pickercompat:
dependencies {
compile 'com.nineoldandroids:library:2.4.0'

}
MainProject:
dependencies {
compile project(':library_CalendarViewCompbat')
compile project(':library_FAB_Menu')
compile project(':library_NumberPickerCompat')
compile project(':library_ReminderDatePicker')
compile project(':library_StickyListHeaders')
compile project(':library_SwipeListView')
compile project(':library_SunDate_Picker')
compile 'com.google.android.gms:play-services:6.1.+'
compile 'com.android.support:appcompat-v7:19.1.0'
compile 'com.android.support:support-v4:20.0.0'
compile files('libs/crashlytics.jar')
compile files('libs/dashclock-api-r1.1.jar')
compile files('libs/dropbox-android-sdk-1.5.3.jar')
compile files('libs/httpmime-4.0.3.jar')
compile files('libs/json_simple-1.1.jar')

}

最佳答案

您可以从主项目中排除nineoldandroids传递依赖项之一:

dependencies {
    compile project(':library_NumberPickerCompat')
    compile(project(':library_SwipeListView')) {
        // Already present in NumberPickerCompat
        exclude group: 'com.nineoldandroids'
    }

    ...
}

请注意第二个compile依赖项上的额外括号

关于android - Gradle-ProGuard-DuplicateClasses-NineOldAndroids,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/29233035/

10-11 13:58