android打包時The same input jar is specified twice 解決辦法
阿新 • • 發佈:2019-02-15
在給app打包時遇到下面的問題
Warning:Exception while processing task java.io.IOException: The same input jar […….jar] is specified twice.
解決辦法如下:
開啟 proguard-rules.pro(app混淆程式碼時配置的檔案)
在所有的-libraryjars
前插入 # 成 #-libraryjars
xxxx.jar
#4.保留libs避免混淆 #-libraryjars libs/fastjson-1.2.2.jar #-libraryjars libs/gmt-oneshot-lib.jar #-libraryjars libs/okhttp-3.5.0.jar #-libraryjars libs/okio-1.11.0.jar #-libraryjars libs/umeng-analytics-v6.1.0.jar
原因
原因是build.gradle檔案配置了
dependencies {
compile fileTree(include: '*.jar', dir: 'libs')
}
- 1
- 2
- 3
裡面已經新增過jar包,混淆檔案proguard-rules.pro裡面又加了句-libraryjars
libs/***.jar
,將-libraryjars libs/***.jar
前面用#號註釋或者直接刪掉即可。
sdk 通過 proguard 混淆程式碼時預設已經將 lib目錄中的 jar 都已經新增到打包指令碼中,所以不需要再次手動新增。