SimpleMarkdown/app/build.gradle
William Brawner 67bf1626a0 Run UI tests on API 29
For some reason running the tests on API 30 fails with the below exception. Interestingly enough the tests run just fine on my local API 30 emulator.

java.lang.RuntimeException: Exception thrown in onCreate() of ComponentInfo{com.wbrawner.simplemarkdown.test/androidx.test.runner.AndroidJUnitRunner}: java.lang.IllegalStateException: Cannot connect to androidx.test.orchestrator.OrchestratorService
     FATAL EXCEPTION: main
Process: com.wbrawner.simplemarkdown, PID: 21960
java.lang.RuntimeException: Exception thrown in onCreate() of ComponentInfo{com.wbrawner.simplemarkdown.test/androidx.test.runner.AndroidJUnitRunner}: java.lang.IllegalStateException: Cannot connect to androidx.test.orchestrator.OrchestratorService
	at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6709)
	at android.app.ActivityThread.access$1300(ActivityThread.java:237)
	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1913)
	at android.os.Handler.dispatchMessage(Handler.java:106)
	at android.os.Looper.loop(Looper.java:223)
	at android.app.ActivityThread.main(ActivityThread.java:7656)
	at java.lang.reflect.Method.invoke(Native Method)
	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)
Caused by: java.lang.IllegalStateException: Cannot connect to androidx.test.orchestrator.OrchestratorService
	at androidx.test.internal.events.client.TestEventServiceConnectionBase.connect(TestEventServiceConnectionBase.java:91)
	at androidx.test.internal.events.client.TestEventClient.connect(TestEventClient.java:125)
	at androidx.test.runner.AndroidJUnitRunner.isOrchestratorServiceProvided(AndroidJUnitRunner.java:347)
	at androidx.test.runner.AndroidJUnitRunner.onCreate(AndroidJUnitRunner.java:319)
	at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6704)
	... 8 more
2021-02-20 22:01:43 -07:00

179 lines
6.6 KiB
Groovy

