Skip to content
This repository was archived by the owner on Oct 3, 2024. It is now read-only.

Commit d5b707c

Browse files
authored
Fix JaCoCo error (#267)
2 parents d5db1da + 99490ca commit d5b707c

File tree

4 files changed

+15
-12
lines changed

4 files changed

+15
-12
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ android:
2121
- tools
2222

2323
before_script: echo y | ${ANDROID_HOME}tools/bin/sdkmanager --channel=3 "tools" "platform-tools" "platforms;android-27"
24-
script: ./gradlew build jacocoTestReport :easypermissions:test
24+
script: ./gradlew build jacocoTestReportRelease :easypermissions:test
2525

2626
after_failure:
2727
- cat app/build/reports/tests/testDebugUnitTest/index.html

build.gradle

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,13 @@ buildscript {
22
repositories {
33
jcenter()
44
google()
5+
mavenCentral()
56
}
67

78
dependencies {
89
classpath 'com.android.tools.build:gradle:3.2.1'
910
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.4'
10-
classpath 'com.dicedmelon.gradle:jacoco-android:0.1.3'
11+
classpath 'com.vanniktech:gradle-android-junit-jacoco-plugin:0.13.0'
1112
}
1213
}
1314

easypermissions/build.gradle

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
apply plugin: 'com.android.library'
2-
apply plugin: 'jacoco-android'
2+
apply plugin: "com.vanniktech.android.junit.jacoco"
33

44
android {
55
compileSdkVersion compileSdk
@@ -28,21 +28,20 @@ android {
2828
}
2929
}
3030

31+
junitJacoco {
32+
includeNoLocationClasses = true
33+
}
34+
3135
dependencies {
3236
api "com.android.support:appcompat-v7:$support_library_version"
3337
api "com.android.support:support-compat:$support_library_version"
3438
api "com.android.support:support-fragment:$support_library_version"
3539

3640
testImplementation 'junit:junit:4.12'
3741
testImplementation 'com.google.truth:truth:0.42'
38-
testImplementation 'org.robolectric:robolectric:3.8'
39-
testImplementation 'org.robolectric:shadows-supportv4:3.8'
40-
testImplementation 'org.mockito:mockito-core:2.18.0'
41-
}
42-
43-
// Needed in order to process Robolectric tests when running JaCoCo
44-
tasks.withType(Test) {
45-
jacoco.includeNoLocationClasses = true
42+
testImplementation 'org.robolectric:robolectric:4.1'
43+
testImplementation 'org.robolectric:shadows-supportv4:4.1'
44+
testImplementation 'org.mockito:mockito-core:2.23.4'
4645
}
4746

4847
apply from: 'bintray.gradle'

gradle.properties

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,7 @@ org.gradle.jvmargs=-Xmx1536m
1919
# org.gradle.parallel=true
2020

2121
# Configure on demand
22-
org.gradle.configureondemand=true
22+
org.gradle.configureondemand=true
23+
24+
# Required by Robolectric 4.x
25+
android.enableUnitTestBinaryResources=true

0 commit comments

Comments
 (0)