plugins {
    id "com.android.application"
    id "kotlin-android"
}
apply plugin: "kotlin-android"

android {
    compileSdk 33

    defaultConfig {
        applicationId "com.example.android.testing.nativesample"
        minSdk 18
        targetSdk 33
        versionCode 1
        versionName "1.0"

        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
        externalNativeBuild {
            cmake {
                arguments "-DANDROID_STL=c++_shared"
            }
        }
    }
    externalNativeBuild {
        cmake {
            path "src/main/cpp/CMakeLists.txt"
        }
    }

    buildFeatures {
        prefab true
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro"
        }
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
    kotlinOptions {
        jvmTarget = "1.8"
    }
    testOptions {
        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
                    systemImageSource = "aosp-atd"
                }
            }
        }
    }
    namespace "com.example.android.testing.nativesample"
}

dependencies {
    androidTestImplementation "junit:junit:$rootProject.junitVersion"
    implementation "androidx.test.ext:junit-gtest:$rootProject.junitGtestVersion"
    implementation "com.android.ndk.thirdparty:googletest:$rootProject.googletestVersion"
    androidTestImplementation "androidx.test:runner:$rootProject.runnerVersion"
    androidTestImplementation "androidx.test.ext:junit-ktx:$extJUnitVersion"
}
