apply plugin: 'com.android.application'
apply plugin: 'com.didi.virtualapk.plugin'

android {
    compileSdkVersion ANDROID_COMPILE_SDK_VERSION as int

    defaultConfig {
        applicationId "com.kfzs.cfyl.media"
        minSdkVersion ANDROID_MIN_SDK_VERSION as int
        targetSdkVersion ANDORID_TARGET_SDK_VERSION as int
        versionCode 1
        versionName "1.0"

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

        ndk {
            abiFilters "armeabi-v7a"
//            abiFilters 'x86'
//            abiFilters "armeabi-v7a"//, 'x86'//, 'armeabi-v7a', 'x86_64', 'arm64-v8a'
        }
    }

    signingConfigs {
        config {
            keyAlias 'sheep'
            keyPassword 'zhaoyi2004'
            storeFile file('.././../sign.jks')
            storePassword 'zhaoyi2004'
            v1SigningEnabled true
            v2SigningEnabled false
        }

    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            signingConfig signingConfigs.config
        }
        debug {
            signingConfig signingConfigs.config
        }
    }
//    splits {
//        abi {
//            enable true
//            reset()
//            include 'x86', 'armeabi-v7a'//, 'arm64-v8a'
////            include 'mips', 'arm64-v8a', 'x86', 'x86_64', 'armeabi', 'armeabi-v7a'
//            universalApk false
//        }
//    }

}

configurations.all {
    resolutionStrategy.eachDependency { DependencyResolveDetails details ->
        def requested = details.requested
        if (requested.group == 'com.android.support') {
            if (!requested.name.startsWith("multidex")) {
                details.useVersion "$supportLibVersion"
            }
        }
    }
}
dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])

    implementation "com.android.support:appcompat-v7:$supportLibVersion"
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
    //显示图片视频帧，在插件中不兼容x86模拟器，所以x86不考虑
//    implementation 'com.github.wseemann:FFmpegMediaMetadataRetriever:1.0.14'
    implementation project(':share_library')
    implementation("com.android.support:recyclerview-v7:$supportLibVersion")
    implementation 'com.android.support.constraint:constraint-layout:1.1.3'
    implementation 'com.github.ybq:Android-SpinKit:1.1.0'
    //All arch: armeabi, armeabi-v7a, arm64-v8a, mips, x86
    implementation 'org.wysaid:gpuimage-plus:2.5.1'
    //Pure graphics lib without ffmpeg. (all arch for branch 'min')
//    implementation 'org.wysaid:gpuimage-plus:2.5.1-min'
    implementation('com.github.bumptech.glide:glide:4.1.1') {
        exclude group: 'com.android.support', module: 'support-fragment'
//        exclude group: 'com.github.bumptech.glide', module: 'gifdecoder'
//        exclude group: 'com.github.bumptech.glide', module: 'disklrucache'
//        exclude group: 'com.github.bumptech.glide', module: 'annotations'
    }
    annotationProcessor 'com.github.bumptech.glide:compiler:4.1.1'
    implementation 'com.github.CymChad:BaseRecyclerViewAdapterHelper:2.9.34'
    //fast json
    implementation 'com.alibaba:fastjson:1.2.52'
}


virtualApk {
    packageId = 0x6f             // The package id of Resources.
    targetHost='../app' // The path of application module in host project.
    applyHostMapping = true      // [Optional] Default value is true.
    forceUseHostDependences = true
}
//static def releaseTime() {
//    return new Date().format("MMddHHmm", TimeZone.getDefault())
//}
//在apk文件后边生成版本号信息
android.applicationVariants.all {
    variant ->
        variant.outputs.all {
            output ->
//                if (buildType.name == "release") {
                outputFileName = "media_release.apk"
//                outputFileName = "media_release_${output.getFilter(com.android.build.OutputFile.ABI)}.apk"
//                outputFileName = "media_v${versionCode}-${releaseTime()}_${output.getFilter(com.android.build.OutputFile.ABI)}.apk"
//                }

        }
}