Skip to content

Instantly share code, notes, and snippets.

@brettwold
Created June 14, 2016 11:10
Show Gist options
  • Select an option

  • Save brettwold/e6e8b74afddd328f2c79eec4e74c924c to your computer and use it in GitHub Desktop.

Select an option

Save brettwold/e6e8b74afddd328f2c79eec4e74c924c to your computer and use it in GitHub Desktop.

Revisions

  1. brettwold created this gist Jun 14, 2016.
    11 changes: 11 additions & 0 deletions android-library-jar.gradle
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,11 @@
    android.libraryVariants.all { variant ->
    def name = variant.buildType.name
    if (name.indexOf("debug") > -1) {
    return; // Skip debug builds.
    }
    def task = project.tasks.create "jar${name.capitalize()}", Jar
    task.baseName = "${project.name}-${rootProject.version}"
    task.dependsOn variant.javaCompile
    task.from variant.javaCompile.destinationDir
    artifacts.add('archives', task);
    }