apply plugin: 'com.android.application' apply plugin: 'kotlin-android' apply plugin: 'kotlin-android-extensions' apply plugin: 'kotlin-kapt' apply plugin: 'realm-android' ext { //定义变量 signingConfigKeyAlias = "" signingConfigKeyPassword = "" signingConfigStoreFilePath = "" signingConfigStorePassword = "" jpushAppKeyDebug = "" pgyAppIdDebug = "" baiduAppIdDebug = "" baiduSecretDebug = "" baiduAppKeyDebug = "" jpushAppKeyRelease = "" pgyAppIdRelease = "" baiduAppIdRelease = "" baiduSecretRelease = "" baiduAppKeyRelease = "" jpushIMPassword = "" buglyAppId = "" } def loadProperties() { // load properties Properties properties = new Properties() properties.load(project.rootProject.file('local.properties').newDataInputStream()) project.signingConfigKeyAlias = properties.getProperty("signingConfig.keyAlias") project.signingConfigKeyPassword = properties.getProperty("signingConfig.keyPassword") project.signingConfigStoreFilePath = properties.getProperty("signingConfig.storeFilePath") project.signingConfigStorePassword = properties.getProperty("signingConfig.storePassword") //debug key //极光推送 project.jpushAppKeyDebug = properties.getProperty("JPUSH_APPKEY_DEBUG") //蒲公英 project.pgyAppIdDebug = properties.getProperty("PGY_APP_ID_DEBUG") //百度 project.baiduAppIdDebug = properties.getProperty("BAIDU_APPID_DEBUG") project.baiduSecretDebug = properties.getProperty("BAIDU_SECRET_DEBUG") project.baiduAppKeyDebug = properties.getProperty("BAIDU_APPKEY_DEBUG") //release key project.jpushAppKeyRelease = properties.getProperty("JPUSH_APPKEY_RELEASE") project.pgyAppIdRelease = properties.getProperty("PGY_APP_ID_RELEASE") project.baiduAppIdRelease = properties.getProperty("BAIDU_APPID_RELEASE") project.baiduSecretRelease = properties.getProperty("BAIDU_SECRET_RELEASE") project.baiduAppKeyRelease = properties.getProperty("BAIDU_APPKEY_RELEASE") project.jpushIMPassword = properties.getProperty("JM_IM_USER_PASSWORD") //bugly project.buglyAppId = properties.getProperty("BUGLY_APPID") } loadProperties() task printVersionName { def v = project.property("o2.versionName").toString() println( "${v}" ) } android { compileSdkVersion 26 buildToolsVersion "27.0.3" sourceSets { main { jniLibs.srcDir 'libs' assets.srcDirs = ['assets'] res.srcDirs = ['src/main/res', 'src/main/res/raw'] } } signingConfigs { release { v1SigningEnabled true v2SigningEnabled true keyAlias project.signingConfigKeyAlias keyPassword project.signingConfigKeyPassword storeFile file(project.signingConfigStoreFilePath) storePassword project.signingConfigStorePassword } debug { v1SigningEnabled true v2SigningEnabled true keyAlias 'androiddebugkey' storeFile file('debug.keystore') keyPassword 'android' } } defaultConfig { applicationId "net.zoneland.x.bpm.mobile.v1.zoneXBPM" minSdkVersion 19 targetSdkVersion 26 versionCode project.property("o2.versionCode").toInteger() versionName project.property("o2.versionName").toString() multiDexEnabled true ndk { //选择要添加的对应cpu类型的.so库。 abiFilters 'armeabi', 'armeabi-v7a' //, 'arm64-v8a' //, 'x86', 'x86_64' // 还可以添加 'x86', 'x86_64', 'mips', 'mips64' } multiDexKeepProguard file('multidex_keep_file.pro') vectorDrawables.useSupportLibrary = true } buildTypes { debug { signingConfig signingConfigs.debug buildConfigField "Boolean", "InnerServer", "false" buildConfigField "Boolean", "LOG_ENABLE", "true" buildConfigField "Boolean", "LOG_FILE", "true" manifestPlaceholders = [JPUSH_PKGNAME: "net.zoneland.x.bpm.mobile.v1.zoneXBPM", JPUSH_APPKEY : project.jpushAppKeyDebug, JM_IM_USER_PASSWORD : project.jpushIMPassword, PGY_APP_ID : project.pgyAppIdDebug, BAIDU_APPID : project.baiduAppIdDebug, BAIDU_SECRET : project.baiduSecretDebug, BAIDU_APPKEY : project.baiduAppKeyDebug, BUGLY_APPID : project.buglyAppId] } release { signingConfig signingConfigs.release buildConfigField "Boolean", "InnerServer", "false" buildConfigField "Boolean", "LOG_ENABLE", "false" buildConfigField "Boolean", "LOG_FILE", "true" manifestPlaceholders = [JPUSH_PKGNAME: "net.zoneland.x.bpm.mobile.v1.zoneXBPM", JPUSH_APPKEY : project.jpushAppKeyRelease, JM_IM_USER_PASSWORD : project.jpushIMPassword, PGY_APP_ID : project.pgyAppIdRelease, BAIDU_APPID : project.baiduAppIdRelease, BAIDU_SECRET : project.baiduSecretRelease, BAIDU_APPKEY : project.baiduAppKeyRelease, BUGLY_APPID : project.buglyAppId] zipAlignEnabled true //Zipalign优化 minifyEnabled true //混淆 proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' //apk包重命名 applicationVariants.all { variant -> variant.outputs.all { outputFileName = "${variant.productFlavors[0].name}-${variant.versionName}.apk" } } } } dataBinding { enabled true } android { lintOptions { abortOnError false } } lintOptions { checkReleaseBuilds false abortOnError false } //All flavors must now belong to a named flavor dimension. Learn more at https://d.android.com/r/tools/flavorDimensions-missing-error-message.html flavorDimensions "type" productFlavors { O2PLATFORM { manifestPlaceholders = [JPUSH_CHANNEL: "pgy"] } huawei { manifestPlaceholders = [JPUSH_CHANNEL: "huawei"] } xiaomi { manifestPlaceholders = [JPUSH_CHANNEL: "xiaomi"] } } } buildscript { repositories { mavenCentral() } dependencies { classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" classpath "org.jetbrains.kotlin:kotlin-android-extensions:$kotlin_version" } } repositories { flatDir { dirs 'libs' } } dependencies { // implementation fileTree(include: ['*.jar'], dir: 'libs') implementation files('libs/o2_auth_sdk.jar') implementation files('libs/BaiduLBS_Android.jar') implementation files('libs/bdasr_V3_20180320_9066860.jar') implementation files('libs/com.baidu.tts_2.3.1.20170808_e39ea89.jar') implementation files('libs/pgyer_sdk_2.2.2.jar') implementation files('libs/zxing.jar') implementation files('libs/picasso-2.5.2.jar') implementation files('libs/pinyin4j-2.5.0.jar') implementation files('libs/universal-image-loader-1.9.5.jar') implementation files('libs/tbs_sdk_thirdapp_v3.2.0.1104_43200.jar') implementation(name: 'material-calendarview-fancy-1.1', ext: 'aar') implementation(name: 'MGLicenseManagerSDK-0.3.1', ext: 'aar') implementation(name: 'MGFaceppSDK-0.5.2', ext: 'aar') //kotlin implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" implementation "org.jetbrains.anko:anko-common:$anko_version" //support implementation('com.android.support:support-v4:26.1.0') { force = true } implementation('com.android.support:recyclerview-v7:26.1.0') { exclude module: 'support-v4' } implementation 'com.android.support:appcompat-v7:26.1.0' implementation 'com.android.support:cardview-v7:26.1.0' implementation 'com.android.support:design:26.1.0' implementation 'com.android.support.constraint:constraint-layout:1.1.3' implementation 'com.android.support:multidex:1.0.3' implementation 'com.github.PhilJay:MPAndroidChart:v2.2.4' implementation('com.github.bumptech.glide:glide:3.7.0') { force = true } implementation 'com.afollestad.material-dialogs:core:0.8.5.9' implementation 'net.muliba.fancyfilepickerlibrary:fancyfilepickerlibrary:3.0.2' implementation 'net.muliba.changeskin:changeskin:1.2.2' implementation 'io.o2oa:signatureview:1.0.0' implementation 'net.zoneland.o2.calendarview:library:1.1.2' implementation 'com.readystatesoftware.systembartint:systembartint:1.0.3' implementation 'com.facebook.shimmer:shimmer:0.1.0@aar' implementation 'com.borax12.materialdaterangepicker:library:1.9' implementation 'com.yanzhenjie:recyclerview-swipe:1.1.4' //http implementation 'com.squareup.retrofit2:retrofit:2.4.0' implementation 'com.squareup.retrofit2:converter-gson:2.2.0' implementation 'com.squareup.retrofit2:adapter-rxjava:2.0.2' implementation 'com.squareup.okhttp3:okhttp:3.11.0' implementation 'io.reactivex:rxjava:1.1.6' implementation 'io.reactivex:rxandroid:1.2.1' //bugly implementation 'com.tencent.bugly:crashreport:2.6.6' //极光推送 implementation 'cn.jiguang.sdk:jpush:3.1.2' implementation 'cn.jiguang.sdk:jmessage:2.5.0' // 此处以JMessage 2.5.0 版本为例。 implementation 'cn.jiguang.sdk:jcore:1.1.9' // 此处以JCore 1.1.9 版本为例。 //im implementation 'com.michaelpardo:activeandroid:3.1.0-SNAPSHOT' implementation 'com.jakewharton:butterknife:8.4.0' kapt 'com.jakewharton:butterknife-compiler:8.4.0' implementation 'com.github.w446108264:AndroidEmoji:1.0.0' implementation 'com.github.chrisbanes.photoview:library:1.2.4' implementation 'com.facebook.fresco:fresco:0.8.1' implementation 'org.greenrobot:eventbus:3.0.0' implementation 'com.contrarywind:Android-PickerView:3.2.4' //滚动选择器 implementation 'com.jzxiang.pickerview:TimePickerDialog:1.0.1' //google architecture component def lifecycle_version = "1.1.1" // ViewModel and LiveData implementation "android.arch.lifecycle:extensions:$lifecycle_version" // alternatively - just ViewModel implementation "android.arch.lifecycle:viewmodel:$lifecycle_version" // use -ktx for Kotlin // alternatively - just LiveData implementation "android.arch.lifecycle:livedata:$lifecycle_version" // alternatively - Lifecycles only (no ViewModel or LiveData). // Support library depends on this lightweight import implementation "android.arch.lifecycle:runtime:$lifecycle_version" annotationProcessor "android.arch.lifecycle:compiler:$lifecycle_version" //noinspection GradleDependency kapt "com.android.databinding:compiler:$gradle_version" //test testImplementation 'junit:junit:4.12' } tasks.whenTaskAdded { task -> if (task.name == "lint") { task.enabled = false } }