gpt4 book ai didi

Android Studio & Gradle : Multiple dex files

转载 作者:行者123 更新时间:2023-12-03 05:01:55 25 4
gpt4 key购买 nike

今天迁移到Android Studio 1.1,开始更新一些库的版本。当我使用 gradle 按钮构建项目时,一切似乎都正常,但是当我尝试运行应用程序时,我在 gradle 控制台中读取的输出错误消息,您可以在帖子末尾看到。对于我来说,错误消息很清楚,一些库在内部使用了一些库,这些库在我的依赖项之间是通用的,并且它们可能具有不同的版本。有人知道我怎样才能发现哪些库有冲突以及如何解决该问题(我无法从项目中删除任何库)。您可以在下面找到我项目中构建文件的抽象。提前致谢 :)

项目的gradle文件:

buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.0.0'
}
}

allprojects {
repositories {
jcenter()
}
}

应用程序(主模块)的 gradle 文件
buildscript {
repositories {
maven { url 'http://download.crashlytics.com/maven' }
}

dependencies {
classpath 'com.crashlytics.tools.gradle:crashlytics-gradle:1.+'
}
}
apply plugin: 'com.android.application'
apply plugin: 'crashlytics'

repositories {
mavenCentral()
maven { url 'http://download.crashlytics.com/maven' }
}

android {
compileSdkVersion 19
buildToolsVersion '19.1.0'
defaultConfig {
applicationId 'com.myapp'
minSdkVersion 16
targetSdkVersion 19
versionCode 1
versionName '1.0.0'
}
buildTypes {
debug {
debuggable true
}
release {
debuggable false
}
}
dexOptions {
preDexLibraries = false
}
lintOptions {
checkReleaseBuilds false
abortOnError false
}
}

dependencies {
compile project(':facebook')
compile 'com.crashlytics.android:crashlytics:1.+'
compile 'com.jakewharton:butterknife:6.0.0'
compile 'com.squareup:otto:1.3.5'
compile 'com.squareup.picasso:picasso:2.4.0'
compile 'com.squareup.retrofit:retrofit:1.8.0'
compile 'com.squareup.okhttp:okhttp:2.1.0'
compile 'com.squareup.okhttp:okhttp-urlconnection:1.6.0'
compile 'com.path:android-priority-jobqueue:1.1.2'

compile 'com.google.android.gms:play-services-base:6.5.87' // Analytics, GCM
compile 'com.google.android.gms:play-services-maps:6.5.87'
compile 'com.google.android.gms:play-services-location:6.5.87'
compile 'com.android.support:support-v13:21.0.0'
}

Gradle 控制台输出:
Error:Class android.support.v4.util.TimeUtils has already been added to output. Please remove duplicate copies.
1 error; aborting
Error:Execution failed for task ':app:dexDebug'.
> com.android.ide.common.internal.LoggedErrorException: Failed to run command:
/Users/MyMAC/Documents/Development/IDE's/adt-bundle-mac-x86_64-20140702/sdk/build-tools/19.1.0/dx --dex --no-optimize .........
Error Code:
1
Output:
UNEXPECTED TOP-LEVEL EXCEPTION:
java.lang.IllegalArgumentException: already added: Landroid/support/v4/util/TimeUtils;
at com.android.dx.dex.file.ClassDefsSection.add(ClassDefsSection.java:122)
at com.android.dx.dex.file.DexFile.add(DexFile.java:161)
at com.android.dx.command.dexer.Main.processClass(Main.java:685)
at com.android.dx.command.dexer.Main.processFileBytes(Main.java:634)
at com.android.dx.command.dexer.Main.access$600(Main.java:78)
at com.android.dx.command.dexer.Main$1.processFileBytes(Main.java:572)
at com.android.dx.cf.direct.ClassPathOpener.processArchive(ClassPathOpener.java:284)
at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:166)
at com.android.dx.cf.direct.ClassPathOpener.process(ClassPathOpener.java:144)
at com.android.dx.command.dexer.Main.processOne(Main.java:596)
at com.android.dx.command.dexer.Main.processAllFiles(Main.java:498)
at com.android.dx.command.dexer.Main.runMonoDex(Main.java:264)
at com.android.dx.command.dexer.Main.run(Main.java:230)
at com.android.dx.command.dexer.Main.main(Main.java:199)
at com.android.dx.command.Main.main(Main.java:103)
1 error; aborting
Information:BUILD FAILED

最佳答案

删除 安卓支持-v4 中的文件夹 Facebook proj 或您的应用程序模块

关于Android Studio & Gradle : Multiple dex files,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27688704/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com