I need to create an Android Library and deliver the final .jar file to the clients.
I am new to Android development (three days). I've been developing iOS for the last 4 years. I went through Google's official documentation and tutorials to get a feel for the platform (I don't want it to be obvious that an iOS guy was writing the library).
I don't have any problems with Java, but I do with Android. I decided to go with Android Studio since it is the official IDE. I am using version 1.5.
PROBLEM:
So as I said, I need to create an Android Library and deliver the .jar file to the clients. I would like this Android Studio project to be a standalone library project with its own unit tests. I don't want to create an unnecessary App project, and then add an Android Library module to it. I want to create a separate App project which will include this .jar file, so I can test it in the way it will reach our clients.
I've seen a lot of options online for how to accomplish this, but all of them seem a bit "hacky" (e.g. rename this folder, change that app-project-setting and make it a library project). Is there no way to create a Library project from a new project wizard in Android Studio?
What are your suggestions on how I should proceed with this? Is there some elegant solution to this without these tricks to re-configure the App project?
EDIT
Here is what the new project wizard looks like:
I select "Add no activity" here
An AAR file contains a software library used for developing Android apps. It is structurally similar to an . APK file (Android Package), but it allows a developer to store a reusable component that can be used across multiple different apps.
This may not feel comfortable for a person from other platform/IDE/world, but this is The Way. Personally i'm getting annoyed with Xcode every time i use it in the exact same way you're annoyed with AndroidStudio now. But lets get down to business:
(Optional) go to "Run\Edit Configurations" and set everything like below:
Now open the librarie's 'build.gradle' file. Make sure to open the file from exact same folder which is named with your library name, because there are a couple of 'build.gradle' files all over the place. Remove support-library entry from the file:
Go to "Build" menu at the top and select "Build APK".
And about unit tests:
**Edit 1: **
If you really want to remove the 'app' folder, than follow instructions on a picture below:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With