Android Pro-guard在.aar文件中重复压缩条目

时间:2016-04-27 16:45:17

标签: android android-proguard

在我的项目中,我包含了两个.aar库,并且两个aar库在其libs文件夹中都有一个commmon .jar文件。 当我尝试使用pro-guard

来混淆我的代码时
>Error:Execution failed for task ':CpcCaenSample:transformClassesAndResourcesWithProguardForRelease'.
 java.io.IOException: Can't write [D:\Projects\Cone\CpcCaenSample\CpcCaenSample\build\intermediates\transforms\proguard\release\jars\3\1f\main.jar] (Can't read [D:\Projects\Cone\CpcCaenSample\CpcCaenSample\build\intermediates\exploded-aar\CpcSerialCommunication-1.0.4\jars\libs\d2xx.jar(;;;;;;**/*.class)] (Duplicate zip entry [d2xx.jar:com/ftdi/j2xx/BM_REQUEST_TYPE.class]))

我的proguard文件是

> -libraryjars  D:\Projects\Cone\CpcCaenSample\CpcCaenSample\libs\CaenRfidLibrary-1.0.1.aar
-libraryjars  D:\Projects\Cone\CpcCaenSample\CpcCaenSample\libs\CpcHdkCone-1.7.1.aar
-libraryjars  D:\Projects\Cone\CpcCaenSample\CpcCaenSample\libs\CpcHdkIntrabet-1.1.3.aar
-libraryjars  D:\Projects\Cone\CpcCaenSample\CpcCaenSample\libs\CpcHdkVoterDevice-1.0.3.aar
-libraryjars  D:\Projects\Cone\CpcCaenSample\CpcCaenSample\libs\CpcPowerMgmt-2.6.0.aar
-libraryjars  D:\Projects\Cone\CpcCaenSample\CpcCaenSample\libs\CpcSerialCommunication-1.0.4.aar
-libraryjars  D:\Projects\Cone\CpcCaenSample\CpcCaenSample\libs\CpcUtilsLib-4.0.0.aar

>-keep public class com.caen.*
-keep public class com.ftdi.*
-keep public class com.ftdi.j2xx.*
-keep public class com.ftdi.j2xx
-keep public class com.ftdi.d2xx.*
-keep public class com.ftdi.j2xx.BM_REQUEST_TYPE
-keep public class com.ftdi.d2xx.BM_REQUEST_TYPE

>-keep class com.ftdi.j2xx.** { native <methods>; }
-keep class com.ftdi.j2xx { native <methods>; }
-keep class com.ftdi { native <methods>; }

>-verbose

我正在使用android studio 1.5.1。

请分享解决方案。

1 个答案:

答案 0 :(得分:0)

因为您在CaenRfidLibrary文件夹中添加了libs两次,有时在libs文件夹中有相同库的多个版本时会发生这种情况。

和第二个选项可能是您还在此库的gradle.build中添加了依赖项。因此,请检查这两个位置并删除重复的enteries并清理并再次构建APK

希望有所帮助