Android Studio多个Module依赖同一个jar的解决方案
16lz
2021-01-23
项目运行出现错误
Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'.
> com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: com/lidroid/xutils/BitmapUtils$BitmapLoadTask.class
1.在app的gradle中以compile引入:
compile files('libs/xUtils-2.6.14.jar')
2.在门禁的module的gradle中以compile引入:
compile files('libs/xUtils-2.6.14.jar')
将任意一个Module中的jar依赖为compile files('libs/xUtils-2.6.14.jar'),其他需要依赖的地方改为provided files('libs/xUtils-2.6.14.jar')
并且删除其他moudule的compile fileTree(include: ['*.jar'], dir: 'libs)。
1.在app的gradle中以compile引入:
compile files('libs/xUtils-2.6.14.jar')
2.在门禁的module的gradle中: provided files('libs/xUtils-2.6.14.jar')
并删除compile fileTree(include: ['*.jar'], dir: 'libs')
注意事项:在门禁的module改完后要clean project,一定要清除缓存,本人就因为这个步骤没做而一直报同个错
更多相关文章
- android如何让webview里的资源访问本地缓存
- android 图片双缓存,开源框架 universali image loader
- [置顶] 我的Android进阶之旅------>android异步加载图片显示,并且
- 【Android开源项目分析】android轻量级开源缓存框架——ASimpleC
- Android 使用finalBitmap实现缓存读取
- android 将bitmap缓存到本地
- Android Retrofit 笔记之一使用拦截器设置缓存