gpt4 book ai didi

android - Gradle 错误 - 任务 ':app:dexDebug' 执行失败

转载 作者:塔克拉玛干 更新时间:2023-11-02 20:50:14 24 4
gpt4 key购买 nike

我正在尝试将 MPAndroidChartLibrary 添加到我的 Android Studio 项目中,但是当我尝试运行该应用程序时,它一直失败并出现 1 个错误。我不太擅长 gradle,所以我真的不知道出了什么问题。

我的 gradle 文件是这样的:

apply plugin: 'com.android.application'

android {
compileSdkVersion 21
buildToolsVersion "21.0.2"

defaultConfig {
applicationId "com.bacon.corey.audiotimeshift"
minSdkVersion 16
targetSdkVersion 21
versionCode 1
versionName "1.0"
}
buildTypes {
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}

repositories {
flatDir {
dirs 'libs'
}
}

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:21.0.0'
compile 'com.nineoldandroids:library:2.4.0'
compile 'com.android.support:support-v4:21.0.0'
compile 'com.android.support:support-v4:21.0.0'
compile files('C:/Users/Corey/.AndroidStudioBeta/Projects/AudioTimeShift/libraries/mpandroidchartlibrary-1-7-4.jar')
}

据我所知,这应该没问题,但它不起作用。这是来自 Gradle 控制台的日志:

:app:preBuild
:app:compileDebugNdk UP-TO-DATE
:app:preDebugBuild
:app:checkDebugManifest
:app:preReleaseBuild
:app:prepareComAndroidSupportAppcompatV72100Library UP-TO-DATE
:app:prepareComAndroidSupportSupportV42100Library UP-TO-DATE
:app:prepareDebugDependencies
:app:compileDebugAidl UP-TO-DATE
:app:compileDebugRenderscript UP-TO-DATE
:app:generateDebugBuildConfig UP-TO-DATE
:app:generateDebugAssets UP-TO-DATE
:app:mergeDebugAssets UP-TO-DATE
:app:generateDebugResValues UP-TO-DATE
:app:generateDebugResources UP-TO-DATE
:app:mergeDebugResources UP-TO-DATE
:app:processDebugManifest UP-TO-DATE
:app:processDebugResources UP-TO-DATE
:app:generateDebugSources UP-TO-DATE
:app:compileDebugJava
Note: C:\Users\Corey\.AndroidStudioBeta\Projects\AudioTimeShift\app\src\main\java\com\bacon\corey\audiotimeshift\MainActivity.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
:app:preDexDebug
:app:dexDebug
UNEXPECTED TOP-LEVEL EXCEPTION:
Error:Execution failed for task ':app:dexDebug'.
> com.android.ide.common.internal.LoggedErrorException: Failed to run command:
C:\Program Files (x86)\Android\android-sdk\build-tools\21.0.2\dx.bat --dex --output C:\Users\Corey\.AndroidStudioBeta\Projects\AudioTimeShift\app\build\intermediates\dex\debug C:\Users\Corey\.AndroidStudioBeta\Projects\AudioTimeShift\app\build\intermediates\classes\debug C:\Users\Corey\.AndroidStudioBeta\Projects\AudioTimeShift\app\build\intermediates\dependency-cache\debug C:\Users\Corey\.AndroidStudioBeta\Projects\AudioTimeShift\app\build\intermediates\pre-dexed\debug\classes-08104da82547c1da8de562eb9350a514962ceaa7.jar C:\Users\Corey\.AndroidStudioBeta\Projects\AudioTimeShift\app\build\intermediates\pre-dexed\debug\classes-c916341f097aba848a3f8d1cb524d87b40a5e434.jar C:\Users\Corey\.AndroidStudioBeta\Projects\AudioTimeShift\app\build\intermediates\pre-dexed\debug\internal_impl-21.0.0-dd323fb38f6f05cc36bfccaf6824e44b4d16534e.jar C:\Users\Corey\.AndroidStudioBeta\Projects\AudioTimeShift\app\build\intermediates\pre-dexed\debug\library-2.4.0-1028d824e09b12c83da4be3e497c82fdc33874f5.jar C:\Users\Corey\.AndroidStudioBeta\Projects\AudioTimeShift\app\build\intermediates\pre-dexed\debug\mpandroidchartlibrary-1-7-4-1e0626ccaecee3e156334e8c3c9fcf07d352edb9.jar C:\Users\Corey\.AndroidStudioBeta\Projects\AudioTimeShift\app\build\intermediates\pre-dexed\debug\support-annotations-21.0.0-9528452d0a4563476596d64e06f21a3014c413f7.jar
Error Code:
2
Output:
UNEXPECTED TOP-LEVEL EXCEPTION:
com.android.dex.DexException: Multiple dex files define Lcom/nineoldandroids/animation/ValueAnimator$AnimatorUpdateListener;
at com.android.dx.merge.DexMerger.readSortableTypes(DexMerger.java:596)
at com.android.dx.merge.DexMerger.getSortedTypes(DexMerger.java:554)
at com.android.dx.merge.DexMerger.mergeClassDefs(DexMerger.java:535)
at com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:171)
at com.android.dx.merge.DexMerger.merge(DexMerger.java:189)
at com.android.dx.command.dexer.Main.mergeLibraryDexBuffers(Main.java:454)
at com.android.dx.command.dexer.Main.runMonoDex(Main.java:302)
at com.android.dx.command.dexer.Main.run(Main.java:245)
at com.android.dx.command.dexer.Main.main(Main.java:214)
at com.android.dx.command.Main.main(Main.java:106)
Information:BUILD FAILED
Information:Total time: 18.241 secs
Information:1 error
Information:0 warnings
Information:See complete output in console

如果有人能给我一些关于我哪里出错的指示,我将不胜感激。

谢谢,科里 B :)

最佳答案

MPAndroidChart 已经将 com.nineoldandroids:library:2.4.+ 作为依赖项。从依赖项中删除 compile 'com.nineoldandroids:library:2.4.0'

关于android - Gradle 错误 - 任务 ':app:dexDebug' 执行失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27675717/

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