apply plugin: 'com.android.application'
apply plugin: 'com.jakewharton.butterknife'
apply plugin: 'org.greenrobot.greendao'
apply plugin: 'com.didi.virtualapk.host'
//apply plugin: 'realm-android'//Realm数据库
android {
    compileSdkVersion ANDROID_COMPILE_SDK_VERSION as int
    buildToolsVersion ANDROID_BUILD_TOOLS_VERSION
    defaultConfig {
        applicationId "com.sheep.jiuyan.samllsheep"
        minSdkVersion ANDROID_MIN_SDK_VERSION as int
        targetSdkVersion ANDORID_TARGET_SDK_VERSION as int
        versionCode VERSION_CODE as int
        versionName VERSION_NAME
        multiDexEnabled true
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        ndk {
            abiFilters "armeabi-v7a"//, 'x86'//, 'armeabi-v7a', 'x86_64', 'arm64-v8a'
        }
//        jackOptions {
//            enabled true
//        }
        multiDexEnabled true
        flavorDimensions "versionCode"
    }
    greendao {
        schemaVersion 15
        targetGenDir 'src/main/java'
    }
    signingConfigs {
        config {
            keyAlias 'sheep'
            keyPassword 'zhaoyi2004'
            storeFile file('.././sign.jks')
            storePassword 'zhaoyi2004'
            v1SigningEnabled true
            v2SigningEnabled false
        }

    }

    lintOptions {
        abortOnError false
        disable 'MissingTranslation'
    }

    dexOptions {
        preDexLibraries = false
        javaMaxHeapSize "4g"
    }
    packagingOptions {

        exclude 'META-INF/services/com.fasterxml.jackson.core.JsonFactory'
    }
    buildTypes {
        release {
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            signingConfig signingConfigs.config
        }
        debug {
            signingConfig signingConfigs.config
        }
    }
    productFlavors.all { flavor ->
        flavor.manifestPlaceholders = [DUANDUAN_GRAPH    : "${flavor.name}",
                                       DUANDUAN_DATASHARE: "${flavor.name}",
        ]
    }
    productFlavors {
        developSheeptest {
            applicationId "com.sheep.jiuyan.samllsheep"
            manifestPlaceholders = [DUANDUAN_GRAPH    : "sheeptest",
                                    DUANDUAN_DATASHARE: "sheeptest",
                                    jpush_appkey      : "627ffad0b1cdf701d15e027a",
                                    umeng_app_key     : "5ab0a1da8f4a9d742900035f"
            ]
            buildConfigField "String", "DUANDUAN_DATASHARE", '"sheeptest"'
            buildConfigField "String", "DUANDUAN_GRAPH", '"sheeptest"'
            resValue "string", "app_name", "小绵羊测试"
            buildConfigField "boolean", "XXTEA_ENCRYPT", 'true'
            signingConfig signingConfigs.config
        }
        sheeptestjiguang {
            applicationId "com.sheep.jiuyan.samllsheep.test"
            manifestPlaceholders = [DUANDUAN_GRAPH    : "sheeptestjiguang",
                                    DUANDUAN_DATASHARE: "sheeptestjiguang",
                                    jpush_appkey      : "627ffad0b1cdf701d15e027a",
                                    umeng_app_key     : "5ab0a1da8f4a9d742900035f"
            ]
            buildConfigField "String", "DUANDUAN_DATASHARE", '"sheeptestjiguang"'
            buildConfigField "String", "DUANDUAN_GRAPH", '"sheeptestjiguang"'
            resValue "string", "app_name", "小绵羊极光测试"
            buildConfigField "boolean", "XXTEA_ENCRYPT", 'true'
            signingConfig signingConfigs.config
        }
        sheep {
            applicationId "com.sheep.jiuyan.samllsheep"
            manifestPlaceholders = [DUANDUAN_GRAPH    : "sheep",
                                    DUANDUAN_DATASHARE: "sheep",
                                    jpush_appkey      : "28b74d520261c6f78e3e0921",
                                    umeng_app_key     : "5ab0a1da8f4a9d742900035f"
            ]
            buildConfigField "String", "DUANDUAN_DATASHARE", '"sheep"'
            buildConfigField "String", "DUANDUAN_GRAPH", '"sheep"'
            resValue "string", "app_name", "小绵羊"
            buildConfigField "boolean", "XXTEA_ENCRYPT", 'true'
            signingConfig signingConfigs.config

        }
    }
    sourceSets {
        main() {
            jniLibs.srcDirs = ['src/main/libs']
            jni.srcDirs = [] //屏蔽掉默认的jni编译生成过程
        }
    }

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
}

