title: How to filter files in the generated test coverage report by EMMA, using Ant in Android
body: <p>I have an Android project and I am correctly generating test coverage reports using Ant and EMMA (I did it by following the instructions here: <a href="https://wiki.jenkins-ci.org/display/JENKINS/Building+an+Android+app+and+test+project" rel="nofollow">https://wiki.jenkins-ci.org/display/JENKINS/Building+an+Android+app+and+test+project</a>)</p>
  
  <p>What I would like to know is <strong>how can I filter the files that appear in the report generated by EMMA</strong> (for example, the R generated classes, files in an already tested library...).</p>
  
  <p>I included both ${sdk.dir}/tools/ant/test_rules.xml and ${sdk.dir}/tools/ant/main_rules.xml in my own build.xml file and there I tried to change the "-emma-instrument" target to look like that:</p>
  
  <pre><code>&lt;target name="-emma-instrument" depends="compile"&gt;
      &lt;echo&gt;Instrumenting classes from ${out.absolute.dir}/classes...&lt;/echo&gt;
      &lt;!-- It only instruments class files, not any external libs --&gt;
      &lt;emma enabled="true"&gt;
          &lt;instr verbosity="${verbosity}"
                 mode="overwrite"
                 instrpath="${out.absolute.dir}/classes"
                 outdir="${out.absolute.dir}/classes"&gt;
  
                 &lt;filter excludes="*R*" /&gt;
          &lt;/instr&gt;
          &lt;!-- TODO: exclusion filters on R*.class and allowing custom exclusion from
               user defined file --&gt;
      &lt;/emma&gt;
  &lt;/target&gt;
  </code></pre>
  
  <p>I also tried to apply another variations of EMMA coverage filters specified here <a href="http://emma.sourceforge.net/reference_single/reference.html#instrset.filters" rel="nofollow">http://emma.sourceforge.net/reference_single/reference.html#instrset.filters</a>, but that does not work either, and the R generated files still appear in the coverage report.</p>
  
  <p>Anybody knows how to solve this?</p>