android依赖本地工程排除,Android Gradle依赖项排除(Android Gradle dependency exclude)
Android Gradle依赖项排除(Android Gradle dependency exclude)
另一个关于dependency重复/在gradle中排除的问题。 我的问题看起来像这样:
依赖树:
TesterApp
数据服务
FirstWebService
MyJava.Common.Classes
MyAndroidGraphics
MyAndroid.Common.Classes
MyJava.Common.Classes
MyUiViews
MyAndroid.Common.Classes
MyJava.Common.Classes
Project Tester App build.gradle
dependencies {
compile(project(':data.services'))
compile(project(':my.android.graphics'))
compile(project(':my.ui.views'))
}
Data.Services build.gradle
dependencies {
compile(project(':first.webservice'))
}
我的Android Graphics build.gradle
dependencies {
compile(project(':my.android.common.classes'))
}
我的UI视图 build.gradle
dependencies {
compile 'me.dm7.barcodescanner:zxing:1.5'
compile(project(':my.android.common.classes'))
}
我的Android公共类 build.gradle
dependencies {
compile 'com.android.support:appcompat-v7:25.2.0'
compile 'com.android.support:support-v4:25.2.0'
compile 'com.android.support:cardview-v7:25.2.0'
compile(project(':my.java.common.classes'))
}
我的Java公共类 build.gradle
dependencies {
compile 'com.mcxiaoke.volley:library:1.0.9'
}
正如您所看到的,重复是my.java.common.classes和my.android.common.classes ,我无法合并它,因为这些库在不同的项目中使用,并且通常用于不同的项目。
我试图使用那样的exclude
dependencies {
compile(project(':data.services')){
exclude module : ':my.java.common.classes'
}
compile(project(':my.android.graphics')){
exclude module : ':my.java.common.classes'
}
compile(project(':my.java.common.classes'))
}
遗憾的是没有多大帮助,仍然有
com.android.build.api.transform.TransformException: com.android.builder.packaging.DuplicateFileException: Duplicate files copied in APK trust_root.bks
File1: D:\projects\android\my.tester.app\my.java.common.classes\build\libs\my.java.common.classes-1.0.jar
File2: D:\projects\android\my.tester.app\my.android.common.classes\build\libs\my.android.common.classes-1.2.jar
任何想法,请帮助。
One another question about dependency duplication/excluding in gradle. My problem looks like that:
Dependencies tree:
TesterApp
DataServices
FirstWebService
MyJava.Common.Classes
MyAndroidGraphics
MyAndroid.Common.Classes
MyJava.Common.Classes
MyUiViews
MyAndroid.Common.Classes
MyJava.Common.Classes
Project Tester App build.gradle
dependencies {
compile(project(':data.services'))
compile(project(':my.android.graphics'))
compile(project(':my.ui.views'))
}
Data.Services build.gradle
dependencies {
compile(project(':first.webservice'))
}
My Android Graphics build.gradle
dependencies {
compile(project(':my.android.common.classes'))
}
My UI Views build.gradle
dependencies {
compile 'me.dm7.barcodescanner:zxing:1.5'
compile(project(':my.android.common.classes'))
}
My Android Common Classes build.gradle
dependencies {
compile 'com.android.support:appcompat-v7:25.2.0'
compile 'com.android.support:support-v4:25.2.0'
compile 'com.android.support:cardview-v7:25.2.0'
compile(project(':my.java.common.classes'))
}
My Java Common Classes build.gradle
dependencies {
compile 'com.mcxiaoke.volley:library:1.0.9'
}
As you can see, duplicates are with my.java.common.classes and my.android.common.classes, I cannot merge it as those libraries are used in different projects and are generally common for different projects.
I was trying to use exclude like that
dependencies {
compile(project(':data.services')){
exclude module : ':my.java.common.classes'
}
compile(project(':my.android.graphics')){
exclude module : ':my.java.common.classes'
}
compile(project(':my.java.common.classes'))
}
Unfortunately doesn't help much, still has
com.android.build.api.transform.TransformException: com.android.builder.packaging.DuplicateFileException: Duplicate files copied in APK trust_root.bks
File1: D:\projects\android\my.tester.app\my.java.common.classes\build\libs\my.java.common.classes-1.0.jar
File2: D:\projects\android\my.tester.app\my.android.common.classes\build\libs\my.android.common.classes-1.2.jar
Any ideas, please help.
原文:https://stackoverflow.com/questions/45185388
更新时间:2019-11-19 02:25
最满意答案
您应该将它添加到build.gradle:
android {
...
packagingOptions {
pickFirst 'trust_root.bks' // add this
}
}
You should add this to your build.gradle:
android {
...
packagingOptions {
pickFirst 'trust_root.bks' // add this
}
}
2017-07-19
相关问答
问题出在'play-services-gcm'而不是'play-services' compile ('co.realtime:messaging-android:2.1.58'){
exclude group: 'com.google.android.gms', module: 'play-services'
}
那些错误的错误......好吧我以为我可以删除这个问题,但是,有一段时间有人有同样的问题,所以我会留在这里希望也许它可以帮助有需要的人。 The problem wa
...
我个人“我希望我在一年前知道这个”列表中的一件事就是你可以手动添加Realm添加到你的项目而不是依赖Gradle插件。 buildscript {
ext.kotlin_version = '1.2.51'
ext.realm_version = '5.3.1'
repositories {
jcenter()
mavenCentral()
}
dependencies {
classpath "io.rea
...
您可能还需要排除测试依赖性。 在脚本中包含以下内容: testCompile("org.springframework.boot:spring-boot-starter-test") {
exclude group: 'com.vaadin.external.google', module: 'android-json
'}
It's likely you have a test dependency as well that needs to be excluded. Inclu
...
您应该将它添加到build.gradle: android {
...
packagingOptions {
pickFirst 'trust_root.bks' // add this
}
}
You should add this to your build.gradle: android {
...
packagingOptions {
pickFirst 'trust_root.bks' // add this
...
解决方案是将xstream降级到v1.4.7并排除xmlpull。 compile ('com.thoughtworks.xstream:xstream:1.4.7') {
exclude group: 'xmlpull', module: 'xmlpull'
}
我不知道为什么,但我猜测它必须与java8相关。 Solution was to downgrade xstream to v1.4.7 and exclude xmlpull. compile ('com.thoughtwo
...
实际上,您排除了群组,因为我相信您想排除完整的ProjectTwo模块。 如果我没有错,然后尝试: configurations {
compile.exclude module: 'ProjectTwo'
}
You are actually excluding group where as I believe you want to exclude complete ProjectTwo module. If I am not wrong then try: configuratio
...
您不能排除工件的某些特定部分,因为Gradle不知道其中的内容。 要Gradle它是单片的:你要么包含神器内部的任何东西,要么不包括它。 使用ProGuard可以实现您想要的功能。 这是构建应用程序发布版本时的常见步骤,您可以指定要缩小的规则,这将删除不必要的代码。 Android文档有一个代码缩小的文章,其中包含更多详细信息。 可能出现的唯一问题是,如果依赖项本身包含ProGuard配置文件,则可能无法强制缩小指定要保留的内容。 但是,我刚刚调查了你问过的AAR,情况似乎并非如此。 You ca
...
您在应用和测试中使用的是不同版本。 您可以使用以下方法强制应用中的库: compile 'com.google.android.apps.common.testing.accessibility.framework:accessibility-test-framework:2.1.0'
或者只能在测试中使用espresso框架以避免问题: androidTestcompile 'com.android.support.test.espresso:espresso-core:2.2.2'
You
...
只需将此任务添加到build.gradle,然后运行gradle findDuplicates即可找到jar task findDuplicates {
doLast {
def findMe = 'org/apache/commons/codec/StringEncoderComparator.class'
configurations.runtime.asFileTree.matching {
include '**/*.jar'
...
所以我在一位朋友的帮助下想出了这个。 我之所以无法删除support-annotation是因为大多数其他依赖项都使用support-v4作为传递依赖,而那些support-v4也有自己的support-annotation副本。 现在有两个解决方案 解决方案1: 从包含support-v4作为传递依赖的所有依赖项中排除support-annotation 。 解决方案2: 仅从我的support-v4依赖项中排除support-annotation ,并从support-v4作为传递依赖项的所有
...
android依赖本地工程排除,Android Gradle依赖项排除(Android Gradle dependency exclude)相关推荐
- android从本地服务器新浪云,GitHub - SinaCloudStorage/SinaStorage-SDK-Android: Android SDK For 新浪云存储...
获取文件信息: /** * 获取object metadata */ public void getObjectMeta(){ ObjectMetadata objectMetadata = conn ...
- Android:Gradle 依赖相关
一:依赖配置 目前 Gradle 版本支持的依赖配置有:implementation.api.compileOnly.runtimeOnly 和 annotationProcessor 1)imple ...
- linux 搭建gradle android jenkins打包机器,gradle 依赖 jar问题
app/build.gradle文件 apply plugin: 'com.android.application'android {compileSdkVersion 25buildToolsVer ...
- Android Studio 单工程、多工程级联依赖下的aar的引用
Android Studio 多工程级联依赖下的aar的引用 背景: application A 依赖 library B library B 依赖 library C library C 引用aar ...
- Android Gradle依赖配置与依赖冲突解决
#.Gradle依赖配置 ##.Gradle依赖管理与两个重要的classpath相关,每个Module都有: 1.编译时路径:compileClasspath 编译时能使用的代码,当一个类参与编译时 ...
- Android 依赖库发布(上传 Library 到 JCenter)gradle最高支持4.4
1.注册 Bintray 注册时要注意哦,千万不要注册成组织的账户,一定要注册为个人.因为组织账户只有一个月的免费使用时间. 个人账户注册地址:bintray.com/signup/oss 有Gith ...
- Android创建自己的gradle依赖包
最近想把自己做过的一些东西分享给大家,请叫我高产小能手. Android创建自己的gradle依赖包 相信在用Android Studio的同学对gradle都不陌生吧: dependencies { ...
- android studio管理依赖,Android Studio 中的 Gradle 依赖统一管理
在我们的实际项目开发中,通常在一个 Project 项目中会存在多个 Module 的情况,在这些 Module 中会存在一些相同的版本依赖配置,针对进行版本升级的时候需要逐个修改,显得特别麻烦,所以 ...
- android studio的 gradle 依赖同步错误解决方法
android studio的 gradle 依赖同步错误解决方法 参考文章: (1)android studio的 gradle 依赖同步错误解决方法 (2)https://www.cnblogs. ...
- Android Gradle:依赖下载
前言 implementation 'org.greenrobot:eventbus:3.0.0' 1 前面一章介绍了通过implementation 添加依赖的执行过程,在build 阶段的时候gr ...
最新文章
- saas的计费数据库设计_如何构建和扩展SaaS计费解决方案
- 工作10年后,再看String s = new String(xyz) 创建了几个对象?
- 计算机网络-基本概念(2)【网络层】-网际控制报文协议ICMP
- MySQL之事务、锁
- FLOAT或DOUBLE列与具有数值类型的数值进行比较 问题
- 哪位科学家奠定了计算机结构理论,计算机等级考试一级理论知识选择题题库(1-50)...
- Nginx学习之一-第一个程序Hello World
- sql limit 子句_SQL按子句概述和示例
- 收费系统对接微信公账号流程
- window server 2012 win7 远程桌面报错问题,无法远程
- 滴滴天使投资人的25条创业建议
- ROS海龟跟随(坐标变换)
- duck duck go VS Google
- 天涯海客邮件搜索群发大师 使用说明
- VS2010 中修改项目名称
- C语言源程序作业完成系统,C语言源程序的自动评判系统
- 【已解决】程序文件被ESET NOD32误杀或拦截怎么办?以ENDPIINT SECURITY为例添加信任教程截图(ESET通用))
- METIS安装和使用
- 数据结构与算法实验6——图论 7-10 公路村村通
- VISTA或WIN7下使用立体声混音作为录音来源时,如何通过编程方式去除或加入麦克风的输入