build.gradle 2.4 KB
plugins {
    id 'com.android.library'
    id 'kotlin-android'
}

def getDefaultUrl() {
    return hasProperty('livekitSampleUrl') ? livekitSampleUrl : "ws://www.example.com"
}

def getDefaultToken() {
    return hasProperty('livekitSampleToken') ? livekitSampleToken : ""
}

final url = getDefaultUrl()
final token = getDefaultToken()

android {
    namespace "io.livekit.android.sample.common"
    compileSdk androidSdk.compileVersion

    defaultConfig {
        minSdk androidSdk.minVersion
        targetSdk androidSdk.targetVersion
        consumerProguardFiles 'consumer-rules.pro'

        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'

            buildConfigField "String", "DEFAULT_URL", "\"$url\""
            buildConfigField "String", "DEFAULT_TOKEN", "\"$token\""
        }

        debug {
            buildConfigField "String", "DEFAULT_URL", "\"$url\""
            buildConfigField "String", "DEFAULT_TOKEN", "\"$token\""
        }
    }
    buildFeatures {
        buildConfig = true
    }
    compileOptions {
        sourceCompatibility java_version
        targetCompatibility java_version
    }
    kotlinOptions {
        jvmTarget = java_version
    }
}

dependencies {

    // If building the sample app outside the context of this repo, replace the following with:
    // api "io.livekit:livekit-android:<version>"
    api project(":livekit-android-sdk")

    api "androidx.core:core-ktx:${libs.versions.androidx.core.get()}"
    api 'androidx.appcompat:appcompat:1.4.0'
    api 'com.google.android.material:material:1.4.0'
    api libs.coroutines.lib
    api libs.timber
    api "androidx.lifecycle:lifecycle-runtime-ktx:${libs.versions.androidx.lifecycle.get()}"
    api "androidx.lifecycle:lifecycle-viewmodel-ktx:${libs.versions.androidx.lifecycle.get()}"
    api "androidx.lifecycle:lifecycle-common-java8:${libs.versions.androidx.lifecycle.get()}"
    api libs.protobuf.javalite
    api 'androidx.preference:preference-ktx:1.1.1'
    // debugImplementation because LeakCanary should only run in debug builds.
    debugImplementation 'com.squareup.leakcanary:leakcanary-android:2.8.1'
    testImplementation 'junit:junit:4.+'
    androidTestImplementation 'androidx.test.ext:junit:1.1.3'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
}