title: Getting error while generating test cases for espresso android
body: <p>I am following these two links <a href="http://blog.wittchen.biz.pl/test-coverage-report-for-android-application/" rel="nofollow noreferrer">1</a> and <a href="https://stackoverflow.com/questions/29133761/jacoco-code-coverage-in-android-studio">2</a> for espresso test report but getting error while running <code>./gradlew createDebugCoverageReport</code>. The error will be shown in image given below. Please help me, I am not able to generated report for espresso and ui automation test cases. Now trying to use <code>jacoco</code> but not able to find any solution. <a href="https://i.stack.imgur.com/GPLmb.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/GPLmb.png" alt="image"></a></p>
  
  <p>Build.Gradle</p>
  
  <pre><code>apply plugin: 'com.android.application'
  android {
      compileSdkVersion 24
      buildToolsVersion '25.0.0'
      defaultConfig {
          applicationId "com.example.project"
          minSdkVersion 18
          targetSdkVersion 24
          versionCode 27
          versionName "1.5"
          testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
      }
      buildTypes {
          release {
              minifyEnabled false
              proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
              testCoverageEnabled true
          }
          debug{
              testCoverageEnabled true
          }
      }
  }
  dependencies {
      compile fileTree(dir: 'libs', include: ['*.jar'])
      androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
          exclude group: 'com.android.support', module: 'support-annotations'
      })
      compile 'com.github.barteksc:android-pdf-viewer:2.0.3'
      compile 'com.google.code.gson:gson:2.8.0'
      compile 'com.android.support:appcompat-v7:24.2.1'
      compile 'com.android.support:design:24.2.1'
      compile 'com.android.support:recyclerview-v7:24.2.1'
      compile 'com.android.support:cardview-v7:24.2.1'
      compile 'com.android.volley:volley:1.0.0'
      compile 'com.android.support:support-v4:24.2.1'
      compile 'com.google.firebase:firebase-messaging:10.0.1'
      compile 'com.google.firebase:firebase-core:10.0.1'
      compile 'com.google.firebase:firebase-crash:10.0.1'
      testCompile 'junit:junit:4.12'
      compile 'com.android.support:support-annotations:24.2.0'
      androidTestCompile 'com.android.support.test:runner:0.2'
      androidTestCompile 'com.android.support.test:rules:0.2'
      androidTestCompile 'com.android.support.test.uiautomator:uiautomator-v18:2.1.0'
      androidTestCompile 'com.android.support:support-annotations:24.2.1'
      androidTestCompile('com.android.support.test.espresso:espresso-contrib:2.2') {
          exclude group: 'com.android.support', module: 'appcompat'
          exclude group: 'com.android.support', module: 'support-v4'
          exclude group: 'com.android.support', module: 'support-v7'
          exclude group: 'com.android.support', module: 'design'
          exclude module: 'support-annotations'
          exclude module: 'recyclerview-v7'
  
  
  
      }
      androidTestCompile 'com.android.support.test.espresso:espresso-core:2.2.1'
      androidTestCompile "com.android.support.test.espresso:espresso-intents:2.2.2"
  }
  
  apply plugin: 'com.google.gms.google-services'
  apply plugin: 'jacoco'
  
  task jacocoTestReport(type: JacocoReport, dependsOn: ['testDebugUnitTest', 'createDebugCoverageReport']) {
  
      reports {
          xml.enabled = true
          html.enabled = true
      }
  
      def fileFilter = ['**/R.class', '**/R$*.class', '**/BuildConfig.*', '**/Manifest*.*', '**/*Test*.*', 'android/**/*.*']
      def debugTree = fileTree(dir: "${buildDir}/intermediates/classes/debug", excludes: fileFilter)
      def mainSrc = "${project.projectDir}/src/main/java"
  
      sourceDirectories = files([mainSrc])
      classDirectories = files([debugTree])
      executionData = fileTree(dir: "$buildDir", includes: [
              "jacoco/testDebugUnitTest.exec",
              "outputs/code-coverage/connected/*coverage.ec"
      ])
  }
  </code></pre>