GradleImportAar icon indicating copy to clipboard operation
GradleImportAar copied to clipboard

This project demonstrates how to import aar libs to a pure java gradle module.

trafficstars

Gradle-Import-Aar

Build Status codecov

With this plugin, you can import AARs (android libraries) in a pure java gradle project, so that you can reference classes in them.

Usage

Replace the ${last-version} in below code to number Release and copy to the build.gradle of your java project:

buildscript {
    repositories {
        maven { url "https://jitpack.io" }
    }
    dependencies {
        classpath "com.github.nekocode:GradleImportAar:{last-version}"
    }
}

apply plugin: "import-aar"

Then the plugin will list your original configurations, and create corresponding new configurations naming ${originalName}Aar (Such as compileOnlyAar) for importing AAR dependencies from maven. Take an example:

dependencies {
    compileOnlyAar "com.android.support:appcompat-v7:27.0.2"
}

There is a demo module pureJavaLib in this porject, you can check it to learn more details.