Description
Hi.
Been testing the mobil generated clients (swift, objc, android/java) objective c and swift works great, but i have not been able to get android to work. First i used the client with the apache.http client dependency, but android kept refusing to install the test app i created to a device because of the internal apache http client. I then tried the Volly version, but to my suprise it still depends on the apache http client, at least the version im getting generated from the swagger codegen, so i have the same problem, i cannot make android studio build the test app to a device-
Then i tried the java one with the okhttp-gson but i cant even get android studio to work with it, i must be doing something wrong. I dont know if its me but it seems very hard to get the Swagger codegen to generate anything that can work with android studio and build to a device in a test project.
When trying to deploy my test app to device, with the Android/Volly client i get this error:
"Error:Execution failed for task ':app:transformResourcesWithMergeJavaResForDebug'.
> com.android.build.api.transform.TransformException: com.android.builder.packaging.DuplicateFileException: Duplicate files copied in APK META-INF/LICENSE
File1: C:\Users\morten.nielsen\.gradle\caches\modules-2\files-2.1\org.apache.httpcomponents\httpmime\4.5.2\22b4c53dd9b6761024258de8f9240c3dce6ea368\httpmime-4.5.2.jar
File2: C:\Users\morten.nielsen\.gradle\caches\modules-2\files-2.1\org.apache.httpcomponents\httpclient-android\4.3.3\39ba75b570e5f1535356e8a1bf920b1c6cc83a9a\httpclient-android-4.3.3.jar
File3: C:\Users\morten.nielsen\.gradle\caches\modules-2\files-2.1\org.apache.httpcomponents\httpcore\4.4.4\b31526a230871fbe285fbcbe2813f9c0839ae9b0\httpcore-4.4.4.jar"
If i ignore the license file like this:
" 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'
}"
i get this error:
"Error:Execution failed for task ':app:transformClassesWithDexForDebug'.
> com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.dex.DexException: Multiple dex files define Lorg/apache/http/Consts;"
Im using the latest version of swagger-codegen to date
im using this command line tool to generate it:
java -jar swagger-codegen-cli.jar generate -i [path] -l android --library=volley -o /var/tmp/android/volley/
I dont know what the problem is, i use the generated client in a complete empty project with an empty activity. only thing i have done with the Android/Volly is to add it to my test project as a module and sync/build and run on device.
Im also getting the dependency warnings:
Warning:WARNING: Dependency org.apache.httpcomponents:httpclient:4.5.2 is ignored for release as it may be conflicting with the internal version provided by Android.
Warning:WARNING: Dependency org.apache.httpcomponents:httpclient:4.5.2 is ignored for debug as it may be conflicting with the internal version provided by Android.