Reputation: 21
In my project i have n number of dependencies project available. Each project has support-v4-19.1.0.jar file.
When i try to build the application using gradle, ProguardRelease task failed with below error.
* What went wrong:
Execution failed for task ':CurrenexMobile:proguardRelease'.
java.io.IOException: Can't write [build\in termediates\classes-proguard\release\classes.jar] (Can't read [build\intermediates\exploded-aar\libs\support-v4-19.1.0.jar(;;;;;;!META-INF/MANIFEST.MF)] (Duplicate zip ent ry [android/support/v4/c/a.class == support-v4-19.1.0.jar:android/support/v4/os/ ParcelableCompat.class]))
Can anyone suggest some ideas to solve this ?
Edit :
build.gradle
apply plugin: 'android-library'
android {
compileSdkVersion 19
buildToolsVersion "19.1.0"
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
resources.srcDirs = ['src']
java.srcDirs = ['src']
aidl.srcDirs = ['src']
renderscript.srcDirs = ['src']
res.srcDirs = ['res']
assets.srcDirs = ['assets']
}
// Move the tests to tests/java, tests/res, etc...
instrumentTest.setRoot('tests')
// Move the build types to build-types/<type>
// For instance, build-types/debug/java, build-types/debug/AndroidManifest.xml, ...
// This moves them out of them default location under src/<type>/... which would
// conflict with src/ being used by the main source set.
// Adding new build types or product flavors should be accompanied
// by a similar customization.
debug.setRoot('build-types/debug')
release.setRoot('build-types/release')
}
}
dependencies {
compile fileTree(dir: 'libs', include: '*.jar')
compile(group: 'android', name: 'Lib1', version: '3.7.5', ext: 'aar')
compile(group: 'android', name: 'Lib2', version: '2.0.2', ext: 'aar')
compile(group: 'android', name: 'Lib3', version: '1.2.7', ext: 'aar')
compile(group: 'android', name: 'Lib4', version: '2.2.1', ext: 'aar')
compile 'de.greenrobot:eventbus:2.2.+'
}
Proguard File
-keep class android.support.v4.** { *; }
# MonkeyTalk Time
-dontwarn com.gorillalogic.**
-keep class com.gorillalogic.** { *; }
-keep interface com.gorillalogic.** { *; }
-keep enum com.gorillalogic.** { *; }
# To skip renaming file and method names
-keepattributes SourceFile,LineNumberTable
# EventBus
-keepclassmembers class ** {
public void onEvent(**);
}
#Skip Logger
-assumenosideeffects class android.util.Log {
public static *** d(...);
public static *** v(...);
public static *** e(...);
}
Upvotes: 0
Views: 1958
Reputation: 1006759
Lib1,libb2.. all projects having support-v4-19.1.0.jar
Then that is your problem. Fix those libraries to depend upon the support-v4
artifact (compile 'com.android.support:support-v4:19.1.0'
) rather than copying the JAR into those projects' libs/
directories.
Upvotes: 0