repositories {
    flatDir {
        dirs 'libs'
    }
    google()
}
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 'com.android.support:support-v4:28.+'
    debugImplementation 'com.squareup.leakcanary:leakcanary-android:1.6.2'
    releaseImplementation 'com.squareup.leakcanary:leakcanary-android-no-op:1.6.2'

    // Optional, if you use support library fragments:
    debugImplementation 'com.squareup.leakcanary:leakcanary-support-fragment:1.6.2'

    //noinspection GradleCompatible
    implementation "com.android.support:cardview-v7:$supportLibVersion"
    implementation("com.android.support:design:$supportLibVersion") {
        exclude group: 'com.android.support', module: 'support-annotations'
        exclude group: 'com.android.support', module: 'support-compat'
        exclude group: 'com.android.support', module: 'support-core-ui'
        exclude group: 'com.android.support', module: 'support-core-utils'
        exclude group: 'com.android.support', module: 'support-fragment'
        exclude group: 'com.android.support', module: 'transition'
        exclude group: 'com.android.support', module: 'appcompat-v7'
        exclude group: 'com.android.support', module: 'cardview-v7'
        exclude group: 'com.android.support', module: 'recyclerview-v7'
    }
    implementation 'com.android.support.constraint:constraint-layout:1.1.3'
    testImplementation 'junit:junit:4.12'

    //    implementation 'com.google.code.gson:gson:2.8.2'

    //    implementation 'com.shark:screencapture:1.0.0'
    implementation('com.jcodecraeer:xrecyclerview:1.5.9') {
        exclude group: 'com.android.support', module: 'design'
        exclude group: 'com.android.support', module: 'recyclerview'
        exclude group: 'com.android.support', module: 'appcompat'
    }
    implementation 'com.squareup.okhttp3:okhttp:3.11.0'
    implementation 'org.greenrobot:eventbus:3.1.1'

    //    implementation 'com.zhy:base-adapter:3.0.3'

    //    implementation 'com.liulishuo.filedownloader:library:1.6.9'
    implementation 'com.tencent.bugly:crashreport_upgrade:1.3.5'

    //其中latest.release指代最新版本号，也可以指定明确的版本号，例如1.2.0
    implementation 'com.tencent.bugly:nativecrashreport:3.3.1'

    //其中latest.release指代最
    implementation 'com.tencent.mm.opensdk:wechat-sdk-android-with-mta:5.1.6'
    debugImplementation('com.readystatesoftware.chuck:library:1.1.0') {
        exclude group: 'com.android.support', module: 'design'
        exclude group: 'com.google.code.gson', module: 'gson'
        exclude group: 'com.squareup.okhttp3', module: 'okhttp'
        exclude group: 'nl.qbusict', module: 'cupboard'
    }

    //    implementation 'de.hdodenhof:circleimageview:2.2.0'
    releaseImplementation('com.readystatesoftware.chuck:library-no-op:1.1.0') {
        exclude group: 'com.android.support', module: 'design'
        exclude group: 'com.squareup.okhttp3', module: 'okhttp'
    }
    implementation 'org.xutils:xutils:3.5.0'

    //    implementation 'com.mylhyl:acp:1.1.7'
    implementation('cn.yipianfengye.android:zxing-library:2.2') {
        exclude group: 'com.android.support', module: 'appcompat-v7'
        exclude group: 'com.android.support', module: 'support-v4'
    }

    //    implementation 'com.github.huburt-Hu:NewbieGuide:v1.2.0'
    debugImplementation 'com.android.support:multidex:1.0.1'

    //不要修改这里，相信我
    releaseImplementation 'com.android.support:multidex:1.0.3'
    implementation(name: 'com.kfzs.safe-201809211354', ext: 'aar')

    //butterknife
    implementation('com.jakewharton:butterknife:8.8.1') {
        exclude group: 'com.android.support', module: 'support-annotations'
        exclude group: 'com.android.support', module: 'support-compat'
//        exclude group: 'com.jakewharton', module: 'butterknife-annotations'
    }
    annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'

    //dagger2

    //    implementation 'com.google.dagger:dagger:+'

    //    implementation 'com.google.dagger:dagger-compiler:+'
    compileOnly 'org.glassfish:javax.annotation:10.0-b28'

    //javax.annotation', module: 'jsr250-api
    implementation 'com.google.dagger:dagger:2.12'

    //javax.inject', module: 'javax.inject
    annotationProcessor 'com.google.dagger:dagger-compiler:2.12'

    //retrofit
    implementation('com.squareup.retrofit2:retrofit:2.4.0') {
        exclude group: 'com.google.android', module: 'android'
        exclude group: 'com.squareup.okhttp3', module: 'okhttp'
        exclude group: 'org.codehaus.mojo', module: 'animal-sniffer-annotations'
    }

    //    implementation 'com.squareup.retrofit2:converter-gson:2.4.0'
    implementation('org.ligboy.retrofit2:converter-fastjson-android:2.1.0') {
        exclude group: 'com.alibaba', module: 'fastjson'
        exclude group: 'com.squareup.retrofit2', module: 'retrofit'
    }

    //    implementation 'com.squareup.okhttp3:logging-interceptor:3.10.0'

    //    implementation 'com.squareup.retrofit2:adapter-rxjava2:+'

    //    implementation ('com.squareup.retrofit2:adapter-rxjava:2.1.0') {

    //        exclude group: 'com.squareup.retrofit2', module: 'retrofit'

    //    }
    implementation('com.squareup.retrofit2:adapter-rxjava2:2.5.0') {
        exclude group: 'com.squareup.retrofit2', module: 'retrofit'
        exclude group: 'io.reactivex.rxjava2', module: 'rxjava'
    }

    //rxjava
    implementation('io.reactivex.rxjava2:rxandroid:2.1.0') {
        exclude group: 'io.reactivex.rxjava2', module: 'rxjava'
    }
    implementation 'io.reactivex.rxjava2:rxjava:2.2.3'

    //获取动态权限三方库
    implementation('pub.devrel:easypermissions:1.2.0') {
        exclude group: 'com.android.support', module: 'appcompat-v7'
        exclude group: 'com.android.support', module: 'support-compat'
        exclude group: 'com.android.support', module: 'support-fragment'
    }

    //    implementation 'net.danlew:android.joda:2.9.3'

    //    implementation 'com.orhanobut:logger:1.15'

    //友盟
    implementation 'com.umeng.sdk:common:1.5.3'

    //implementation 'com.umeng.sdk:analytics:latest.integration'

    //添加半袋米相关
    implementation(name: 'appstoreutils-201810101432', ext: 'aar')
    implementation project(':view')

    //    implementation(name: 'view-release', ext: 'aar')

    //    implementation 'com.flipboard:bottomsheet-core:1.5.3'

    //    implementation 'com.flipboard:bottomsheet-commons:1.5.3'
    implementation files('libs/open_sdk_r5923_lite.jar')

    //    implementation files('libs/wechat-sdk-android-with-mta-1.1.6.jar')
    implementation files('libs/umeng_social_tool.jar')
    implementation files('libs/umeng_social_shareboard.jar')
    implementation files('libs/umeng_social_net.jar')
    implementation files('libs/umeng_social_api.jar')
    implementation files('libs/umeng_shareboard_widget.jar')
    implementation files('libs/SocialSDK_WeiXin_Full.jar')
    implementation files('libs/SocialSDK_QQ_Full.jar')
    implementation('com.zhy:okhttputils:2.6.2') {
        exclude group: 'com.squareup.okhttp3', module: 'okhttp'
    }

    //    implementation 'com.kf.framework:kf-utils:latest.integration@aar'

    //    implementation 'com.kf.framework:kf-utils:1.4.5@aar'

    //    implementation 'com.kf.framework:volleyplus:latest.integration@aar'

    //    implementation 'com.kf.framework:volleyplus:1.4.5@aar'
    implementation "com.android.support:support-annotations:$supportLibVersion"
    implementation("com.android.support:recyclerview-v7:$supportLibVersion") {
        exclude group: 'com.android.support', module: 'support-annotations'
        exclude group: 'com.android.support', module: 'support-compat'
        exclude group: 'com.android.support', module: 'support-core-ui'
    }

    //    implementation project(':datashare')

    //    implementation files('libs/jackson-core-2.2.1.jar')

    //    implementation files('libs/jackson-dataformat-xml-2.1.2.jar')

    //    implementation 'io.reactivex:rxandroid:1.2.1'
    implementation('com.github.ithedan:TextViewDrawable:v1.0') {
        exclude group: 'com.android.support', module: 'appcompat-v7'
    }

    //    implementation 'com.github.zhangkexpz:LayoutScroll:v1.0'

    //    implementation 'me.iwf.photopicker:PhotoPicker:0.9.12@aar'
    implementation(name: 'PhotoPicker-release-201810081154', ext: 'aar')
    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.yalantis:ucrop:2.2.1-native'

    //    implementation 'com.google.zxing:core:3.3.0'
    implementation project(':ucrop')
    implementation('com.sunfusheng:marqueeview:1.3.3') {
        exclude group: 'com.android.support', module: 'appcompat-v7'
    }
    implementation files('libs/alipaySdk-20170922.jar')

    //极光
    implementation files('libs/jcore-android-1.2.0.jar')
    implementation files('libs/jpush-android-3.1.2.jar')

    //定位
    implementation files('libs/BaiduLBS_Android.jar')

    //幂动科技
    implementation files('libs/mdsdk_1123_1.2.1.12.jar')

    //轮播图
    implementation 'com.youth.banner:banner:1.4.10'

    //最新版本

    //loading
    implementation 'com.github.ybq:Android-SpinKit:1.1.0'

    //    implementation 'com.github.nanchen2251:CompressHelper:1.0.5'

    //    implementation(name: 'compresshelper-release', ext: 'aar')
    implementation files('libs/compresshelper-release.jar')
    implementation('com.haibin:calendarview:3.4.8') {
        exclude group: 'com.android.support', module: 'appcompat-v7'
        exclude group: 'com.android.support', module: 'recyclerview-v7'
    }
    implementation 'com.scwang.smartrefresh:SmartRefreshLayout:1.1.0-alpha-14'
    implementation 'org.greenrobot:greendao:3.2.2'

    //org.greenrobot', module: 'greendao-api

    //okDownload

    // core
    implementation 'com.liulishuo.okdownload:okdownload:1.0.5'

    // provide sqlite to store breakpoints
    implementation 'com.liulishuo.okdownload:sqlite:1.0.5'

    // provide okhttp to connect to backend
    implementation 'com.liulishuo.okdownload:okhttp:1.0.5'
    implementation('com.trello.rxlifecycle2:rxlifecycle-components:2.2.2') {
        exclude group: 'com.android.support', module: 'appcompat-v7'
//        com.trello.rxlifecycle2', module: 'rxlifecycle-android
        exclude group: 'io.reactivex.rxjava2', module: 'rxjava'
    }

    //

    //    implementation 'com.squareup.retrofit2:adapter-rxjava2:2.4.0'

    //有米科技
    implementation(name: 'YoumiSdk_v8.3.0_2018-09-20', ext: 'aar')
    implementation project(':WaterWaveProgress')

    //AndroidVideoCache 网络视频缓存 https://github.com/danikula/AndroidVideoCache
    implementation 'com.danikula:videocache:2.7.1'

    //视频图片选择
