通过Android Studio合并Dex问题
我的应用程序不会引发错误:
错误:执行任务':app:transformDexArchiveWithExternalLibsDexMergerForDebug'失败。
java.lang.RuntimeException:com.android.builder.dexing.DexArchiveMergerException:无法合并dex
这是y构建gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
defaultConfig {
applicationId "app.monmos"
minSdkVersion 21
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 {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'com.android.support:design:26.1.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation('com.android.support.test.espresso:espresso- core:2.2.2', {
exclude group:'com.android.support', module: 'support-annotations'
})
//noinspection GradleCompatible
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso- core:3.0.1'
implementation 'com.android.support:appcompat-v7:26.0.2'
implementation 'com.android.support:support-v4:26.1.0'
implementation 'com.github.bumptech.glide:glide:4.0.0'
//Fixed Crash FButton
implementation ('com.github.jd-alexander:android-flat-button:v1.1')
//Libraries
implementation 'com.android.support:appcompat-v7:26.+'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'com.google.firebase:firebase-core:11.8.0'
implementation 'com.google.firebase:firebase-database:11.8.0'
implementation 'com.rengwuxian.materialedittext:library:2.1.4'
implementation 'com.android.support:support-annotations:27.1.0'
implementation 'com.android.support:support-v13:27.1.0'
implementation 'com.google.android.gms:play-services:11.8.0'
testCompile 'junit:junit:4.12'
implementation 'com.android.support:cardview-v7:26.+'
implementation 'com.android.support:recyclerview-v7:26.+'
implementation 'com.squareup.picasso:picasso:2.5.2'
implementation 'com.firebaseui:firebase-ui-database:1.2.0'
}
apply plugin: 'com.google.gms.google-services'
implementation 'com.android.support:support-v4:26.1.0'
与以下方面有冲突:
implementation 'com.android.support:support-v13:27.1.0'
你不能有2个版本的同一个库。 使用一个或另一个。
或者你可以添加你的模块的Build.Gradle:
android {
...
defaultConfig {
...
multiDexEnabled = true
}
...
}
它应该解决问题。
让我知道结果如何。
链接地址: http://www.djcxy.com/p/85303.html