apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'

android {
    compileSdkVersion 30
    buildToolsVersion '29.0.3'
    defaultConfig {
        minSdkVersion 21
        targetSdkVersion 30
        versionCode 224010
        versionName "2.24.1"

        //64K 引用限制
        multiDexEnabled true

        //依赖的包可能支持很多类型的ABI
        //为了避免打包了我们没有支持的ABI，指定需要打包的ABI目录
        ndk {
            abiFilters 'arm64-v8a', 'armeabi-v7a', 'armeabi', 'x86_64', 'x86'
        }

        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }

    buildTypes {
        debug{
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
        release {
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }

    repositories {
        flatDir {
            dirs 'libs'
        }
    }

    lintOptions {
        abortOnError false
    }

    //修改输出apk的名称
    applicationVariants.all { variant ->
        if (variant.buildType.name.equals('release')) {
            variant.outputs.all { output ->
                outputFileName = "polyv-${versionName}-${releaseTime()}.apk";
            }
        }
    }

    compileOptions {
        sourceCompatibility 1.8
        targetCompatibility 1.8
    }
}

static def releaseTime() {
    return new Date().format("yyyy-MM-dd", TimeZone.getTimeZone("UTC"))
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    testImplementation 'junit:junit:4.12'
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })

    implementation 'com.android.support:support-annotations:27.1.1'
    implementation 'com.android.support:appcompat-v7:27.1.1'
    implementation 'com.android.support:design:27.1.1'
    implementation 'com.android.support:multidex:1.0.3'
    implementation 'com.android.support.constraint:constraint-layout:1.1.3'

    implementation 'net.polyv.android:polyvPlayer:2.24.1'//SDK核心包
    implementation 'net.polyv.android:polyvDownload:2.24.1'//SDK下载功能
    implementation 'net.polyv.android:polyvUpload:2.24.1'//SDK上传功能
    implementation 'net.polyv.android:polyvSub:2.24.1'//弹幕、截图功能中使用

    implementation 'de.hdodenhof:circleimageview:2.2.0'//圆形imageview，音频封面图使用
    implementation 'com.github.bumptech.glide:glide:4.7.1'//demo中的ppt图片加载使用
//    implementation 'com.nostra13.universalimageloader:universal-image-loader:1.9.5'//demo中图片使用
    implementation "com.daimajia.swipelayout:library:1.2.0@aar"//demo中下载列表使用

    // 投屏sdk
    implementation files("libs/wx-commonlib-1.0.1.aar")
    implementation files("libs/wx-dlnasdk-1.1.5.aar")
    implementation files("libs/wx-dlnasender-1.1.5.aar")
    implementation files("libs/wx-jettylib-1.0.1.aar")
}
