Gradle - ProGuard - DuplicateClasses - NineOldAndroids
Gradle - ProGuard - DuplicateClasses - NineOldAndroids
我在我的项目中使用了一些 libraries/modules。
在两个库中有“nineoldandroids”用于 gradle 和“-compile 'com.nineoldandroids:library:2.4.0'" 在每个 library/module !
如果我想在 Android Studio 中使用“Build - Generate Signed APK”创建一个 APK,我总是得到“ProGuard”错误“duplicateclasses”,错误如下:
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]))
如何解决这个错误?
SwipeListView:
dependencies {
compile 'com.android.support:support-v4:20.0.0'
compile 'com.nineoldandroids:library:2.4.0'
}
NumberPickerCompat:
dependencies {
compile 'com.nineoldandroids:library:2.4.0'
}
主项目:
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')
}
试试这个:
SwipeListView:
dependencies {
compile 'com.android.support:support-v4:20.0.0'
}
NumberPickerCompat:
dependencies {
}
主项目:
dependencies {
//put nineoldandroids in main project
compile 'com.nineoldandroids:library:2.4.0'
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
依赖项的额外括号
感谢大家的回答。
问题是 一些 .jar 文件 保存在一些“build”文件夹中。
这是因为我使用 .jars 从 Eclipse 迁移,后来删除了它并将编译添加到 gradle.
但是我还没有看到它们也保存在 "build" 文件夹中。
我在我的项目中使用了一些 libraries/modules。
在两个库中有“nineoldandroids”用于 gradle 和“-compile 'com.nineoldandroids:library:2.4.0'" 在每个 library/module !
如果我想在 Android Studio 中使用“Build - Generate Signed APK”创建一个 APK,我总是得到“ProGuard”错误“duplicateclasses”,错误如下:
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]))
如何解决这个错误?
SwipeListView:
dependencies {
compile 'com.android.support:support-v4:20.0.0'
compile 'com.nineoldandroids:library:2.4.0'
}
NumberPickerCompat:
dependencies {
compile 'com.nineoldandroids:library:2.4.0'
}
主项目:
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')
}
试试这个:
SwipeListView:
dependencies {
compile 'com.android.support:support-v4:20.0.0'
}
NumberPickerCompat:
dependencies {
}
主项目:
dependencies {
//put nineoldandroids in main project
compile 'com.nineoldandroids:library:2.4.0'
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
依赖项的额外括号
感谢大家的回答。
问题是 一些 .jar 文件 保存在一些“build”文件夹中。
这是因为我使用 .jars 从 Eclipse 迁移,后来删除了它并将编译添加到 gradle. 但是我还没有看到它们也保存在 "build" 文件夹中。