//    implementation ('cn.finalteam.rxgalleryfinal:library:1.1.3') {
//        exclude group: 'com.android.support', module: 'appcompat-v7'
//        exclude group: 'io.reactivex.rxjava2', module: 'rxandroid'
//        exclude group: 'io.reactivex.rxjava2', module: 'rxjava'
//        exclude group: 'com.yalantis', module: 'ucrop'
//        exclude group: 'com.android.support', module: 'recyclerview-v7'
//    }
//    implementation "com.android.support:exifinterface:$supportLibVersion"
//    implementation project(':RxGalleryFinal')
    implementation "com.android.support:exifinterface:$supportLibVersion"
    implementation('com.qiniu:qiniu-android-sdk:7.3.13') {
        exclude group: 'com.squareup.okhttp3', module: 'okhttp'
    }
    implementation project(':media_share_lib')
    implementation 'com.didi.virtualapk:core:0.9.8'
    //fast json
    implementation 'com.alibaba:fastjson:1.2.52'
    implementation 'com.github.CymChad:BaseRecyclerViewAdapterHelper:2.9.34'
//    implementation 'com.github.yangjie10930:EpMedia:v0.9.5'
    implementation project(':joevideolib')
}

static def releaseTime() {
    return new Date().format("MMddHHmm", TimeZone.getDefault())
}

//在apk文件后边生成版本号信息
android.applicationVariants.all {
    variant ->
        variant.outputs.all {
            output ->
//                if (buildType.name == "release") {
                outputFileName = "${productFlavors[0].name}_${buildType.name}_v${versionName}_${versionCode}-${releaseTime()}.apk"
//                }

        }
}
