如何克服罐子依赖地狱,当多个模块使用相同的罐子? [英] How to overcome jar dependency hell when multiple modules use the same jar?

查看:194
本文介绍了如何克服罐子依赖地狱,当多个模块使用相同的罐子?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个具有多个模块的Andr​​oid项目。这些都是Git的子模块,其中几位被打包用相同的罐子(Android的支持V4,吉斯,Roboguice等)。我的主要项目也有这些相同的依赖性,所以我有这些罐子的三个副本,一个在我的项目,一个在每两个子模块。

I've got an Android project that has multiple modules. These are all Git submodules, and several of them are packaged with the same jars (android support v4, Guice, Roboguice, etc.). My main project also has these same dependencies, so I've got three copies of these jars, one in my project, and one in each of two submodules.

当我建,它无法在DEX阶段,抱怨某些类已经被添加。我能砍解决这个问题,通过摆脱罐子从所有模块,除了一个人,然后指着依赖到该位置,但它只是感觉这么脏。我们有了一个更好的办法。有什么建议?

When I build, it fails at the dex stage, complaining that certain classes have already been added. I can hack around this, by getting rid of the jars from all the modules, except one, then pointing the dependencies to that location, but it just feels so dirty. There's got to be a better way. Any suggestions?

推荐答案

使用类似Maven或常春藤构建工具来管理依赖于你,所以你不必检查JAR文件到您的项目。

Use a build tool like Maven or Ivy that manages dependencies for you, so you don't have to check JARs into your project.

这篇关于如何克服罐子依赖地狱,当多个模块使用相同的罐子?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