android - DexException:多个dex文件定义了Lorg/apache/http/params/HttpParamConfig;

标签 android android-studio gradle android-gradle-plugin android-multidex

我最近将gradle的android studio更新至3.0.0相同,并且gradle构建成功,但是我无法再运行我的项目,这里是我的gradle文件

enter code here
buildscript {
repositories {
    maven { url 'https://maven.fabric.io/public' }
}

dependencies {
    classpath 'io.fabric.tools:gradle:1.+'
}

}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'

repositories {
maven { url 'https://maven.fabric.io/public' }
mavenCentral()
google()
 }

  apply plugin: 'realm-android'

  android
    {
        signingConfigs {
            config {
                keyAlias 'XXXX'
                keyPassword 'XXXX'
                storeFile 
         file('/XXX/XXX/XXXX/XXX.jks')
                storePassword 'XXX'
            }
        }
        compileSdkVersion 26
        buildToolsVersion '26.0.2'
        defaultConfig {
            applicationId "www.XXX"
            minSdkVersion 23
            targetSdkVersion 26
            versionCode 46
            versionName "1.0"
            testInstrumentationRunner 
            "android.support.test.runner.AndroidJUnitRunner"
            multiDexEnabled true
            vectorDrawables.useSupportLibrary = true
            javaCompileOptions {
                annotationProcessorOptions {
                    includeCompileClasspath false
                }
            }
        }
        buildTypes {
            release {
                minifyEnabled false
                proguardFiles getDefaultProguardFile('proguard-
                android.txt'), 'proguard-rules.pro'
                signingConfig signingConfigs.config
            }
        }
        dexOptions {
            javaMaxHeapSize "4g"
            preDexLibraries = false
        }
        packagingOptions {
            exclude 'META-INF/DEPENDENCIES.txt'
            exclude 'META-INF/LICENSE.txt'
            exclude 'META-INF/NOTICE.txt'
            exclude 'META-INF/NOTICE'
            exclude 'META-INF/LICENSE'
            exclude 'META-INF/DEPENDENCIES'
            exclude 'META-INF/notice.txt'
            exclude 'META-INF/license.txt'
            exclude 'META-INF/dependencies.txt'
            exclude 'META-INF/LGPL2.1'
        }
        configurations.all {
            resolutionStrategy.force 
           'com.google.code.findbugs:jsr305:1.3.9'
            all*.exclude group: 'org.apache.commons'

        }
        compileOptions {
            sourceCompatibility JavaVersion.VERSION_1_8
            targetCompatibility JavaVersion.VERSION_1_8
        }
    }

     dependencies {
     compile fileTree(include: ['*.jar'], dir: 'libs')
     androidTestCompile('com.android.support.test.espresso:espresso-
     core:2.2.2', {
    exclude group: 'com.android.support', module: 'support-annotations'
     })
    implementation project(':carpolo_sdk')
    implementation project(':material-sheet-fab')
implementation('org.eclipse.paho:org.eclipse.paho.android.service:1.0.2') {
    exclude module: 'support-v4'
}
implementation 'com.android.support:multidex:1.0.2'
implementation 'org.eclipse.paho:org.eclipse.paho.client.mqttv3:1.1.1'
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.google.android.gms:play-services:11.4.2'
implementation 'com.android.support:design:26.1.0'
implementation 'com.jakewharton:butterknife:8.6.0'
implementation 'com.squareup.picasso:picasso:2.5.2'
implementation 'com.android.support:cardview-v7:26.1.0'
implementation 'com.android.support:support-v4:26.1.0'
implementation 'com.amazonaws:aws-android-sdk-core:2.3.9'
implementation 'com.amazonaws:aws-android-sdk-s3:2.3.9'
implementation 'com.amazonaws:aws-android-sdk-cognito:2.3.9'
implementation 'com.amazonaws:aws-android-sdk-cognitoidentityprovider:2.3.9'
implementation 'io.saeid:fab-loading:0.6.0'
implementation 'com.google.firebase:firebase-messaging:11.4.2'
implementation 'com.google.firebase:firebase-auth:11.4.2'
implementation 'com.google.firebase:firebase-crash:11.4.2'
implementation 'com.firebaseui:firebase-ui-auth:2.0.1'
implementation 'com.google.android.gms:play-services-auth:11.4.2'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'com.github.clans:fab:1.6.4'
implementation 'com.github.florent37:singledateandtimepicker:1.1.0'
implementation 'com.github.apl-devs:appintro:v4.2.0'
implementation 'com.github.curioustechizen.android-ago:library:1.3.4'
implementation 'me.relex:circleindicator:1.2.2@aar'
implementation 'com.github.Mariovc:ImagePicker:1.2.0'
testCompile 'junit:junit:4.12'
implementation 'com.google.guava:guava:22.0-android'
implementation('com.crashlytics.sdk.android:crashlytics:2.7.1@aar') {
    transitive = true;
  }
 }
 apply plugin: 'com.google.gms.google-services'

我的摇摇欲坠的gradle文件包含以下内容
enter code here
dependencies {
compile "io.swagger:swagger-annotations:$swagger_annotations_version"
compile "com.google.code.gson:gson:$gson_version"
compile "org.apache.httpcomponents:httpcore:$httpcore_version"
compile "org.apache.httpcomponents:httpmime:$httpmime_version"
compile "org.apache.httpcomponents:httpclient-
 android:$httpclient_version"
compile "com.android.volley:volley:${volley_version}"
testCompile "junit:junit:$junit_version"
testCompile "org.robolectric:robolectric:${robolectric_version}"
testCompile "net.jodah:concurrentunit:${concurrent_unit_version}"

}

我找不到我的代码有什么问题,将不胜感激。

最佳答案

事实证明,由于我进行了更新以解决删除.idea文件夹的问题,然后将库混合在一起,然后清理并重建项目,并解决了错误。

关于android - DexException:多个dex文件定义了Lorg/apache/http/params/HttpParamConfig;,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46962353/

相关文章:

android - 如何在首选项 fragment 中创建登录表单

android - Retrofit:处理动态更改名称的 JSON 对象

gradle - 如何使用Gradle基于配置文件构建Quarkus容器?

android - 在新 Activity 中读取 EXIF 数据到 textView

java - 两种不同的布局(垂直和水平)?

java - 错误 : class, 接口(interface),或预期枚举 - Android Studio

android - 使用 AsyncTask 类的简单计数器

android - 使用 cameraX 的 PreviewView 捕获叠加层

android - 构建失败,因为在我的应用程序上添加了新库,导致依赖关系冲突

android - 添加多种配置后,应用运行失败