我在API 19,24,25上启动我的应用程序,它工作正常。但是在 API 23 上,我的应用程序无法启动,它在构建阶段崩溃(gradle(。错误是:
Error:Error converting bytecode to dex:
Cause: java.lang.RuntimeException: Exception parsing classes
(the number of such errors is 28)
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:
Return code 1 for dex process
My build.gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
buildToolsVersion "26.0.2"
defaultConfig {
applicationId "***"
minSdkVersion 15
targetSdkVersion 26
versionCode 7
versionName "1.0"
multiDexEnabled true
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
packagingOptions {
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/NOTICE'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE.txt'
}
}
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:+'
testCompile 'junit:junit:4.12'
testCompile 'org.mockito:mockito-core:1.10.19'
}
如何解决这个问题?对不起,我的英语知识很差。
在 Your build.gradle-中编译它:
implementation 'com.android.support:multidex:1.0.0'