123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149 |
- apply plugin: 'com.android.application'
- def getVersionCode() {// 获取版本号
- def versionFile = file('version.properties')// 读取第一步新建的文件
- if (versionFile.canRead()) {// 判断文件读取异常
- Properties versionProps = new Properties()
- versionProps.load(new FileInputStream(versionFile))
- def versionCode = versionProps['VERSION_CODE'].toInteger()// 读取文件里面的版本号
- def runTasks = gradle.startParameter.taskNames
- // if ('assembleRelease' in runTasks) {//仅在assembleRelease任务是增加版本号,其他渠道包在此分别配置
- if ('assemble' in runTasks) {
- // 版本号自增之后再写入文件(此处是关键,版本号自增+1)
- versionProps['VERSION_CODE'] = (++versionCode).toString()
- versionProps.store(versionFile.newWriter(), null)
- }
- return versionCode // 返回自增之后的版本号
- } else {
- throw new GradleException("Could not find version.properties!")
- }
- }
- def getVersionName() {// 获取版本号
- def versionFile = file('version.properties')// 读取第一步新建的文件
- if (versionFile.canRead()) {// 判断文件读取异常
- Properties versionProps = new Properties()
- versionProps.load(new FileInputStream(versionFile))
- def versionName = versionProps['VERSION_NAME'].toString()// 读取文件里面的版本号
- return versionName // 返回自增之后的版本号
- } else {
- throw new GradleException("Could not find version.properties!")
- }
- }
- android {
- compileSdkVersion 30
- def defaultVersionName = getVersionName()
- def defaultVersionCode = getVersionCode()
- defaultConfig {
- applicationId "cn.gxeea.zk"
- minSdkVersion 24
- //noinspection ExpiredTargetSdkVersion
- targetSdkVersion 30
- versionCode defaultVersionCode
- versionName defaultVersionName
- multiDexEnabled true
- compileOptions {
- sourceCompatibility JavaVersion.VERSION_1_8
- targetCompatibility JavaVersion.VERSION_1_8
- }
- sourceSets {
- main {
- jniLibs.srcDirs = ['libs', "src/main/jniLibs"]
- }
- }
- ndk {
- // abiFilters "armeabi"
- abiFilters 'armeabi-v7a','arm64-v8a'
- }
- }
- signingConfigs {
- config {
- keyAlias 'ses'
- keyPassword '123456'
- storeFile file('./app.jks')
- storePassword '123456'
- v1SigningEnabled true
- v2SigningEnabled true
- }
- }
- buildTypes {
- debug {
- signingConfig signingConfigs.config
- minifyEnabled false
- proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
- }
- release {
- signingConfig signingConfigs.config
- minifyEnabled false
- proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
- }
- }
- packagingOptions {
- jniLibs {
- keepDebugSymbols += ['*/arm64-v8a/*.so', '*/armeabi-v7a/*.so']
- pickFirsts += ['lib/*/libc++_shared.so']
- useLegacyPackaging true
- }
- }
- androidResources {
- ignoreAssetsPattern '!.svn:!.git:.*:!CVS:!thumbs.db:!picasa.ini:!*.scc:*~'
- additionalParameters '--auto-add-overlay'
- }
- namespace 'cn.gxeea.zk'
- android.applicationVariants.configureEach { variant ->
- variant.outputs.all {
- outputFileName = "ses-app-" + variant.name + "-" + variant.versionName + "-build(" + variant.versionCode + ")" + getTime() + ".apk"
- }
- }
- }
- static def getTime() {
- return "-" + new Date().format("yyyyMMddHHmm", TimeZone.getTimeZone("UTC"))
- }
- //
- dependencies {
- implementation fileTree(include: ['*.jar'], dir: 'libs')
- implementation fileTree(include: ['*.aar'], dir: 'libs')
- implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
- implementation 'androidx.multidex:multidex:2.0.1'
- //
- // implementation 'androidx.appcompat:appcompat:1.0.0'
- implementation 'androidx.legacy:legacy-support-v4:1.0.0'
- // implementation 'androidx.recyclerview:recyclerview:1.0.0'
- implementation 'com.facebook.fresco:fresco:2.5.0'
- implementation "com.facebook.fresco:animated-gif:2.5.0"
- implementation 'com.github.bumptech.glide:glide:4.16.0'
- // implementation 'com.github.bumptech.glide:glide:4.9.0'
- implementation 'com.alibaba:fastjson:1.1.46.android'
- implementation 'com.google.code.gson:gson:2.8.6'
- implementation 'com.tencent.mm.opensdk:wechat-sdk-android-without-mta:5.5.8'
- // implementation 'androidx.annotation:annotation-jvm:1.7.0'
- // implementation fileTree(dir: 'libs', include: ['*.aar'])
- implementation 'androidx.appcompat:appcompat:1.3.1'
- implementation 'com.google.android.material:material:1.4.0'
- implementation 'androidx.recyclerview:recyclerview:1.1.0'
- implementation 'androidx.annotation:annotation:1.2.0'
- // implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
- // testImplementation 'junit:junit:4.13.2'
- // androidTestImplementation 'androidx.test.ext:junit:1.1.3'
- androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
- // implementation fileTree(dir: '../app/libs', include: ['FaceImageLib-1.1.0.aar'])
- implementation 'com.squareup.okhttp3:okhttp:4.11.0'
- // implementation "com.android.support:support-v4:28.0.0"
- // implementation "com.android.support:appcompat-v7:28.0.0"
- // implementation 'com.android.support:recyclerview-v7:28.0.0'
- // implementation 'com.facebook.fresco:fresco:1.13.0'
- // implementation "com.facebook.fresco:animated-gif:1.13.0"
- // implementation 'com.github.bumptech.glide:glide:4.9.0'
- // implementation 'com.alibaba:fastjson:1.1.46.android'
- }
|