On Tue, Feb 24, 2015, at 02:33, Ernest Holloway wrote:
> Is there an official Google supported way of being able to simply and 
> quickly compile an Android library project into a JAR file?

I don't know about "Google-supported", but I use this task (based on one
published by Jake Wharton):

// from http://stackoverflow.com/a/19484146/115145

android.libraryVariants.all { variant ->
  def name = variant.buildType.name
  if (name.equals(com.android.builder.core.BuilderConstants.DEBUG)) {
    return; // Skip debug builds.
  }
  def task = project.tasks.create "jar${name.capitalize()}", Jar
  task.dependsOn variant.javaCompile
  task.from variant.javaCompile.destinationDir
  task.baseName = "cwac-${PUBLISH_ARTIFACT_ID}"
  task.version = PUBLISH_VERSION
  task.exclude('com/commonsware/cwac/**/BuildConfig.**')
}

Obviously, substitute relevant stuff for the CommonsWare bits in there.
And, this task is only for library projects sans resources. For a
library project with resources, here's my 17-hour-old Stack Overflow
answer on that subject:

https://stackoverflow.com/a/28685923/115145

(TL;DR: use the Maven plugin to have Eclipse consume AARs, or convert
the AAR into an Android library project)

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://github.com/commonsguy
http://commonsware.com/blog | http://twitter.com/commonsguy

_The Busy Coder's Guide to Android Development_ Version 6.4: Your App,
on TV!

-- 
You received this message because you are subscribed to the Google Groups 
"adt-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to