apply plugin: "com.android.application"

apply plugin: "kotlin-android"

android {
    compileSdk 34
    defaultConfig {
        applicationId "com.example.android.testing.espresso.EspressoDeviceSample"
        minSdkVersion 21
        targetSdkVersion 34
        versionCode 1
        versionName "1.0"

        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }
    productFlavors {
    }
    testOptions {

        emulatorControl {
            enable = true
        }
        unitTests {
            includeAndroidResources = true
        }
        managedDevices {
            devices {
                // run with ./gradlew  nexusOneApi30DebugAndroidTest
                nexusOneApi30(com.android.build.api.dsl.ManagedVirtualDevice) {
                    // A lower resolution device is used here for better emulator performance
                    device = "Nexus One"
                    apiLevel = 30
                    // Also use the AOSP ATD image for better emulator performance
                    // The androidx.test screenshot APIs will automatically enable hardware rendering
                    // to take a screenshot
                    systemImageSource = "aosp-atd"
                }
            }
        }
    }
    namespace "com.example.android.testing.espresso.EspressoDeviceSample"
    testNamespace "com.example.android.testing.espresso.EspressoDeviceSample.test"
    lint {
        abortOnError false
    }
}

tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all {
    kotlinOptions {
        jvmTarget = "1.8"
    }
}

dependencies {
    androidTestImplementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlinVersion"
    androidTestImplementation "androidx.test.ext:junit:" + rootProject.extJUnitVersion
    androidTestImplementation "androidx.test.ext:junit-ktx:" + rootProject.extJUnitVersion
    androidTestImplementation "androidx.test.espresso:espresso-device:" + rootProject.espressoDeviceVersion

    testImplementation "androidx.test.ext:junit:" + rootProject.extJUnitVersion
    testImplementation "junit:junit:4.12"
    testImplementation "org.robolectric:robolectric:" + rootProject.robolectricVersion
}
