With this plugin, you can import AARs (android libraries) in a pure java gradle project, so that you can reference classes in them.
Replace the ${last-version} in below code to number 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.