Hi, Jose!

It seems if I distribute our library as an aar, the only way for developers 
> to use it is placing it on a Maven repository because local aar's aren't 
> taken into account. Any plan to support this?


If we distribute our library only in aar format I guess people still using 
> Eclipse build system won't be able to use it, right?


First, I assume that your library has some resources. 

>From my experience AAR libraries can also be used as regular library 
projects. Just unzip them and attach to your project as library project 
dependency in Eclipse or IntelliJ. The only trick is to add classes.jar to 
classpath too (needs check as I could forget something).

Our library depends on some other internal projects (jars) that are picked 
> up from a Maven repo. The problem is these projects are just internal 
> organization, and I would like them to be included within the aar once we 
> release it. Is there anyway to instruct the library build process to 
> include these jars (or classes) inside the library?


One option would be to add these project dependencies as regular local jars 
during the library build process. 
Something like (assuming that your jars are in the 'libs' folder)
    

>     dependencides {
>         compile files("libs")
>     }


Another option would be a bit more complex:

in build.gradle
1) find all artifact jar dependencies (we don't need local jars)

    project.ext.jarPaths = []
>     project.configurations.compile.allDependencies.each { dep ->
>         // more conditions can be added here to perform additional 
> filtering
>         project.jarPaths += project.configurations.compile.findAll { 
> it.path.contains(dep.name) && it.path.contains('.jar')}.collect { it.path }
>     }
>     // Check what we found
>     jarPaths.each { println "Artifact jar path: $it" } 


2) Add jars to the library zip (aar). Place jars into 'libs' folder

    project.afterEvaluate {
>         android.libraryVariants.each { variant ->
>             variant.packageLibrary.from(project.jarPaths, {
>                 into 'libs'
>             } )
>         }
>     }

 
There could be some subtleness with UP-TO-DATE check of the packageLibrary 
task, but it should always work with 'clean' or 'cleanBundleRelease' tasks. 

On Friday, January 3, 2014 1:12:58 PM UTC+3, Jose Luis Huertas Fernández 
wrote:
>
> Hi,
>
> I'm struggling with the best way to distribute our library (non open 
> source). When I read about the .aar packaging I thought that was the 
> solution, but I'm still finding some limitations:
>
>
>    - It seems if I distribute our library as an aar, the only way for 
>    developers to use it is placing it on a Maven repository because local 
>    aar's aren't taken into account. Any plan to support this?
>    - Our library depends on some other internal projects (jars) that are 
>    picked up from a Maven repo. The problem is these projects are just 
>    internal organization, and I would like them to be included within the aar 
>    once we release it. Is there anyway to instruct the library build process 
>    to include these jars (or classes) inside the library?
>    - If we distribute our library only in aar format I guess people still 
>    using Eclipse build system won't be able to use it, right?
>
> Any idea about how to overcome these limitations?
>
> Thanks,
>
> Jose Luis.
>

-- 
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/groups/opt_out.

Reply via email to