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

时间:2017-10-26 19:30:02

标签: android android-studio gradle android-gradle android-multidex

我最近更新了android studio到3.0.0同样的gradle到相应的版本,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'

我的swagger 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}"

}

我无法找到我的代码中的任何错误,我们将不胜感激。

1 个答案:

答案 0 :(得分:0)

结果库混合在一起因为我做了更新以解决我删除.idea文件夹然后我清理并重建项目并且错误已解决。