Android Library Gradle release JAR

While I haven’t tried uploading the artifacts with a deployment to Sonatype (or even a local repo), here’s what I managed to come up with a few weeks ago when trying to tackle the same problem. android.libraryVariants.all { variant -> def name = variant.buildType.name if (name.equals(com.android.builder.core.BuilderConstants.DEBUG)) { return; // Skip debug builds. } def task … Read more

How to convert AAR to JAR

The AAR file consists of a JAR file and some resource files (it is basically a standard zip file with a custom file extension). Here are the steps to convert: Extract the AAR file using standard zip extract (rename it to *.zip to make it easier) Find the classes.jar file in the extracted files Rename … Read more

Create aar file in Android Studio

If your library is set up as an Android library (i.e. it uses the apply plugin: ‘com.android.library’ statement in its build.gradle file), it will output an .aar when it’s built. It will show up in the build/outputs/aar/ directory in your module’s directory. You can choose the “Android Library” type in File > New Module to … Read more

Adding local .aar files to Gradle build using “flatDirs” is not working

Building upon Josiah’s answer, here’s how I got it to work. Following his instructions (under edit) (File -> New-> New Module -> Import .JAR/.AAR) and import your .AAR. Then in your project build.gradle (not the top level one, the one under ‘app’) add the following (in the dependencies section): dependencies { compile project(‘:Name-Of-Your-Project’) } Note … Read more