Unable to get Jacoco to work with Powermockito using offline instrumentation

This pom worked for me: <build> <finalName>final-name</finalName> <plugins> <plugin> <artifactId>maven-compiler-plugin</artifactId> <configuration> <source>1.8</source> <target>1.8</target> </configuration> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> <version>2.18.1</version> <configuration> <systemPropertyVariables> <jacoco-agent.destfile>target/jacoco.exec</jacoco-agent.destfile> </systemPropertyVariables> </configuration> </plugin> <plugin> <groupId>org.jacoco</groupId> <artifactId>jacoco-maven-plugin</artifactId> <version>0.7.2.201409121644</version> <executions> <execution> <id>default-instrument</id> <goals> <goal>instrument</goal> </goals> </execution> <execution> <id>default-restore-instrumented-classes</id> <goals> <goal>restore-instrumented-classes</goal> </goals> </execution> <execution> <id>default-report</id> <phase>prepare-package</phase> <goals> <goal>report</goal> </goals> </execution> </executions> </plugin> </plugins> </build> See this … Read more

Jacoco and Unit Tests Code Coverage with android-gradle-plugin >= 1.1

After the hassle, I decided to create an open source Gradle plugin for that. Root build.gradle buildscript { repositories { mavenCentral() // optional if you have this one already } dependencies { classpath ‘com.vanniktech:gradle-android-junit-jacoco-plugin:0.16.0’ } } apply plugin: ‘com.vanniktech.android.junit.jacoco’ Then simply execute ./gradlew jacocoTestReportDebug It’ll run the JUnit tests in Debug Mode and then give … Read more

Jacoco with Gradle 0.10.0: Remote object doesn’t exist

Try This One… buildscript { repositories { mavenCentral() } dependencies { classpath ‘com.android.tools.build:gradle:0.13.0’ } } repositories { mavenCentral() } apply plugin: ‘com.android.application’ apply plugin: ‘jacoco’ android { compileSdkVersion 21 buildToolsVersion “21.1.1” // Must Require defaultConfig { applicationId “com.packagename” <Change it> minSdkVersion 11 targetSdkVersion 21 versionCode 1 versionName “1.0” } packagingOptions { exclude ‘META-INF/DEPENDENCIES’ exclude ‘META-INF/LICENSE’ … Read more