apply plugin: 'com.android.application' Properties props = new Properties() props.load(new FileInputStream(file("signing.properties"))) Properties serverProps = new Properties() def propFile = file('server_url.properties') def testApiUrl, proApiUrl if (propFile.canRead()) { serverProps.load(new FileInputStream(propFile)) if (serverProps != null) { testApiUrl = serverProps['testApiUrl'] proApiUrl = serverProps['proApiUrl'] } } android { compileSdkVersion rootProject.ext.compileSdkVersion buildToolsVersion rootProject.ext.buildToolsVersion defaultConfig { applicationId "com.tongyu.luck.happywork" minSdkVersion rootProject.ext.minSdkVersion targetSdkVersion rootProject.ext.targetSdkVersion multiDexEnabled true multiDexKeepProguard file("multidexKeep.pro")//腾讯bugly的类放到主Dex versionCode 341 versionName "3.4.1" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" flavorDimensions "versionCode" ndk { abiFilters "armeabi", "armeabi-v7a", "arm64-v8a", "x86", "arm64-v8a", "x86_64" } } productFlavors { hbpro { applicationId "com.tongyu.luck.happywork" buildConfigField('String', 'baseApiUrl', proApiUrl) buildConfigField('String', 'BUGLY_ID', "\"f39e8bfcb6\"") buildConfigField('String', 'VERIFY_URL', "\"https://tw.hap-job.com/captcha/captcha?phone=\"") manifestPlaceholders = [ AMAP_KEY : "0e0cda5ece292d81a67ab1277973164d", WX_APPID_VALUE: "wxeb8c2418a8ace030", ] } hbtest { applicationId "com.tongyu.luck.happywork.test" buildConfigField('String', 'baseApiUrl', testApiUrl) buildConfigField('String', 'BUGLY_ID', "\"ea1dc909cd\"") buildConfigField('String', 'VERIFY_URL', "\"https://dk.hap-job.com/captcha/captcha?phone=\"") manifestPlaceholders = [ AMAP_KEY : "af3f5c403ce607e9603e5087b1b2c961", WX_APPID_VALUE: "wx9c053f7126db0b28", ] } } signingConfigs { debug { keyAlias props['KEY_ALIAS'] keyPassword props['KEY_PASSWORD'] storeFile file(props['KEYSTORE_FILE']) storePassword props['KEYSTORE_PASSWORD'] } release { keyAlias props['KEY_ALIAS'] keyPassword props['KEY_PASSWORD'] storeFile file(props['KEYSTORE_FILE']) storePassword props['KEYSTORE_PASSWORD'] } } //自动生成指定名称的release发布版的 apk文件 android.applicationVariants.all { variant -> variant.outputs.all { output -> outputFileName = "happyJob_${variant.productFlavors[0].name}_${buildType.getName()}_${defaultConfig.versionName}.apk" } } buildTypes { release { //混淆 minifyEnabled true //Zipalign优化 zipAlignEnabled true // 移除无用的resource文件 shrinkResources true proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' signingConfig signingConfigs.release } debug { signingConfig signingConfigs.release } } } dependencies { implementation fileTree(include: ['*.jar'], dir: 'libs') implementation project(':baselibrary') implementation 'com.jakewharton:butterknife:8.0.1' annotationProcessor 'com.jakewharton:butterknife-compiler:8.0.1' }