Gradle构建错误

时间:2015-03-11 10:56:10

标签: android

消息Gradle Build

Information:Gradle tasks [:app:assembleDebug]
:app:preBuild
:app:compileDebugNdk UP-TO-DATE
:app:preDebugBuild
:app:checkDebugManifest
:app:preReleaseBuild
:app:prepareComAndroidSupportAppcompatV72103Library UP-TO-DATE
:app:prepareComAndroidSupportSupportV42103Library 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\Jhun-PC\AndroidStudioProjects\SFELAPCO\app\src\main\java\com\example\jhun_pc\sfelapco\Transfer.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
:app:preDexDebug UP-TO-DATE
:app:dexDebug
UNEXPECTED TOP-LEVEL EXCEPTION:
Error:Execution failed for task ':app:dexDebug'.
> com.android.ide.common.internal.LoggedErrorException: Failed to run command:
  C:\Users\Jhun-PC\AppData\Local\Android\sdk\build-tools\21.1.2\dx.bat --dex --no-optimize --output C:\Users\Jhun-PC\AndroidStudioProjects\SFELAPCO\app\build\intermediates\dex\debug --input-list=C:\Users\Jhun-PC\AndroidStudioProjects\SFELAPCO\app\build\intermediates\tmp\dex\debug\inputList.txt
Error Code:
  2
Output:
  UNEXPECTED TOP-LEVEL EXCEPTION:
  com.android.dex.DexException: Multiple dex files define Landroid/support/v4/accessibilityservice/AccessibilityServiceInfoCompatIcs;
    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:303)
    at com.android.dx.command.dexer.Main.run(Main.java:246)
    at com.android.dx.command.dexer.Main.main(Main.java:215)
    at com.android.dx.command.Main.main(Main.java:106)
Information:BUILD FAILED
Information:Total time: 2 mins 28.956 secs
Information:1 error
Information:0 warnings
Information:See complete output in console

1 个答案:

答案 0 :(得分:0)

看起来您正在使用来自两个不同版本的支持库的依赖关系 两个库中都有Landroid/support/v4/accessibilityservice/AccessibilityServiceInfoCompatIcs,这会在构建时产生冲突。

最好检查一下依赖图。从工作室打开终端,然后cd到您的app模块并运行此命令..\gradlew -q dependencies。它将列出所有具有父依赖项的依赖项,很可能您会在那里找到冲突的支持库。

如果出现任何混淆,请使用您的依赖关系图更新您的问题。并注意libs目录中的jar文件。我担心依赖图可能会跳过它......