0

I am trying to use the org.apache.httpcomponents:httpmime:4.5.2 dependency on Android but get this exception:

E/AndroidRuntime: FATAL EXCEPTION: SyncAdapterThread-1 java.lang.ExceptionInInitializerError at org.apache.http.entity.mime.MultipartEntity.<init>(MultipartEntity.java:71) at org.apache.http.entity.mime.MultipartEntity.<init>(MultipartEntity.java:91)

when I call:

MultipartEntity multipartEntity = new MultipartEntity();

Any thoughts as to what might be causing this?

user3352488
  • 281
  • 3
  • 15

1 Answers1

0

Apache HTTP has been removed in Android M. You shouldn't use it anymore.

I suggest you to use OkHttp with MultipartBody or HttpURLConnection with DataOutputStream.

Pycpik
  • 2,316
  • 1
  • 16
  • 21
  • Thank you. I will take a look, although this library was working fine when I had it referenced as a JAR rather than a Gradle dependency. I tried reversing my change but that didn't work... – user3352488 Apr 06 '16 at 14:19