这是我添加时开始的google-api-services-calendar
。尝试构建时出现此错误:
Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'.
com.android.build.transform.api.TransformException: java.util.zip.ZipException:
duplicate entry: com/google/common/annotations/Beta.class
这是运行时输出的一部分./gradlew app:dependencies
:
compile - Classpath for compiling the main sources.
+--- com.google.android.gms:play-services-measurement:8.1.0
| +--- com.google.android.gms:play-services-base:8.1.0
| | \--- com.google.android.gms:play-services-basement:8.1.0
| | \--- com.android.support:support-v4:22.2.0 -> 23.0.1
| | \--- com.android.support:support-annotations:23.0.1
| \--- com.google.android.gms:play-services-analytics:8.1.0
| +--- com.google.android.gms:play-services-basement:8.1.0 (*)
| \--- com.google.android.gms:play-services-ads:8.1.0
| +--- com.google.android.gms:play-services-basement:8.1.0 (*)
| \--- com.google.android.gms:play-services-appindexing:8.1.0
| \--- com.google.android.gms:play-services-basement:8.1.0 (*)
+--- com.google.dagger:dagger:2.0
| \--- javax.inject:javax.inject:1
+--- com.google.android.gms:play-services-identity:8.1.0
| \--- com.google.android.gms:play-services-base:8.1.0 (*)
+--- com.google.android.gms:play-services-plus:8.1.0
| \--- com.google.android.gms:play-services-base:8.1.0 (*)
+--- com.google.android.gms:play-services:8.1.0
| +--- com.google.android.gms:play-services-ads:8.1.0 (*)
| +--- com.google.android.gms:play-services-analytics:8.1.0 (*)
| +--- com.google.android.gms:play-services-appindexing:8.1.0 (*)
| +--- com.google.android.gms:play-services-appinvite:8.1.0
| | \--- com.google.android.gms:play-services-base:8.1.0 (*)
| +--- com.google.android.gms:play-services-appstate:8.1.0
| | \--- com.google.android.gms:play-services-base:8.1.0 (*)
| +--- com.google.android.gms:play-services-base:8.1.0 (*)
| +--- com.google.android.gms:play-services-basement:8.1.0 (*)
| +--- com.google.android.gms:play-services-cast:8.1.0
| | +--- com.google.android.gms:play-services-base:8.1.0 (*)
| | \--- com.android.support:mediarouter-v7:22.2.0
| | \--- com.android.support:appcompat-v7:22.2.0 -> 23.0.1
| | \--- com.android.support:support-v4:23.0.1 (*)
| +--- com.google.android.gms:play-services-drive:8.1.0
| | \--- com.google.android.gms:play-services-base:8.1.0 (*)
| +--- com.google.android.gms:play-services-fitness:8.1.0
| | +--- com.google.android.gms:play-services-base:8.1.0 (*)
| | \--- com.google.android.gms:play-services-location:8.1.0
| | +--- com.google.android.gms:play-services-base:8.1.0 (*)
| | \--- com.google.android.gms:play-services-maps:8.1.0
| | \--- com.google.android.gms:play-services-base:8.1.0 (*)
| +--- com.google.android.gms:play-services-games:8.1.0
| | +--- com.google.android.gms:play-services-base:8.1.0 (*)
| | \--- com.google.android.gms:play-services-drive:8.1.0 (*)
| +--- com.google.android.gms:play-services-gcm:8.1.0
| | \--- com.google.android.gms:play-services-base:8.1.0 (*)
| +--- com.google.android.gms:play-services-identity:8.1.0 (*)
| +--- com.google.android.gms:play-services-location:8.1.0 (*)
| +--- com.google.android.gms:play-services-maps:8.1.0 (*)
| +--- com.google.android.gms:play-services-measurement:8.1.0 (*)
| +--- com.google.android.gms:play-services-nearby:8.1.0
| | \--- com.google.android.gms:play-services-base:8.1.0 (*)
| +--- com.google.android.gms:play-services-panorama:8.1.0
| | \--- com.google.android.gms:play-services-base:8.1.0 (*)
| +--- com.google.android.gms:play-services-plus:8.1.0 (*)
| +--- com.google.android.gms:play-services-safetynet:8.1.0
| | \--- com.google.android.gms:play-services-base:8.1.0 (*)
| +--- com.google.android.gms:play-services-vision:8.1.0
| | \--- com.google.android.gms:play-services-base:8.1.0 (*)
| +--- com.google.android.gms:play-services-wallet:8.1.0
| | +--- com.google.android.gms:play-services-base:8.1.0 (*)
| | +--- com.google.android.gms:play-services-identity:8.1.0 (*)
| | \--- com.google.android.gms:play-services-maps:8.1.0 (*)
| \--- com.google.android.gms:play-services-wearable:8.1.0
| \--- com.google.android.gms:play-services-base:8.1.0 (*)
+--- com.google.guava:guava:18.0
+--- com.google.maps.android:android-maps-utils:0.4
+--- com.google.apis:google-api-services-calendar:v3-rev125-1.20.0
| \--- com.google.api-client:google-api-client:1.20.0
| +--- com.google.oauth-client:google-oauth-client:1.20.0
| | +--- com.google.http-client:google-http-client:1.20.0
| | | \--- com.google.code.findbugs:jsr305:1.3.9
| | \--- com.google.code.findbugs:jsr305:1.3.9
| +--- com.google.http-client:google-http-client-jackson2:1.20.0
| | +--- com.google.http-client:google-http-client:1.20.0 (*)
| | \--- com.fasterxml.jackson.core:jackson-core:2.1.3 -> 2.2.2
| \--- com.google.guava:guava-jdk5:13.0
+--- com.android.support:design:23.0.1
| +--- com.android.support:support-v4:23.0.1 (*)
| \--- com.android.support:appcompat-v7:23.0.1 (*)
+--- com.android.support:recyclerview-v7:23.0.1
| +--- com.android.support:support-v4:23.0.1 (*)
| \--- com.android.support:support-annotations:23.0.1
+--- com.android.support:cardview-v7:23.0.1
+--- com.android.support:palette-v7:23.0.1
| \--- com.android.support:support-v4:23.0.1 (*)
+--- com.android.support:appcompat-v7:22.2.0 -> 23.0.1 (*)
+--- com.android.support:support-v4:22.2.0 -> 23.0.1 (*)
+--- com.firebase:firebase-client-android:2.3.1
| \--- com.firebase:firebase-client-jvm:2.3.1
| +--- com.fasterxml.jackson.core:jackson-databind:2.2.2
| | +--- com.fasterxml.jackson.core:jackson-annotations:2.2.2
| | \--- com.fasterxml.jackson.core:jackson-core:2.2.2
| \--- com.firebase:tubesock:0.0.11
+--- com.firebase:firebase-client-jvm:2.3.0 -> 2.3.1 (*)
+--- net.danlew:android.joda:2.8.0
| \--- joda-time:joda-time:2.8
+--- org.joda:joda-convert:1.2
+--- com.squareup:otto:1.3.5
+--- com.jakewharton:butterknife:7.0.1
+--- org.apache.commons:commons-lang3:3.4
+--- org.apache.commons:commons-collections4:4.0
\--- com.bignerdranch.android:expandablerecyclerview:1.0.3
\--- com.android.support:recyclerview-v7:22.2.0 -> 23.0.1 (*)
我尝试将其添加到 我的 所有 依赖项中:
compile (some.dependencie.that.may.or.may.not.have.the.duplicate){
exclude group: 'com.google.common', module: 'annotations'
}
我试图将其添加到我的android
块:
configurations {
all*.exclude group: 'com.google.common', module: 'annotations'
}
这些变化:
all*.exclude module: 'annotations`
all*.exclude group: 'com.google.common'
all*.exclude group: 'com.google.common.annotations'
这是 修复错误build.gradle
之前的 尝试:
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
// Google
compile 'com.google.dagger:dagger:2.0'
apt 'com.google.dagger:dagger-compiler:2.0'
compile 'com.google.android.gms:play-services-identity:8.1.0'
compile 'com.google.android.gms:play-services-plus:8.1.0'
compile 'com.google.android.gms:play-services:8.1.0'
compile 'com.google.guava:guava:18.0'
compile 'com.google.maps.android:android-maps-utils:0.4'
compile('com.google.apis:google-api-services-calendar:v3-rev125-1.20.0') {
exclude group: 'org.apache.httpcomponents', module: 'httpclient'
}
// Android Design
compile 'com.android.support:design:23.0.1'
compile 'com.android.support:recyclerview-v7:23.0.1'
compile 'com.android.support:cardview-v7:23.0.1'
compile 'com.android.support:palette-v7:23.0.1'
// Android Support
compile('com.android.support:appcompat-v7:22.2.0') {
exclude group: 'org.apache.httpcomponents', module: 'httpclient'
}
compile('com.android.support:support-v4:22.2.0') {
exclude group: 'org.apache.httpcomponents', module: 'httpclient'
}
// Firebase
compile('com.firebase:firebase-client-android:2.3.1') {
exclude group: 'org.apache.httpcomponents', module: 'httpclient'
}
compile('com.firebase:firebase-client-jvm:2.3.0') {
exclude group: 'org.apache.httpcomponents', module: 'httpclient'
}
// Joda Time
compile 'net.danlew:android.joda:2.8.0'
compile 'org.joda:joda-convert:1.2'
// Square
compile 'com.squareup:otto:1.3.5'
compile 'com.jakewharton:butterknife:7.0.1'
provided 'javax.annotation:jsr250-api:1.0'
// Common
compile 'org.apache.commons:commons-lang3:3.4'
compile 'org.apache.commons:commons-collections4:4.0'
compile 'com.bignerdranch.android:expandablerecyclerview:1.0.3'
}
我搜索了我的项目Beta.class
,发现它仅在某些罐子中使用;com.google.common.annotations
,com.google.api.client.util
和dagger.internal
。我试图将添加exclude group
到那些相关的依赖项,但仍然看到相同的错误。
我在这里停留了太久了。有什么建议?
group: 'com.google.guava'
从播放服务相关的依赖项中排除。
例如:
compile ('com.google.android.gms:play-services:8.1.0'){
exclude group: 'com.google.guava'
}
PS在出现错误之前,我遇到了很多不同的情况,因此我的最终依赖项列表为:
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
// Google
compile 'com.google.dagger:dagger:2.0'
apt 'com.google.dagger:dagger-compiler:2.0'
compile ('com.google.android.gms:play-services-identity:8.1.0'){
exclude group: 'com.google.guava'
}
compile ('com.google.android.gms:play-services-plus:8.1.0'){
exclude group: 'com.google.guava'
}
compile ('com.google.android.gms:play-services:8.1.0'){
exclude group: 'com.google.guava'
}
compile 'com.google.guava:guava:18.0'
compile 'com.google.maps.android:android-maps-utils:0.4'
compile('com.google.apis:google-api-services-calendar:v3-rev125-1.20.0') {
exclude group: 'org.apache.httpcomponents'
exclude group: 'com.android.support'
exclude module: 'support-annotations'
exclude group: 'com.google.guava'
}
// Android Design
compile ('com.android.support:design:23.0.1'){
exclude group: 'com.android.support'
}
compile ('com.android.support:recyclerview-v7:23.0.1') {
exclude group: 'com.android.support'
}
compile 'com.android.support:cardview-v7:23.0.1'
compile ('com.android.support:palette-v7:23.0.1'){
exclude group: 'com.android.support'
}
// Android Support
compile('com.android.support:appcompat-v7:22.2.0') {
exclude group: 'org.apache.httpcomponents', module: 'httpclient'
exclude group: 'com.android.support'
}
compile 'com.android.support:support-annotations:23.0.1'
compile('com.android.support:support-v4:22.2.0') {
exclude group: 'org.apache.httpcomponents', module: 'httpclient'
exclude module: 'support-annotations'
}
// Firebase
compile('com.firebase:firebase-client-android:2.3.1') {
exclude group: 'org.apache.httpcomponents', module: 'httpclient'
}
compile('com.firebase:firebase-client-jvm:2.3.0') {
exclude group: 'org.apache.httpcomponents', module: 'httpclient'
}
// Joda Time
compile 'net.danlew:android.joda:2.8.0'
compile 'org.joda:joda-convert:1.2'
// Square
compile 'com.squareup:otto:1.3.5'
compile 'com.jakewharton:butterknife:7.0.1'
provided 'javax.annotation:jsr250-api:1.0'
// Common
compile 'org.apache.commons:commons-lang3:3.4'
compile 'org.apache.commons:commons-collections4:4.0'
compile ('com.bignerdranch.android:expandablerecyclerview:1.0.3'){
exclude group: 'com.android.support'
}
}
我有一个类,它将用一个数组中预先生成的所有员工填写一个列表。我可以用员工填充ArrayList,但唯一的问题是,我得到了一些“重复”条目,我使用引号是因为它们不完全相同,但它们可以共享相同的姓名或员工编号,但可能不具有相同的雇用年份或薪资等。 员工类别如下: 下面是将填充列表的generateList方法: “generateProductionWorker()和shiftSupervisor方法
在一个带有远程显示API的Chromecast项目中,我发现“
我在Android Studio整天都在和这个错误作斗争。项目是从eclipse解决方案导入的。我一直试图实现所有的修复,列出了类似的帖子,没有任何工作。我是一个Android初学者。 我很乐意提供任何进一步的信息。
我将 Digits 移动 sdk 集成到我的项目中,它不再构建。它与我正在使用的gson库有某种冲突。我在构建过程中收到此错误: 这是我的构建.
问题内容: 因此,当尝试向字段添加自动增量时,它会出现#1062-键1的重复条目‘1’。我尝试删除主键并重新添加它,效果很好(我认为如果有重复项,那不会吗?) 但是,当我尝试向字段添加自动增量时,会引发错误。它为我提供了一个浏览选项,该选项运行以下SQL: 但是,这将返回一个空结果集。表明没有重复项。因此,如果没有重复项,为什么不能添加自动增量? 问题答案: 您是否有任何具有值的行或该列的行?可能
问题内容: 所以我的MySQL数据库表现得有些奇怪。这是我的桌子: 当我尝试插入表时出现此#1062错误。因此,我进一步研究了它,并意识到当我尝试在名称和共享值相同的表中插入值时,它将返回#1062错误。例如,如果我插入: 它将返回错误。但是,如果我将共享数更改为6,它将运行正常。是因为我的专栏之一可能是唯一的,还是仅与mysql有关? 问题答案: 您需要删除作为OR