gpt4 book ai didi

java - Android Studio 3.0 无法合并 dex

转载 作者:塔克拉玛干 更新时间:2023-11-02 08:09:37 25 4
gpt4 key购买 nike

刚刚将 android studio 从 2.3.3 更新到 3.0 现在我遇到了错误

Error:Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForDebug'. java.lang.RuntimeException: java.lang.RuntimeException: com.android.builder.dexing.DexArchiveMergerException: Unable to merge dex

这是我的 gradle 文件:

apply plugin: 'com.android.application'

android {
compileSdkVersion 25
buildToolsVersion '26.0.2'
defaultConfig {
applicationId "d91.compassacademy"
minSdkVersion 19
targetSdkVersion 25
versionCode 3
versionName "1.0"

testInstrumentationRunner
"android.support.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary = true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
debug {
debuggable true
}
}
}

repositories {
mavenCentral()
google()
}

dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:multidex:1.0.2'

compile('com.google.api-client:google-api-client-android:1.22.0') {
exclude group: 'org.apache.httpcomponents'
}
compile 'pub.devrel:easypermissions:0.2.1'
compile project(path: ':mapviewpager')
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:25.4.0'
compile 'com.android.support:recyclerview-v7:25.4.0'
compile 'com.android.support:cardview-v7:25.4.0'
compile 'com.google.firebase:firebase-database:11.4.2'
compile 'com.google.android.gms:play-services-auth:11.4.2'
compile 'com.google.android.gms:play-services-places:11.4.2'
compile 'com.google.android.gms:play-services:11.4.2'
compile 'com.google.firebase:firebase-storage:11.4.2'
compile 'com.google.firebase:firebase-auth:11.4.2'
compile 'com.firebaseui:firebase-ui-database:1.1.1'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.theartofdev.edmodo:android-image-cropper:2.3.1'
compile 'com.roughike:bottom-bar:2.1.1'
compile 'com.android.support:support-v4:25.4.0'
compile 'com.squareup.retrofit:retrofit:1.9.0'
compile 'com.android.support:support-vector-drawable:25.4.0'
compile 'pub.devrel:easypermissions:0.2.1'
compile 'com.google.code.findbugs:jsr305:2.0.1'
compile 'com.jakewharton:butterknife:8.4.0'
compile 'com.getbase:floatingactionbutton:1.10.1'
compile 'com.android.support:multidex:1.0.2'
compile 'com.android.support.constraint:constraint-layout:1.1.0-beta3'
testCompile 'junit:junit:4.12'
}


apply plugin: 'com.google.gms.google-services'

最佳答案

我抬头看:

Error:Execution failed for task ':memDicez:transformDexArchiveWithExternalLibsDexMergerForDebug'.

com.android.builder.dexing.DexArchiveMergerException: Unable to merge dex

昨天没发现有用的东西,

我的问题现在已经解决了,

此方法可能会让您找到解决方案(对我有用,但不保证对您有用)

我有:

android {
compileSdkVersion 25
buildToolsVersion '26.0.2'

defaultConfig {
applicationId "(my secret applicationId)"
minSdkVersion 21
targetSdkVersion 25
multiDexEnabled true
}

...

}

dependencies {
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support:support-v4:25.3.1'
compile 'ch.acra:acra:4.9.2'
//compile 'com.google.android.gms:play-services-auth:9.0.0'
compile 'com.loopj.android:android-async-http:1.4.9'
compile 'com.koushikdutta.ion:ion:2.+'
compile group: 'com.googlecode.json-simple', name: 'json-simple', version: '1.1.1'
}

当我改变的时候:

        minSdkVersion 21

        minSdkVersion 16

我收到了一条更具描述性的错误消息,确实通过 google/stack overflow 提供了解决方案。

以我为例

compile group: 'com.googlecode.json-simple', name: 'json-simple', version: '1.1.1'

应该改为

compile('com.googlecode.json-simple:json-simple:1.1.1') {
exclude group: 'org.hamcrest', module: 'hamcrest-core'
}

您可以稍后将 minSdkVersion 改回更高的值,但降低它似乎会给出更具描述性(或更可谷歌化)的问题(和解决方案)

干杯,

S.

关于java - Android Studio 3.0 无法合并 dex,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46980900/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com