I want to create a jar file (there are no resources associated with it) using AndroidStudio that accesses our server APIs and will be used in several as yet unwritten Android apps. I also want to be able to test these APIs outside of an android app. It doesn't use any android libraries. My questions are 1) how do I configure gradle to just build a jar file? 2) What's the best way to exercise this code in AndroidStudio? Writing a small wrapper that includes a main function that imports the jar file? Writing a toy Android app that exercises the code? Or is my approach completely wrong?
Asked
Active
Viewed 85 times
1 Answers
0
If it doesn't use Android libraries, then why are you trying to create a .jar file in Android Studio? Just use ant. It's the same process as creating a .jar file for Volley, which is detailed in this SO question.
-
Because I don't want to burden future developers with having to learn and maintain yet another build system, although I recognize that is an option. – neveu Jan 09 '15 at 19:28
-
Having to lean ant, literally the most common .jar creator on the face of the planet? Anyway, if you would spend a few seconds googling, you would have found [this SO question](http://stackoverflow.com/questions/16763090/how-to-export-library-to-jar-in-android-studio) that explains that Android Studio can't be used to generate .jar files. If you want to use .jar, use ant, or eclipse, to build it. – sonictt1 Jan 16 '15 at 18:46