当前位置: 动力学知识库 > 问答 > 编程问答 >

Android Studio - Gradle build failed Error:Execution failed for task ':app:dexDebug'

问题描述:

I have an odd problem with AS. I have two OSX computers. A simple app builds on one of them but not the other. The two computers are almost identical.

Here are the specs of the two computers:

*OSX 10.8.5 - both fresh installed earlier this year. Not upgraded from older version of OSX.

*JDK 1.8.0_05

*Android Studio 0.8.1 - both fresh installed

*Latest Android SDK. The Android Studio SDK Manager looks exactly the same on both machines.

Here is how I build a test project:

  1. Install fresh install of AS 0.8.0 for OSX
  2. Upgrade to 0.8.1
  3. Update SDKs
  4. Start AS
  5. Select New Project On "Configure your new project page", press Next button
  6. On "Select form factors" page, press Next button
  7. On "Add and activity" page, select Blank Activity and press Next button
  8. On "Choose options" page, press Finish
  9. Let AS build new project
  10. Close Tip of the Day
  11. Press Run button

As you can see, this is letting AS build the most basic template.

On one computer the build fails. On the other computer it succeeds and I can run the project in the emulator. On both computers I can Sync with Gradle and the Gradle build finishes.

On one computer, the build fails when click Run. I have compared the gradle.build files and, of course they are the same. They were both built by AS.

I am assuming something has been installed on the failing computer that prevents the build. How can I "reset" the failing computer? Would uninstalling JDK help? I have deleted AS many times and that does not help. I am not sure how to uninstall the various SDK components.

Here is the error messages I get when I Run on the failing computer:

Build fails with following output:

Information:Gradle tasks [:app:assembleDebug]

:app:preBuild

:app:compileDebugNdk

:app:preDebugBuild

:app:checkDebugManifest

: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

:app:preDexDebug

:app:dexDebug

2014-07-07 21:30:45.482 java[19889:1603] Connection with distnoted server was invalidated

2014-07-07 21:30:45.542 java[19889:4103] Connection with distnoted server was invalidated

Error:Execution failed for task ':app:dexDebug'.

com.android.ide.common.internal.LoggedErrorException: Failed to run command:

/Applications/Android Studio.app/sdk/build-tools/android-4.4W/dx --dex --num-threads=4 --output /Users/clark/AndroidStudioProjects/MyApplication/app/build/intermediates/dex/debug /Users/clark/AndroidStudioProjects/MyApplication/app/build/intermediates/classes/debug /Users/clark/AndroidStudioProjects/MyApplication/app/build/intermediates/dependency-cache/debug

Error Code:

1

Output:

2014-07-07 21:30:45.482 java[19889:1603] Connection with distnoted server was invalidated

2014-07-07 21:30:45.542 java[19889:4103] Connection with distnoted server was invalidated

Information:BUILD FAILED

Information:Total time: 1.514 secs

Information:1 error

Information:0 warnings

Information:See complete output in console

Gradle Console shows following error:

Executing tasks: [:app:generateDebugSources]

Configuration on demand is an incubating feature.

:app:preBuild

:app:preDebugBuild

:app:checkDebugManifest

:app:prepareDebugDependencies

:app:compileDebugAidl

:app:compileDebugRenderscript

:app:generateDebugBuildConfig

:app:generateDebugAssets UP-TO-DATE

:app:mergeDebugAssets

:app:generateDebugResValues

:app:generateDebugResources

:app:mergeDebugResources

:app:processDebugManifest

:app:processDebugResources

:app:generateDebugSources

BUILD SUCCESSFUL

Total time: 4.441 secs

Executing tasks: [:app:assembleDebug]

Configuration on demand is an incubating feature.

:app:preBuild

:app:compileDebugNdk

:app:preDebugBuild

:app:checkDebugManifest

: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

:app:preDexDebug

:app:dexDebug

2014-07-07 21:30:45.482 java[19889:1603] Connection with distnoted server was invalidated

2014-07-07 21:30:45.542 java[19889:4103] Connection with distnoted server was invalidated

FAILED

FAILURE: Build failed with an exception.

  • What went wrong:

    Execution failed for task ':app:dexDebug'.

    com.android.ide.common.internal.LoggedErrorException: Failed to run command:

    /Applications/Android Studio.app/sdk/build-tools/android-4.4W/dx --dex --num-threads=4 --output /Users/clark/AndroidStudioProjects/MyApplication/app/build/intermediates/dex/debug /Users/clark/AndroidStudioProjects/MyApplication/app/build/intermediates/classes/debug /Users/clark/AndroidStudioProjects/MyApplication/app/build/intermediates/dependency-cache/debug

    Error Code:

    1

    Output:

    2014-07-07 21:30:45.482 java[19889:1603] Connection with distnoted server was invalidated

    2014-07-07 21:30:45.542 java[19889:4103] Connection with distnoted server was invalidated

  • Try:

    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Total time: 1.514 secs

分享给朋友:
您可能感兴趣的文章:
随机阅读: