As much as I have researched, it seems that I am only able to create an Android Library
within an Android Project. Is there any way in which I can create a Standalone Android Library and not have it within or alongside an App?
My scenario is to work on this Android Library and for it to create an AAR
when I compile which I can then reference in a separate Android Project.
I so far have a project running but it has an App and a Library at the same level. I achieved this by creating a new project and then:
File -> New -> New Module -> Android Library.
Create a new Android Library, we'll call it "MyAar" (File -> New -> New Module -> Android Library)
Now there should be a folder named "MyAar" on the Android hierarchy (usually the left most window in Android Studio)
Add all the source code you want in there under the "Java" folder, and adjust your build.gradle
file accordingly (the one that says "Modele:MyAar" and begins with apply plugin: 'com.android.library'
).
Highlight "MyAar" on the Android hierarchy window, then press Build -> Make Module 'MyAar' at the bar on the top (where File, Edit, View... is located)
Go to the folder YOUR_ANDROID_APPLICATION/MyAar/build/outputs/aar
, you will see a MyAar-debug.aar
. That is your .aar which you can now drop into any other project.
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