0

i tried to run my app in avd but when i select to run the gradle turn an exception :

Error:Error converting bytecode to dex:
Cause: com.android.dex.DexException: Library dex files are not supported in multi-dex mode
    :app:transformClassesWithDexForDebug FAILED
    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: com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Program Files\Java\jdk1.8.0_66\bin\java.exe'' finished with non-zero exit value 2

my app is synced successfully when i sync it but on running time! this is my gradle:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.1"

    defaultConfig {
        applicationId "ir.esfandune.material"
        minSdkVersion 9
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
        multiDexEnabled true
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    dexOptions {
        incremental true
        preDexLibraries = false
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_7
        targetCompatibility JavaVersion.VERSION_1_7
    }
}

repositories {
    jcenter()
    maven { url "https://oss.sonatype.org/content/repositories/snapshots" }

}

dependencies {
    compile 'com.android.support:multidex:1.0.1'
    compile 'com.android.support:design:23.0.0'
    compile 'com.android.support:appcompat-v7:23.0.0'
    compile 'com.android.support:cardview-v7:23.0.0'
    compile 'com.android.support:recyclerview-v7:23.0.0'
    compile 'com.android.support:support-v4:23.0.0'
    compile 'com.github.rey5137:material:1.2.1.6-SNAPSHOT'
    compile project(':material-dialogs')
    compile files('lib/glide-3.6.1-       3f8a822297969bbac00507aeca83271794f037ca.jar')
    //compile files('lib/de.hdodenhof/circleimageview/1.3.0/jars/classes.jar')
}

and this is my other module gradle file:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.1"

    defaultConfig {
        applicationId "ir.esfandune.material"
        minSdkVersion 9
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
        multiDexEnabled true
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    dexOptions {
        incremental true
        preDexLibraries = false
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_7
        targetCompatibility JavaVersion.VERSION_1_7
    }
}

repositories {
    jcenter()
    maven { url "https://oss.sonatype.org/content/repositories/snapshots" }

}

dependencies {
    compile 'com.android.support:multidex:1.0.1'
    compile 'com.android.support:design:23.0.0'
    compile 'com.android.support:appcompat-v7:23.0.0'
    compile 'com.android.support:cardview-v7:23.0.0'
    compile 'com.android.support:recyclerview-v7:23.0.0'
    compile 'com.android.support:support-v4:23.0.0'
    compile 'com.github.rey5137:material:1.2.1.6-SNAPSHOT'
    compile project(':material-dialogs')
    compile files('lib/glide-3.6.1-3f8a822297969bbac00507aeca83271794f037ca.jar')

}

i searched for fix this error on stackoverflow and google but didnt find any useful answer! is that any one that can help me plz?

afzali
  • 125
  • 1
  • 3
  • 12

1 Answers1

1
  1. check all your libraries you use, including dependencies of the libraries and make sure there are no conflicting versions.
  2. open terminal from Android Stodio and type in: "./gradlew clean"
  3. build again
Amir Uval
  • 14,425
  • 4
  • 50
  • 74
  • hi i tried your this but get this error: Error: Could not find or load main class org.gradle.wrapper.GradleWrapperMain – afzali Jul 24 '16 at 08:39
  • http://stackoverflow.com/questions/29805622/could-not-find-or-load-main-class-org-gradle-wrapper-gradlewrappermain – Amir Uval Jul 24 '16 at 08:47