Home » Android » Gradle Execution failed for task ':app:dexDebug' with new Android Studio Project

Gradle Execution failed for task ':app:dexDebug' with new Android Studio Project

Posted by: admin June 15, 2020 Leave a comment

Questions:

I newly installed Android started a new default project.
Everytime I try to start the app this error occurs:

Error:Execution failed for task ‘:app:dexDebug’.
com.android.ide.common.internal.LoggedErrorException: Failed to run command:
C:\Users\iralu_000\AppData\Local\Android\android-studio\sdk\build-tools\19.1.0\dx.bat –dex –num-threads=4 –output C:\Users\iralu_000\AndroidStudioProjects\BuyItOrNot\app\build\intermediates\dex\debug C:\Users\iralu_000\AndroidStudioProjects\BuyItOrNot\app\build\intermediates\classes\debug C:\Users\iralu_000\AndroidStudioProjects\BuyItOrNot\app\build\intermediates\dependency-cache\debug
Error Code:
1
Output:
Das System kann den angegebenen Pfad nicht finden.
Das System kann den angegebenen Pfad nicht finden.
Das System kann den angegebenen Pfad nicht finden.
(Englisch: The system can not find the path specified.)

build.gradle

apply plugin: 'android'

android {
    compileSdkVersion 19
    buildToolsVersion "19.1.0"

    defaultConfig {
        applicationId "iralution.buyitornot"
        minSdkVersion 19
        targetSdkVersion 19
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            runProguard false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-    rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
}

Installed via SDK Managers are:
enter image description here

I tried to clean the project via cmd with gradlew clean but the error remains.

I tried different JAVA SDKs (7 and currently 8).

I tried to add the support library to the dependencies as suggested here.

Android Studio is in Version 0.6.1

I have no clue what I could try now.

Thanks in advance,

Ira

Update:

I’ve manipulated the find_java.bat in the android-sdk which is called by the dx.bat. Instead of

for /f "delims=" %%a in ('"%~dps0\find_java.exe" -s') do set java_exe=%%a

and

for /f "delims=" %%a in ('"%~dps0\find_java.exe" -s -w') do set javaw_exe=%%a

I’ve set the java_exe and javaw_exe directly. This eradicates two of the three “could not find the path specified” errors, but one still remains and I cannot figure why.

enter image description here

How to&Answers:

Hello i’m not sure if this will solve your problem but you should take a look at this answer

https://stackoverflow.com/a/21752326

in this answer it seems that the cmd.exe command can’t be found. And he solved it by making this change :

I removed key default with value C:\windows\cmd.exe in registry at HKEY_CURRENT_USER\Software\Microsoft\Command Processor and Problem Resolved…

So maybe you should take a look at this registery to see if you could change the path of the command to fix this issue.

Answer:

I had this same issue. For me, the culprit was a cmd.exe AutoRun registry key, located at

HKEY_CURRENT_USER\Software\Microsoft\Command Processor\AutoRun

I deleted this key, and the errors disappeared.

For more information, see: http://blogs.msdn.com/b/oldnewthing/archive/2007/11/21/6447771.aspx