Gradle Android unit tests that depend on an 'aar' for build tool 0.11.+ -
i using gradle build scheme run roboletric tests i've encountered problem described here gradle android unit tests depend on 'aar' solution works build tool version 0.9.+ , not 0.11.+ cannot find exploded-aar directory. ideas?
here's partial build file
configurations { testlocalcompile { extendsfrom compile } } sourcesets { testlocal { java.srcdir file('src/test/java') resources.srcdir file('src/test/res') compileclasspath += configurations.testlocalcompile runtimeclasspath += compileclasspath } } dependencies { testlocalcompile filetree(dir: "$project.builddir/intermediates/exploded-aar", include: "**/classes.jar") } task localtest(type: test, dependson: assemble) { testclassesdir = sourcesets.testlocal.output.classesdir android.sourcesets.main.java.srcdirs.each { dir -> def builddir = dir.getabsolutepath().split('/') builddir = (builddir[0..(builddir.length - 4)] + ['build', 'intermediates', 'classes', 'debug']).join('/') sourcesets.testlocal.compileclasspath += files(builddir) sourcesets.testlocal.runtimeclasspath += files(builddir) } classpath = sourcesets.testlocal.runtimeclasspath } check.dependson localtest
that alter 1 time again in 0.12.2
http://tools.android.com/tech-docs/new-build-system
move unzipped aar in each project temporary prepare possible race condition.
so have alter dependency back:
unittestcompile filetree(dir: "$project.builddir/intermediates/exploded-aar/", include:"**/classes.jar") (ps: not know if right way post in stackoverflow)
android unit-testing gradle robolectric
No comments:
Post a Comment