我得到错误'编译'com.android.support:design:23.0.1'编译'com.android.support:appcompat-v7:23.0.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

好像你包括com.journeyapps:zxing-android-embedded库两次,可能是你还保存了它的一个罐子在你的lib文件夹?

+0

Thanks @Luca ...我已经将jar保存为lib。还包括它作为一个依赖...因此,注释了build.gradle中的依赖项,我能够生成apk文件。 – omah94