Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Good idea to include JAR files in Android library (potential conflict with other libraries)?

My Android library requires some of the newer Apache HTTPClient jar files so that I can upload a multipart file (See related SO question)

I'm pretty sure there will be some apps out there using my library with a different version of these Apache JAR files already, resulting in a conflict.

I've seen this happen quite a few times with android-support-v4.jar and third-party libraries. Is there any best-practice work-around, or should I implement multipart uploading from scratch?

like image 251
14 revs, 12 users 16% Avatar asked Oct 20 '22 15:10

14 revs, 12 users 16%


1 Answers

You can repackage the apache http client so that it uses a new package name so that it does not conflict with any other versions on the classpath.

This question explains how to do it with the maven shade plugin,

This article explains how to do it with jarjar and ant.

like image 140
sbridges Avatar answered Oct 23 '22 05:10

sbridges