org.apache.http.ContentTooLongException消息{种类=错误,文本=程序类型已存在:org.apache.http.ContentTooLongException

时间:2018-06-27 04:40:03

标签: android gradle android-gradle

Program type already present: org.apache.http.ContentTooLongException 

Message{kind=ERROR, text=Program type already present: org.apache.http.ContentTooLongException, sources=[Unknown source file], tool name=Optional.of(D8) }

build.gradle

apply plugin: 'com.android.application'

android {
    compileSdkVersion 28
    defaultConfig {
        applicationId "com.sample.io.sos"
        minSdkVersion 15
        targetSdkVersion 28
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    buildToolsVersion '28.0.0'
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
    dependencies {
        compileOnly 'javax.annotation:jsr250-api:1.0'
    }
}

dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    implementation 'com.android.support.constraint:constraint-layout:1.1.2'
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
    implementation 'com.android.support:appcompat-v7:28.0.0-alpha3'
    implementation 'com.android.support:design:28.0.0-alpha3'
    implementation 'com.judemanutd:autostarter:1.0.0'
    implementation 'com.android.support:multidex:1.0.3'
    implementation "com.squareup.retrofit2:retrofit:2.4.0"
    implementation "com.squareup.retrofit2:converter-gson:2.4.0"
    implementation 'io.reactivex.rxjava2:rxandroid:2.0.1'
    implementation 'io.reactivex.rxjava2:rxjava:2.1.7'
    implementation 'com.squareup.retrofit2:adapter-rxjava2:2.4.0'
    implementation 'com.squareup.retrofit:retrofit:1.6.1'
    implementation 'com.squareup.picasso:picasso:2.5.2'
    implementation 'org.parceler:parceler-api:1.1.10'
    annotationProcessor 'org.parceler:parceler:1.1.10'
    implementation 'com.jakewharton:butterknife:8.8.1'
    annotationProcessor 'com.jakewharton:butterknife:8.8.1'
    annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'

    implementation 'io.swagger:swagger-annotations:1.5.15'
    implementation 'io.gsonfire:gson-fire:1.8.0'
    implementation 'org.threeten:threetenbp:1.3.5'
    implementation "com.google.code.gson:gson:2.8.2"
    implementation "org.apache.httpcomponents:httpcore:4.4.4"
    implementation "org.apache.httpcomponents:httpmime:4.5.2"
    implementation "org.apache.httpcomponents:httpclient-android:4.3.3"
    implementation "com.android.volley:volley:1.1.0"
    testImplementation "org.robolectric:robolectric:3.0"
    testImplementation "net.jodah:concurrentunit:0.4.2"
    testImplementation "junit:junit:4.12"
}

无法解决此问题。在这里,我在项目中使用swagger生成的android java代码。添加了相关的实现。

2 个答案:

答案 0 :(得分:0)

Swagger为旧版本提供sdk(compileSdkVersion 25)。仍然他们没有更新该SDK。但是我想开发最新版本的28。该sdk上还有更多版本不兼容的问题。 我在github中报告了这个问题。 Swagger issues

答案 1 :(得分:0)

我正在使用SDK版本22,而我的comppiledsdk版本是27。它给我同样的错误。是否有共享指针?

Gradle-

apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android-extensions'

android {
    compileSdkVersion 27
    buildToolsVersion '27.0.3'
    defaultConfig {
        applicationId "com.example.hp.mayukhapp"
        minSdkVersion 21
        targetSdkVersion 27
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false


            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    packagingOptions {
        exclude 'META-INF/DEPENDENCIES'
        exclude 'META-INF/LICENSE'
        exclude 'META-INF/LICENSE.txt'
        exclude 'META-INF/license.txt'
        exclude 'META-INF/NOTICE'
        exclude 'META-INF/NOTICE.txt'
        exclude 'META-INF/notice.txt'
        exclude 'META-INF/ASL2.0'
    }
}

allprojects {
    repositories {
        maven { url 'https://jitpack.io' }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support.constraint:constraint-layout:1.1.0'


    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
        compile 'com.android.support:cardview-v7:26.1.0'
        compile 'de.hdodenhof:circleimageview:2.2.0'
        compile 'com.sendgrid:sendgrid-java:4.0.1'

    })
    implementation 'com.android.support:appcompat-v7:27.1.0'
    compile group: 'com.pkmmte.view', name: 'circularimageview', version: '1.0'
    compile 'com.mostafagazar:customshapeimageview:1.0.4'
    compile 'com.makeramen:roundedimageview:2.3.0'
    implementation 'com.github.pedroSG94.vlc-example-streamplayer:pedrovlc:2.5.14'
    implementation 'com.rvirin.onvif:onvifcamera:1.1.8'
    implementation 'com.squareup.okhttp3:okhttp:3.10.0'
//    compile 'org.apache.httpcomponents:httpclient-android:4.3.5'
    // compile 'com.android.support:appcompat-v7:26.0.0-alpha1'
   // compile group: 'org.apache.httpcomponents' , name: 'httpclient-android' , version: '4.3.5.1'
    compile 'com.android.support:design:27.1.0'
    compile 'com.google.android.gms:play-services:11.0.2'
    testCompile 'junit:junit:4.12'
    compile "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
    compile('org.apache.httpcomponents:httpmime:4.3.6') {
        exclude module: 'httpclient'
    }
    compile 'org.apache.httpcomponents:httpclient-android:4.3.5'
}
repositories {
    mavenCentral()
}