2016-07-24 58 views
0

我試圖在AVD運行我的應用程序,但是當我選擇運行gradle這個把一個例外:錯誤將字節碼DEX:DexException:圖書館DEX文件不會多DEX模式支持

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 

我當我同步它時,應用程序同步成功,但在運行時! 這是我的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') 
} 

,這是我的其他模塊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') 

} 

我搜索解決這個錯誤的計算器和谷歌,但沒有發現任何有用的答案! 是任何一個可以幫助我的人嗎?

+0

清潔機器人工作室的緩存試試這個..#2 http://stackoverflow.com/a答案/ 17561908/3678308 –

回答

1
  1. 檢查您使用的所有庫,包括庫的依賴關係,並確保沒有衝突的版本。
  2. 從Android的開放Stodio終端鍵入:「./gradlew乾淨」
  3. 重新建造
+0

嗨我試過你這個,但得到這個錯誤:錯誤:無法找到或加載主類org.gradle.wrapper.GradleWrapperMain – afzali

+0

http://stackoverflow.com/questions/29805622/could-not-find-或負載相反主級-ORG-gradle這個-包裝-gradlewrappermain – auval

相關問題