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

android {
    compileSdkVersion rootProject.ext.android["compileSdkVersion"]
    buildToolsVersion rootProject.ext.android["buildToolsVersion"]
    useLibrary 'org.apache.http.legacy'

    compileOptions {
        targetCompatibility JavaVersion.VERSION_1_8
        sourceCompatibility JavaVersion.VERSION_1_8
    }

    defaultConfig {
        multiDexEnabled true
        applicationId "me.hegj.wandroid"
        minSdkVersion rootProject.ext.android["minSdkVersion"]
        targetSdkVersion rootProject.ext.android["targetSdkVersion"]
        versionCode rootProject.ext.android["versionCode"]
        versionName rootProject.ext.android["versionName"]
        testInstrumentationRunner rootProject.ext.dependencies["androidJUnitRunner"]
        ndk {
            // 设置支持的SO库架构 一般只设置这个就阔以设配所有的设备了,还可以极大的减少apk的大小
            abiFilters 'armeabi-v7a'
        }
    }

   /* signingConfigs {
        def alias = "wandroid"
        def password = "password"
        def filePath = "wandroid.jks"

        debug {
            keyAlias alias
            keyPassword password
            storeFile file(filePath)
            storePassword(password)
        }
        release {
            keyAlias alias
            keyPassword password
            storeFile file(filePath)
            storePassword(password)
        }
    }*/

    buildTypes {
        debug {
            buildConfigField "boolean", "LOG_DEBUG",  "true"
            buildConfigField "boolean", "USE_CANARY", "true"
            buildConfigField "String", "BUGLY_KEY", '"xxxxxx"'
            minifyEnabled false
            shrinkResources false
            zipAlignEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }

        release {
            buildConfigField "boolean", "LOG_DEBUG",  "false"
            buildConfigField "boolean", "USE_CANARY", "false"
            buildConfigField "String", "BUGLY_KEY", '"5a5f6366fc"'//bugly key
            minifyEnabled true//开启混淆
            shrinkResources true
            zipAlignEnabled true//去除无用资源
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }

    lintOptions {
        disable 'InvalidPackage'
        disable "ResourceType"
        abortOnError false
    }
    dexOptions {
        javaMaxHeapSize "4g"
        jumboMode = true
        preDexLibraries = false
        additionalParameters = [
                '--multi-dex',//多分包
                '--set-max-idx-number=60000'//每个包内方法数上限
        ]
    }
}

dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    //dagger
    annotationProcessor rootProject.ext.dependencies["dagger2-compiler"]
    kapt rootProject.ext.dependencies["dagger2-compiler"]
    //黄油刀
    implementation "com.jakewharton:butterknife:10.1.0"
    kapt "com.jakewharton:butterknife-compiler:10.1.0"
    //test
    testImplementation rootProject.ext.dependencies["junit"]
    debugImplementation rootProject.ext.dependencies["canary-debug"]
    releaseImplementation rootProject.ext.dependencies["canary-release"]
    testImplementation rootProject.ext.dependencies["canary-release"]
    //kotlin
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
    implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.1"
    //项目用到的库大部分封装在里面 具体在 config.gradle
    implementation rootProject.ext.customLibs
}
repositories {
    mavenCentral()
}