Skip to content Skip to sidebar Skip to footer

Gradle Android Unit Tests That Depend On An 'aar'

Want to be able to depend on an AAR for my unit tests in a Gradle-Android project. I do not want to manually include the external library source or binaries inside my project (for

Solution 1:

I ran into this problem and found a solution - include the classes.jar from the exploded bundle (.aar) in the build folder. I don't think will help with finding resources in .aar dependencies though.

testLocalCompile fileTree(dir: "$project.buildDir/exploded-bundles", include: "**/classes.jar")

Edit: Since Android Gradle build tools 0.9.0 the dependency has changed to:

androidTestCompile fileTree(dir: "$project.buildDir/exploded-aar", include: "**/classes.jar")

As of Android Gradle plugin 0.12.2:

testLocalCompile fileTree(dir: "$project.buildDir/intermediates/exploded-aar/", include:"**/classes.jar") 

Post a Comment for "Gradle Android Unit Tests That Depend On An 'aar'"