This depends on the version of the SDK used, in particular the included build files found in the <android-sdk>/tools/ant directory.
Android SDK> = 18
As in the r18 SDK and above, it is as simple as adding a property to your ant.properties file of the target (non-test) project. For example, use
emma.filter=-*.test.*
To exclude all classes from the test suite. The syntax of the emma filter can be found in the emma documentation .
Android SDK <18
There is a problem for this . This includes the following:
- you need to modify the build file for your target project (not a test project).
- modify the assembly file by copying the
-emma-instrument target from the imported android assembly files (you should find an explanation of this method in the standard project assembly file that you get by running android create/update project ) change the goal according to the related problem, it will look like this:
<target name="-emma-instrument" depends="compile"> <echo>Instrumenting classes from ${out.absolute.dir}/classes...</echo> <emma enabled="true"> <instr verbosity="trace1" mode="overwrite" instrpath="${out.absolute.dir}/classes" outdir="${out.absolute.dir}/classes"> <filter excludes="*.R,*.R$$*,${emma.exclusion.pattern}" /> </instr> </emma> </target>
explanation of exception filter syntax is available in emma documentation
- either modify the modification, or use the proposed ant
emma.exclusion.pattern property to provide your own exceptions.
For me, it worked like a charm on SDK r13 tools.
jek
source share