apply plugin: 'com.android.application' /**获取git count HEAD,可以根据该值回退版本*/ def getMyVersionCode() { Process process = "git rev-list --count HEAD".execute() process.waitFor() int cccc = process.getText().toInteger() return cccc } android { compileSdkVersion 28 defaultConfig { applicationId "com.tophold.example" minSdkVersion 17 targetSdkVersion 28 versionCode getMyVersionCode() as int//查询versioncode即可找到对应git历史 versionName "0.0.1" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" } signingConfigs { //debug模式下签名的设置,这里的配置主要用于脚本运行。对于采用图形界面构建测不起效。 debug { storeFile file(project.debug_storeFile) storePassword project.debug_storePassword keyAlias project.debug_keyAlias keyPassword project.debug_keyPassword v1SigningEnabled true v2SigningEnabled true } beta { storeFile file(project.debug_storeFile) storePassword project.debug_storePassword keyAlias project.debug_keyAlias keyPassword project.debug_keyPassword v1SigningEnabled true v2SigningEnabled true } release { storeFile file(project.release_storeFile) storePassword project.release_storePassword keyAlias project.release_keyAlias keyPassword project.release_keyPassword v1SigningEnabled true v2SigningEnabled true } } buildTypes { //平时开发使用 debug { // 显示Log buildConfigField "boolean", "LOG_DEBUG", "true" shrinkResources false minifyEnabled false zipAlignEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' //versionName的后缀 versionNameSuffix "_debug" //appId后缀,加一个后缀保证各个版本(debug、beta、release可以共存) applicationIdSuffix ".debug" //签名选择 signingConfig signingConfigs.debug //动态修改应用的名字和图标 manifestPlaceholders = [app_names: "金融View_debug"] debuggable true } //内侧使用 beta { // 显示Log buildConfigField "boolean", "LOG_DEBUG", "true" shrinkResources false minifyEnabled false zipAlignEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' //versionName的后缀 versionNameSuffix "_beta" //appId后缀 applicationIdSuffix ".beta" //签名选择 signingConfig signingConfigs.beta manifestPlaceholders = [app_names: "金融View_beta"] debuggable true } //正式版本 release { //不显示log信息 buildConfigField "boolean", "LOG_DEBUG", "false" // 移除无用的resource文件 shrinkResources true //混淆 minifyEnabled true //压缩 zipAlignEnabled true proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' //签名 signingConfig signingConfigs.release manifestPlaceholders = [app_names: "金融View"] debuggable true } } compileOptions { sourceCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8 } } dependencies { implementation fileTree(include: ['*.jar'], dir: 'libs') implementation 'com.android.support:support-v4:28.0.0' implementation 'com.android.support:recyclerview-v7:28.0.0' implementation 'com.android.support:design:28.0.0' implementation 'com.android.support.constraint:constraint-layout:1.1.3' testImplementation 'junit:junit:4.12' androidTestImplementation 'com.android.support.test:runner:1.0.2' androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2' implementation project(path: ':financiallib') //rx2.0 implementation 'io.reactivex.rxjava2:rxandroid:2.1.1' implementation 'io.reactivex.rxjava2:rxjava:2.2.8' //api implementation 'com.squareup.retrofit2:retrofit:2.5.0' implementation 'com.squareup.retrofit2:converter-gson:2.5.0' implementation 'com.squareup.retrofit2:adapter-rxjava2:2.5.0' implementation 'com.squareup.okhttp3:okhttp:3.12.0' implementation 'com.squareup.okhttp3:logging-interceptor:3.11.0' /**https://github.com/CymChad/BaseRecyclerViewAdapterHelper:qucik recycle*/ implementation 'com.github.CymChad:BaseRecyclerViewAdapterHelper:2.9.49' implementation 'org.greenrobot:eventbus:3.1.1' implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" } apply plugin: 'kotlin-android' apply plugin: 'kotlin-android-extensions'