如何从Android中的gradle依赖项添加的外部库目录中删除jar文件? [英] How to remove a jar file from the external libraries directory, which is added by the gradle dependency, in android?

查看:550
本文介绍了如何从Android中的gradle依赖项添加的外部库目录中删除jar文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

首先,我在gradle中添加了一个依赖项,然后同步了该项目.我们没有任何错误,但是在运行应用程序时,我们得到了一个错误,该错误也在图像中显示.

First, I have added a dependency in gradle, and then sync the project. We have no error, but when we run the application, we got an error which is also showing in the image.

    :app:transformClassesWithJarMergingForDebug FAILED
    Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'.
com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: javax/inject/Inject.class

我们发现重复的jar文件具有不同的版本,上面突出显示了该文件.现在,我只想删除此重复的jar文件(java.inject-1). 希望有人对此有解决方案.

We found a duplicate jar file with different version which is highlighted above. Now I want to remove only this duplicate jar file(java.inject-1). Hope someone has a solution for this.

推荐答案

请在下面的gradle依赖项中尝试.

please try below in your gradle dependency.

compile('org.igniterealtime:rest-api-client:1.1.3')
{exclude module: "javax.inject"}

这篇关于如何从Android中的gradle依赖项添加的外部库目录中删除jar文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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