给我的错误消息: Error:FAILURE: Build (异常)。
*出了什么问题:任务':app:transformDexArchiveWithExternalLibsDexMergerForDebug'.执行失败 com.android.builder.dexing.DexArchiveMergerException: java.lang.RuntimeException:无法合并dex
我尝试过将multidex设置为true,并更改和删除应用程序gradle中的行,这在类似的帖子中已经解释过了,但是构建仍然失败。
apply plugin: 'com.android.application'
android {
compileSdkVersion 'android-P'
defaultConfig {
applicationId "com.dheia.crypton"
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'
}
}
}
configurations.all {
resolutionStrategy {
force 'com.android.support:support-annotations:26.1.0'
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support:design:26.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
//adding library for search
implementation 'com.github.mirrajabi:search-dialog:1.1'
compile 'com.android.support:support-annotations:27.1.1'
implementation 'com.android.support:design:26.1.0'
implementation 'com.github.AnyChart:AnyChart-Android:1.0.6'
added dependency to Anycharts Git
}发布于 2018-12-12 05:28:04
有些依赖项隐含地依赖于不同版本的支持库,如下所示:
implementation 'com.github.mirrajabi:search-dialog:1.1'
implementation 'com.github.AnyChart:AnyChart-Android:1.0.6'特别是使用以下支持库的搜索对话框:
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support:recyclerview-v7:25.3.1'因此,您需要使用以下代码排除它们:
implementation ('com.github.mirrajabi:search-dialog:1.1') {
exclude group: 'com.android.support'
exclude module: 'appcompat-v7'
exclude module: 'recyclerview-v7'
}然后,所有依赖项都需要相同版本的支持库。因此,更改以下内容:
compile 'com.android.support:support-annotations:27.1.1'至
implementation 'com.android.support:support-annotations:26.1.0'https://stackoverflow.com/questions/53733187
复制相似问题