[英]How to exclude a Jar file from the gradle dependancy in android project
I am developing an android application in which I am using two gradle dependency and both gradle dependency has libwebrtc.jar
with different version so I want to exclude libwebrtc.jar
from one of the dependency我正在开发一个 android 应用程序,其中我使用了两个 gradle 依赖项,并且两个 gradle 依赖项都有不同版本的
libwebrtc.jar
,所以我想从依赖项之一中排除libwebrtc.jar
dependencies {
implementation 'com.twilio:video-android:3.2.1'
implementation project(":webrtc-android-framework")
}
This two dependancy has libwebrtc.jar
file with different version if I am remove the libwebrtc.jar
file from the webrtc-android-framework
module then some classes is not found so I can't remove the jar file so I want to exclude the libwebrtc.jar
file from the com.twilio:video-android:3.2.1
dependancy这两扶养有
libwebrtc.jar
与不同版本的文件,如果我删除libwebrtc.jar
从文件webrtc-android-framework
模块则有些类没有找到这样,所以我想排除我无法删除的jar文件libwebrtc.jar
来自com.twilio:video-android:3.2.1
依赖项的libwebrtc.jar
文件
I am getting below error when build the application构建应用程序时出现以下错误
Error: Program type already present:
org.webrtc.BaseBitrateAdjuster
错误:程序类型已经存在:
org.webrtc.BaseBitrateAdjuster
Below is the way enforcing a dependency version:下面是强制执行依赖版本的方法:
configurations.all {
resolutionStrategy.force 'your-dependency:version'
}
If you want to exclude the downstream dependencies depended by your dependencies, try below:如果要排除依赖项所依赖的下游依赖项,请尝试以下操作:
implementation "one-of-your-dependencies" {
exclude group:'org.webrtc'
}
Or more generally,或者更一般地说,
configurations.implementation.transitive = false
Or configurations.compile.transitive = false
if you are using gradle version below 2.3.3
.或者,如果您使用的是低于
2.3.3
gradle 版本,则configurations.compile.transitive = false
.compile.transitive configurations.compile.transitive = false
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.