title: Android Studio - Gradle build failed Error:Execution failed for task ':app:dexDebug'
body: <p>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.  </p>
  
  <p>Here are the specs of the two computers:</p>
  
  <p>*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.  </p>
  
  <p>Here is how I build a test project:</p>
  
  <ol>
  <li>Install fresh install of AS 0.8.0 for OSX </li>
  <li>Upgrade to 0.8.1 </li>
  <li>Update SDKs </li>
  <li>Start AS  </li>
  <li>Select New Project On "Configure your new project page", press Next button   </li>
  <li>On "Select form factors" page, press Next button</li>
  <li>On "Add and activity" page, select Blank Activity and press Next button  </li>
  <li>On "Choose options" page, press Finish  </li>
  <li>Let AS build new project  </li>
  <li>Close Tip of the Day  </li>
  <li>Press Run button</li>
  </ol>
  
  <p>As you can see, this is letting AS build the most basic template.</p>
  
  <p>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.  </p>
  
  <p>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.   </p>
  
  <p>Here is the error messages I get when I Run on the failing computer:</p>
  
  <p>Build fails with following output:</p>
  
  <p>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'.</p>
  
  <blockquote>
    <p>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</p>
  </blockquote>
  
  <p>Gradle Console shows following error:</p>
  
  <p>Executing tasks: [:app:generateDebugSources]</p>
  
  <p>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</p>
  
  <p>BUILD SUCCESSFUL</p>
  
  <p>Total time: 4.441 secs
  Executing tasks: [:app:assembleDebug]</p>
  
  <p>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</p>
  
  <p>FAILED</p>
  
  <p>FAILURE: Build failed with an exception.</p>
  
  <ul>
  <li><p>What went wrong:
  Execution failed for task ':app:dexDebug'.</p>
  
  <blockquote>
    <p>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</p>
  </blockquote></li>
  <li><p>Try:
  Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.</p></li>
  </ul>
  
  <p>BUILD FAILED</p>
  
  <p>Total time: 1.514 secs</p>