合并dex存档时出现Android错误
在更新我的android studio和构建工具版本后,我遇到了这个错误。我已经在互联网上尝试了所有解决这个问题的方法,但没有成功 不知道为什么会发生这种事 Android studio版本:3.1 渐变版本“:4.4 Gradle插件:3.1 我的build.gradle文件合并dex存档时出现Android错误,android,android-studio,android-gradle-plugin,build.gradle,Android,Android Studio,Android Gradle Plugin,Build.gradle,在更新我的android studio和构建工具版本后,我遇到了这个错误。我已经在互联网上尝试了所有解决这个问题的方法,但没有成功 不知道为什么会发生这种事 Android studio版本:3.1 渐变版本“:4.4 Gradle插件:3.1 我的build.gradle文件 apply plugin: 'com.android.application' android { compileSdkVersion 27 defaultConfig { applica
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
defaultConfig {
applicationId "com.abc.abc"
minSdkVersion 21
targetSdkVersion 27
versionCode 1
versionName "1.0"
multiDexEnabled true //Tryed this but not worked
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
repositories {
maven {
url 'https://github.com/jitsi/jitsi-maven-repository/raw/master/releases'
}
// maven { url "https://dl.bintray.com/michelelacorte/maven/" }
mavenCentral()
}
configurations {
all*.exclude module: 'support-v4'
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:27.1.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'com.android.support:design:27.1.0'
implementation 'com.android.support:cardview-v7:27.1.0'
implementation 'com.android.support:support-fragment:27.1.0'
// multipart entity
implementation('org.apache.httpcomponents:httpmime:4.+') {
exclude module: "httpclient"
}
implementation 'com.oguzdev:CircularFloatingActionMenu:1.0.2'
// implementation 'com.wonderkiln:camerakit:0.13.0'
implementation 'com.getbase:floatingactionbutton:1.10.1'
implementation 'org.jitsi.react:jitsi-meet-sdk:1.9.0'
// compile 'com.google.code.gson:gson:2.2.4'
// compile 'com.android.support:support-emoji:26.0.1'
implementation 'com.nostra13.universalimageloader:universal-image-loader:1.9.5'
implementation 'com.android.volley:volley:1.1.0'
implementation 'com.miguelcatalan:materialsearchview:1.4.0'
implementation 'com.yalantis:ucrop:2.2.0-native'
implementation 'com.pnikosis:materialish-progress:1.7'
implementation 'org.igniterealtime.smack:smack-android-extensions:4.2.0'
implementation 'org.igniterealtime.smack:smack-experimental:4.2.0'
implementation 'org.igniterealtime.smack:smack-tcp:4.2.0'
implementation 'org.apache.commons:commons-lang3:3.4'
implementation 'org.jbundle.util.osgi.wrapped:org.jbundle.util.osgi.wrapped.org.apache.http.client:4.1.2'
implementation 'com.googlecode.libphonenumber:libphonenumber:7.0.4'
implementation 'org.greenrobot:eventbus:3.1.1'
implementation 'com.google.android.gms:play-services-places:11.8.0'
implementation 'com.squareup.picasso:picasso:2.5.2'
implementation 'com.google.android.gms:play-services-maps:11.8.0'
implementation 'com.github.bumptech.glide:glide:4.6.1'
annotationProcessor 'com.github.bumptech.glide:compiler:4.6.1'
implementation 'com.eyalbira.loadingdots:loading-dots:1.0.2'
implementation 'de.hdodenhof:circleimageview:2.1.0'
// implementation 'com.google.android.exoplayer:exoplayer:2.7.1'
// compile 'it.michelelacorte.swipeablecard:library:2.3.0@aar'{
// exclude module: 'appcompat-v7'
// exclude group: 'com.android.support'
// }
// BUTTER KNIFE
implementation('com.jakewharton:butterknife:8.5.1') {
exclude module: 'appcompat-v7'
exclude group: 'com.android.support'
}
annotationProcessor 'com.jakewharton:butterknife-compiler:8.5.1'
// implementation project(':libemoji')
implementation 'com.android.support:support-v13:27.1.0'
}
这几乎浪费了我的10天。。。
遇到过的最容易混淆的错误。如果您的代码有两个不同的模块或
support-v4
,它们使用这些库的不同版本,则会发生此错误。
检查您在项目或使用中使用的库的依赖关系
gradle app:dependencies
若要查看项目的依赖关系树,然后在确定哪些库与不同版本一起使用时,请使用正确的版本将其添加到依赖关系中。例如,如果依赖关系中出现google play services:location:11.2.0
,请将其替换为google play services:location:11.8.0
通常,您会在
build.gradle
文件中看到警告或错误消息(即,一个依赖项将用红色下划线标记,显示它导致版本不匹配)在这种情况下。在我的情况下,项目和模块的包名是相同的。在调试模式下运行时,一切正常。但是当我想构建发布模式时,我遇到了这个错误。重命名包名是我的解决方案。你清理并重建了你的应用程序吗?@vikassingh 100 timesbown versionName只需添加这个multiDexEnabled true代码>并尝试清理项目和run@AmjadKhan相同的错误Multidex在这里不是问题。当您使用超过64k个方法时,如果不使用multiDexEnabled true
,您将得到不同的错误签名。此错误似乎是在一个gradle依赖项中使用相同库和不同版本时发生冲突。最好检查web控制台中的eDependencies问题:./gradlew应用程序:依赖项--扫描
gradle app:dependencies