0

For instance:

//build.gradle
dependencies {
    ...
    compile 'com.google.guava:guava:19.0'
}

and output jar is:

roroco@roroco ~/Dropbox/jvs/ro-adr/ro $ jar tf build/libs/ro.jar
META-INF/
META-INF/MANIFEST.MF
ro/
ro/Noko.class
ro/RoFile.class
ro/Http.class
ro/Out.class
ro/Range.class
ro/Range$1.class
ro/JSON.class
ro/Str.class
ro/Kernel.class
ro/noko/
ro/noko/Node.class
ro/noko/Doc.class
ro/Rsp.class
ro/Http$RqErr.class

Is there way to add 'com.google.guava:guava:19.0' to ro.jar? I know jar cli can do that, I hope more simple way to do it.

I also hope to know how to do it in android jar file

Batiaev
  • 1,173
  • 1
  • 14
  • 30
chikadance
  • 3,591
  • 4
  • 41
  • 73

1 Answers1

0

As answered Ben McCann in this topic

Just use following configuration

// Include dependent libraries in archive.
mainClassName = "com.company.application.Main"

jar {
  manifest { 
    attributes "Main-Class": "$mainClassName"
  }  

  from {
    configurations.compile.collect { it.isDirectory() ? it : zipTree(it) }
  }
}
Community
  • 1
  • 1
Batiaev
  • 1,173
  • 1
  • 14
  • 30