apply plugin: 'com.android.application'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-kapt'
apply plugin: 'jacoco'
apply plugin: 'com.google.firebase.crashlytics'
apply plugin: "com.osacky.fladle"
def keystoreProperties = new Properties()
try {
def keystorePropertiesFile = rootProject.file("keystore.properties")
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
} catch (FileNotFoundException ignored) {
logger.warn("Unable to load keystore properties. Automatic signing won't be available")
keystoreProperties['keyAlias'] = ""
keystoreProperties['keyPassword'] = ""
keystoreProperties['storeFile'] = File.createTempFile("temp", ".tmp").absolutePath
keystoreProperties['storePassword'] = ""
}
android {
configurations.all {
resolutionStrategy.force 'com.google.code.findbugs:jsr305:3.0.1'
}
packagingOptions {
exclude 'META-INF/LICENSE-LGPL-2.1.txt'
exclude 'META-INF/LICENSE-LGPL-3.txt'
exclude 'META-INF/LICENSE-W3C-TEST'
exclude 'META-INF/LICENSE'
exclude 'META-INF/DEPENDENCIES'
}
compileSdkVersion 30
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = "1.8"
}
defaultConfig {
applicationId "com.wbrawner.simplemarkdown"
minSdkVersion 23
targetSdkVersion 30
versionCode 32
versionName "0.8.10"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
buildConfigField "boolean", "ENABLE_CUSTOM_CSS", "false"
}
signingConfigs {
release {
keyAlias keystoreProperties['keyAlias']
keyPassword keystoreProperties['keyPassword']
storeFile file(keystoreProperties['storeFile'])
storePassword keystoreProperties['storePassword']
}
}
buildTypes {
debug {
testCoverageEnabled true
}
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.release
buildConfigField "boolean", "ENABLE_CUSTOM_CSS", "false"
}
}
flavorDimensions "platform"
productFlavors {
free {
applicationIdSuffix ".free"
versionNameSuffix "-free"
}
play {}
samsung {
applicationId "com.wbrawner.simplemarkdown.samsung"
}
}
dexOptions {
jumboMode true
}
testOptions {
unitTests {
includeAndroidResources = true
}
execution 'ANDROIDX_TEST_ORCHESTRATOR'
}
}
dependencies {
samsungImplementation project(":IAP5Helper")
def navigation_version = '2.3.3'
implementation "androidx.navigation:navigation-fragment-ktx:$navigation_version"
implementation "androidx.navigation:navigation-ui-ktx:$navigation_version"
testImplementation 'junit:junit:4.12'
testImplementation 'org.robolectric:robolectric:4.2.1'
implementation fileTree(include: ['*.jar'], dir: 'libs')
def espresso_version = '3.3.0'
androidTestImplementation "androidx.test.espresso:espresso-core:$espresso_version"
androidTestImplementation "androidx.test.espresso:espresso-web:$espresso_version"
androidTestImplementation "androidx.test.espresso:espresso-intents:$espresso_version"
def android_test = '1.4.0-alpha04'
androidTestImplementation "androidx.test:runner:$android_test"
androidTestImplementation "androidx.test:rules:$android_test"
androidTestUtil "androidx.test:orchestrator:$android_test"
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.uiautomator:uiautomator:2.2.0'
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'androidx.preference:preference-ktx:1.1.1'
implementation "androidx.fragment:fragment-ktx:1.3.0"
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
implementation 'com.google.android.material:material:1.3.0'
implementation 'androidx.legacy:legacy-support-v13:1.0.0'
implementation 'com.commonsware.cwac:anddown:0.3.0'
playImplementation 'com.android.billingclient:billing:3.0.2'
playImplementation 'com.google.android.play:core-ktx:1.8.1'
playImplementation 'com.google.firebase:firebase-crashlytics:17.3.1'
playImplementation 'com.google.firebase:firebase-analytics:18.0.2'
implementation "androidx.core:core-ktx:1.3.2"
implementation 'androidx.browser:browser:1.3.0'
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
def coroutines_version = "1.3.7"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutines_version"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$coroutines_version"
def lifecycle_version = "2.2.0"
implementation "androidx.lifecycle:lifecycle-extensions:$lifecycle_version"
kapt "androidx.lifecycle:lifecycle-common-java8:$lifecycle_version"
implementation 'eu.crydee:syllable-counter:4.0.2'
}
android.productFlavors.each { flavor ->
if (getGradle().getStartParameter().getTaskRequests().toString().toLowerCase().contains(flavor.name)
&& flavor.name == 'play') {
apply plugin: 'com.google.gms.google-services'
}
}
repositories {
mavenCentral()
}
jacoco {
toolVersion = '0.8.0'
}
tasks.withType(Test) {
jacoco.includeNoLocationClasses = true
}
task jacocoTestReport(type: JacocoReport, dependsOn: ['testDebugUnitTest']) {
reports {
xml.enabled = true
html.enabled = true
}
def fileFilter = [ '**/R.class', '**/R$*.class', '**/BuildConfig.*', '**/Manifest*.*', '**/*Test*.*', 'android/**/*.*' ]
def javaDebugTree = fileTree(dir: "$project.buildDir/intermediates/javac/debug/compileDebugJavaWithJavac/classes", excludes: fileFilter)
def kotlinDebugTree = fileTree(dir: "$project.buildDir/tmp/kotlin-classes/debug", excludes: fileFilter)
def mainSrc = "$project.projectDir/src/main/java"
sourceDirectories.setFrom(files([mainSrc]))
classDirectories.setFrom(files([javaDebugTree, kotlinDebugTree]))
executionData.setFrom(fileTree(dir: project.buildDir, includes: [
'jacoco/testDebugUnitTest.exec',
'outputs/code-coverage/connected/*coverage.ec'
]))
}
fladle {
variant = 'playDebug'
useOrchestrator = true
environmentVariables = [
"clearPackageData": "true"
]
testTimeout = "7m"
devices = [
[ "model": "NexusLowRes", "version": "29" ]
]
projectId = 'simplemarkdown'
}