4

Whenever I try to build the project, it shows the following error,

Error:Execution failed for task ':app:transformClassesWithDexForDebug'>  com.android.build.api.transform.TransformException: java.lang.RuntimeException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: java.lang.IllegalStateException: dx.jar is missing

I have recently updated my sdk and after that uninstalled android studio unchecking the sdk and downloaded the IDE(just because I wanted to update studio) without sdk and made it to use the present sdk.

Please help! I am not finding any solution working yet.

Urja Pawar
  • 1,087
  • 1
  • 15
  • 29

4 Answers4

3

Did you update your build.gradle as well?

sample:

android {
    compileSdkVersion 24 // this is important
    buildToolsVersion "24" // this also

    defaultConfig {
        applicationId "org.bamboomy.yarne"
        minSdkVersion 15
        targetSdkVersion 24 // recommended
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:24.0.0' // and don't forget this
    compile 'com.android.support:design:24.0.0' // and this
}

I'm not an expert but it seems that in the

C:\Users\myusername\AppData\Local\Android\sdk\build-tools\23.0.2

dir there is no dx.jar (only a dx.bat)

and beginning from 23.0.3 there seems to be a

C:\Users\myusername\AppData\Local\Android\sdk\build-tools\23.0.3\lib

folder with a dx.jar present

SanThee
  • 2,301
  • 3
  • 23
  • 35
1

Deleting sdk platform tools and build tools and reinstalling them worked for me.

Urja Pawar
  • 1,087
  • 1
  • 15
  • 29
0

It's related to your buildToolsVersion config in build.gradle

Go to your SDK path and find the build-tools directory and search for dx.jar file. Each folder that has dx.jar file could be your buildToolsVersion.

If not exist any dx.jar use SdkManager to download one build-tools

Mohsen Zahraee
  • 3,309
  • 5
  • 31
  • 45
-1

add this to your build.gradle

android {
...
defaultConfig {
    ...
    multiDexEnabled true
    }
}

check this asnwer too

Community
  • 1
  • 1
Amit Vaghela
  • 22,772
  • 22
  • 86
  • 142