apply plugin: 'com.android.application'

android {
    compileSdkVersion 23
    buildToolsVersion "24.0.1"

    useLibrary 'org.apache.http.legacy'

    defaultConfig {
        applicationId "leadtech.xufeng.android.com.yuanzhao"
        minSdkVersion 14
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
    }

    //打包后应用名称
    applicationVariants.all { variant ->
        variant.outputs.each { output ->
            def outputFile = output.outputFile
            def fileName
            if (outputFile != null && outputFile.name.endsWith('.apk')) {
                if (variant.buildType.name.equals('release')) {
                    fileName = "XXX_v${defaultConfig.versionName}.apk"
                } else if (variant.buildType.name.equals('debug')) {
                    fileName = "XXX_v${defaultConfig.versionName}_debug.apk"
                }
                output.outputFile = new File(outputFile.parent, fileName)
            }
        }
    }

    //签名
    signingConfigs {
        debug {
            //这样写就得把demo.jk文件放在项目目录
            storeFile file("E:\\AndroidProject\\leader_app.app")
            storePassword "leadertechfangwei"
            keyAlias "leader_app"
            keyPassword "leadertechfangwei"
//            storeFile file("C:\\Users\\Administrator\\.android\\debug.keystore")
        }
        relealse {
            //这样写就得把demo.jk文件放在项目目录
            storeFile file("E:\\AndroidProject\\leader_app.app")
            storePassword "leadertechfangwei"
            keyAlias "leader_app"
            keyPassword "leadertechfangwei"
        }
    }

    buildTypes {
        debug {
            // 显示Log
            buildConfigField "boolean", "LOG_DEBUG", "true"

            versionNameSuffix "-debug"
            minifyEnabled false
            zipAlignEnabled false
            shrinkResources false
            signingConfig signingConfigs.debug

//          buildConfigField "String", "ENVIRONMENT", "\"http://114.55.11.71:80/ecom/\""
        }
        release {
            // 不显示Log
            buildConfigField "boolean", "LOG_DEBUG", "false"
            //混淆
            minifyEnabled true
            //Zipalign优化
            zipAlignEnabled true
            // 移除无用的resource文件
            shrinkResources true
            //前一部分代表系统默认的android程序的混淆文件,该文件已经包含了基本的混淆声明
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            //签名
            signingConfig signingConfigs.relealse

//            buildConfigField "String", "ENVIRONMENT", "\"http://xyl.com/ecom/\""
        }
    }
}

dependencies {
    //指定版本
    compile 'com.jcodecraeer:xrecyclerview:1.2.7'
    compile 'com.zhy:okhttputils:2.6.2'
    compile 'com.android.support:support-v4:23.3.0'
    compile 'com.android.support:recyclerview-v7:23.1.1'
    compile files('libs/BaiduLBS_Android.jar')
    compile files('libs/BaiduTraceSDK_v2_1_12.jar')
    compile project(':ScanCodeLibary')
    compile files('libs/gson-2.2.4.jar')
    compile project(':CicleViewLibary')
    compile project(':TakePhotoLibary')
}

 

posted on 2016-09-27 20:34  青年程序猿  阅读(203)  评论(0)    收藏  举报