2017-06-14 102 views
1
Below is my build.gradle 

它給我下面的錯誤,如果我生成一個簽名的apk我得到錯誤'編譯'com.android.support:design:23.0.1'編譯'com.android.support:appcompat-v7:23.0.1'

「錯誤:執行失敗的任務 ':應用程序:transformClassesWithDexForRelease'。

com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.dex.DexException: Multiple dex files define Lcom/google/zxing/integration/android/IntentIntegrator;"

apply plugin: 'com.android.application' 

android { 
compileSdkVersion 26 
buildToolsVersion "26.0.0" 
defaultConfig { 
    applicationId "com.example.funanindou.grocerylist" 
    minSdkVersion 19 
    targetSdkVersion 26 
    versionCode 1 
    versionName "1.0" 
    testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 
} 
    buildTypes { 
    release { 
     minifyEnabled false 
     proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 
    } 
} 
} 

dependencies { 
compile fileTree(dir: 'libs', include: ['*.jar']) 
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', { 
    exclude group: 'com.android.support', module: 'support-annotations' 
}) 
compile 'com.android.support:appcompat-v7:26.+' 
compile 'com.android.support.constraint:constraint-layout:1.0.2' 
//compile 'com.android.zxing:core:3.2.0' 
compile 'com.journeyapps:zxing-android-embedded:[email protected]' 
testCompile 'junit:junit:4.12' 

}

好心幫助就如何我可以科幻x這個錯誤

+0

在'defaultConfig'內嘗試添加這一位代碼'multiDexEnabled true' – Ricardo

+0

它仍然顯示相同的錯誤@Ricardo – omah94

回答

2

好像你包括com.journeyapps:zxing-android-embedded庫兩次,可能是你還保存了它的一個罐子在你的lib文件夾?

+0

Thanks @Luca ...我已經將jar保存爲lib。還包括它作爲一個依賴...因此,註釋了build.gradle中的依賴項,我能夠生成apk文件。 – omah94