1

I have an aar Android library that is also dependent on a number of open-source libraries (RetroFit, Picasso, Android Support Lib, etc) and Google Play Services. It turns out a lot of developers still want the old .jar and Eclipse support.

What would be the best route to go about doing this? Can I package a .jar and provide its dependencies individually?

Fouad Wahabi
  • 804
  • 7
  • 16
2cupsOfTech
  • 5,953
  • 4
  • 34
  • 57

1 Answers1

1

What would be the best route to go about doing this?

Create your JAR, then document what dependencies you have, with suitable links, so those using your JAR can download the dependent JARs.

Optionally, offer the JAR via a Maven-style artifact repository (e.g., Maven Central) and provide the dependency details in the POM, for those Eclipse users who are using Maven.

Or, point out to the Eclipse users that official Eclipse support is evaporating in a few months and so it is not worth it for you to invest in distributing a JAR.

The worst solution, by a long shot, is for you to try bundling the dependencies inside your JAR.

CommonsWare
  • 986,068
  • 189
  • 2,389
  • 2,491
  • 1
    I think Android Design Support Library is not even available as a JAR (its one of my dependent libraries) – 2cupsOfTech Jul 02 '15 at 16:50
  • @2cupsOfTech: Yes, AFAIK, that's only an AAR and a source-based Android library project. Eclipse users have no choice but to make a local copy of that library project and attach it to their app, along with using your JAR. – CommonsWare Jul 02 '15 at 16:54
  • What do you mean by 'Eclipse-friendly Android library project': https://commonsware.com/blog/2014/07/03/consuming-aars-eclipse.html What is your strategy for supporting both aar and jar (Android Studio and Eclipse) ? – 2cupsOfTech Jul 08 '15 at 18:11
  • 1
    @2cupsOfTech: I mean an Android library project that can be loaded into Eclipse. "What is your strategy for supporting both aar and jar" -- nowadays, if my library needs resources, ship an AAR as an artifact and leave Eclipse developers in the cold. If the library does not presently need resources, ship an AAR as an artifact and post a JAR in the GitHub repo's "releases" area for Eclipse users to download. – CommonsWare Jul 08 '15 at 18:14
  • resources would include pretty much everything under the 'res' folder? So for creating jar you are using the same method as in the above link otherwise can you point to any good resource for creating android jar libs ? – 2cupsOfTech Jul 08 '15 at 18:21
  • @2cupsOfTech: "resources would include pretty much everything under the 'res' folder?" -- yes. "So for creating jar you are using the same method as in the above link" -- no. I use a custom Gradle task based on http://stackoverflow.com/a/19484146/115145. If you have further concerns in this area, please ask a fresh Stack Overflow question. – CommonsWare Jul 08 '15 at 18:23
  • there is a question here: stackoverflow.com/q/21417419/550393 would you comment then how to create a jar which includes resources in it and can be used in Eclipse/ADT – 2cupsOfTech Jul 08 '15 at 20:49
  • @2cupsOfTech: "how to create a jar which includes resources" -- that is not possible, sorry, in terms of Android resources. – CommonsWare Jul 08 '15 at 20:49