swagger-api / swagger-api/swagger-codegen
Swagger android, multipart is crashing
Nobody has claimed this yet.
- Dominant language
- Mustache
- Stars
- 17.8k
- Forks
- 6k
- PR merge metrics
- No merged PRs in 30d
Description
Description
When uploading a multipart file using swagger produces a crash that says.
java.lang.NoSuchFieldError: org.apache.http.message.BasicHeaderValueFormatter.INSTANCE
This is probably caused by httpmime that is uncotpatible with android. And Android Studio ignores it when compiled
Swagger-codegen version
2.3.0 or the one that is used in editor.swagger.io
Swagger declaration file content or url
Command line used for generation
this is a copy of my gradle
`apply plugin: 'com.android.application'
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.2'
}
}
android {
packagingOptions {
exclude 'META-INF/NOTICE' // It is not include NOTICE file
exclude 'META-INF/LICENSE' // It is not include LICENSE file
exclude 'META-INF/DEPENDENCIES' // It is not include LICENSE file
exclude 'META-INF/NOTICE.TXT'
}
compileSdkVersion 25
buildToolsVersion "25.0.3"
defaultConfig {
applicationId "com.Friendlo.App.Final"
minSdkVersion 16
targetSdkVersion 25
versionCode 9
versionName "1.0.9"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
sourceSets { main { aidl.srcDirs = ['src/main/aidl', 'src/main/aidl/2'] } }
}
configurations.all {
resolutionStrategy.force 'com.google.code.findbugs:jsr305:1.3.9'
}
allprojects {
repositories {
maven { url 'https://jitpack.io' }
mavenCentral() // jcenter() works as well because it pulls from Maven Central
}
}
ext {
swagger_annotations_version = "1.5.0"
gson_version = "2.3.1"
httpmime_version = "4.5.3"
httpcore_version = "4.4.4"
httpclient_version = "4.3.3"
volley_version = "1.0.0"
junit_version = "4.12"
robolectric_version = "3.0"
concurrent_unit_version = "0.4.2"
}
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'
})
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support:support-v4:25.3.1'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.android.support:recyclerview-v7:25.3.1'
testCompile 'junit:junit:4.12'
compile 'de.hdodenhof:circleimageview:2.1.0'
compile 'com.fasterxml.jackson.core:jackson-databind:2.9.0.pr1'
compile 'com.makeramen:roundedimageview:2.3.0'
compile 'com.jsibbold:zoomage:1.1.0'
compile 'joda-time:joda-time:2.9.9'
compile 'com.github.bumptech.glide:glide:3.8.0'
compile 'com.android.support:multidex:1.0.1'
compile 'com.github.medyo:Fancybuttons:1.8.3'
compile 'com.github.nekocode:Badge:2.0'
compile 'com.github.delight-im:Android-SimpleLocation:v1.0.1'
compile 'com.loopj.android:android-async-http:1.4.9'
compile 'com.github.chrisbanes:PhotoView:2.0.0'
compile 'com.facebook.android:facebook-android-sdk:4.+'
compile 'com.google.android.gms:play-services-maps:11.0.1'
compile 'com.google.android.gms:play-services-location:11.0.1'
compile 'com.google.firebase:firebase-ads:11.0.1'
compile 'com.google.firebase:firebase-messaging:11.0.1'
compile 'me.leolin:ShortcutBadger:1.1.16@aar'
compile 'jp.wasabeef:blurry:2.1.1'
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}"
}
apply plugin: 'com.google.gms.google-services'
`
Steps to reproduce
upload any file using multipart
Related issues/PRs
Suggest a fix/enhancement
if possible a swagger version fully compatible with the latest android sdk
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the crash from a generated Android client when uploading any file as multipart. Inspect the generated client's Gradle dependencies around httpmime, httpcore, and the reported BasicHeaderValueFormatter error. Done means multipart uploads work without crashing on Android with the generated client.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- android, java
- Domain
- mobile
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100