apply plugin: 'com.android.application'

def releaseTime() {
    return new Date().format("yyMMdd", TimeZone.getTimeZone("UTC"))
}

android {
    compileSdkVersion 25
    buildToolsVersion "25.0.0"
    defaultConfig {
        applicationId "com.lzx.lock"
        minSdkVersion 15
        targetSdkVersion 25
        versionCode 2
        versionName "1.1"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            zipAlignEnabled true //Zipalign优化
            shrinkResources false //移除无用的resource文件
            minifyEnabled false  //混淆
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    android.applicationVariants.all { variant ->
        variant.outputs.each { output ->
            def outputFile = output.outputFile
            if (outputFile != null && outputFile.name.endsWith('.apk')) {
                //这里修改apk文件名
                def fileName = "AppLock_v${defaultConfig.versionName}_${releaseTime()}.apk"
                output.outputFile = new File(outputFile.parent, fileName)
            }
        }
    }
    //忽略一些错误
    lintOptions {
        abortOnError true
    }
}

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    compile 'com.android.support:appcompat-v7:25.0.0'
    compile 'com.android.support:design:25.0.0'
    //数据库
    compile 'org.litepal.android:core:1.4.1'
}
