apply plugin: 'com.android.application' apply plugin: 'org.greenrobot.greendao'//greendao插件dependencies apply plugin: 'kotlin-android' def releaseTime() { return new Date().format("yy.MMddHH", TimeZone.getTimeZone("GMT+08:00")) } def getVersionCode() { def versionCodeFile = file('version_code.properties') if (versionCodeFile.canRead()) { Properties properties = new Properties() properties.load(new FileInputStream(versionCodeFile)) def versionCode = properties['VERSION_CODE'].toInteger()//读取version_code.properties文件存放的版本号。 def runTasks = gradle.startParameter.taskNames def task = ':app:assembleRelease' if (task in runTasks) { properties['VERSION_CODE'] = (++versionCode).toString() properties.store(versionCodeFile.newWriter(), null) } return versionCode } else { throw new FileNotFoundException("无法读取version_code.properties文件!") } } def getVersionCodeNotIncrease() { def versionCodeFile = file('version_code.properties') if (versionCodeFile.canRead()) { Properties properties = new Properties() properties.load(new FileInputStream(versionCodeFile)) def versionCode = properties['VERSION_CODE'].toInteger()//读取version_code.properties文件存放的版本号。 return versionCode } else { throw new FileNotFoundException("无法读取version_code.properties文件!") } } def name = "风月读书" def version = getVersionCode() def getVersionName(){ def version = getVersionCodeNotIncrease() def hun = (version / 100).toInteger() def ten = (version / 10).toInteger() % 10 def one = version % 10 return hun + "." + ten + "." + one } def versionN = getVersionName() android { compileSdkVersion 29 buildToolsVersion '29.0.3' defaultConfig { applicationId "xyz.fycz.myreader" minSdkVersion 21 targetSdkVersion 29 versionCode version versionName versionN testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner' } buildFeatures { viewBinding true } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' ndk { abiFilters "x86", "armeabi", "armeabi-v7a" } } debug { ndk { abiFilters "x86", "armeabi", "armeabi-v7a" } proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } android.applicationVariants.all { variant -> variant.outputs.all { outputFileName = "${name}v${defaultConfig.versionName}.apk" } } } sourceSets.main { jni.srcDirs = [] jniLibs.srcDir "libs/" } compileOptions { sourceCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8 } productFlavors { } } repositories { flatDir { dirs 'libs' } } dependencies { implementation fileTree(dir: 'libs', include: ['*.aar']) implementation fileTree(include: ['*.jar'], dir: 'libs') testImplementation 'junit:junit:4.12' androidTestImplementation 'androidx.test.ext:junit:1.1.1' androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0' api 'androidx.core:core-ktx:1.3.0' implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" //anko def anko_version = '0.10.8' implementation "org.jetbrains.anko:anko-sdk27:$anko_version" implementation "org.jetbrains.anko:anko-sdk27-listeners:$anko_version" //Glide implementation 'com.github.bumptech.glide:glide:4.9.0' annotationProcessor 'com.github.bumptech.glide:compiler:4.9.0' implementation 'com.squareup.okhttp3:okhttp:3.14.7' implementation 'com.google.code.gson:gson:2.8.5' implementation 'com.journeyapps:zxing-android-embedded:3.5.0' implementation 'org.greenrobot:greendao:3.3.0' implementation 'com.github.yuweiguocn:GreenDaoUpgradeHelper:v2.2.1' //JSoup implementation 'org.jsoup:jsoup:1.11.3' implementation 'cn.wanghaomiao:JsoupXpath:2.4.3' implementation 'com.jayway.jsonpath:json-path:2.5.0' //SmartRefreshLayout implementation 'com.scwang.smartrefresh:SmartRefreshLayout:1.1.2' implementation 'com.scwang.smartrefresh:SmartRefreshHeader:1.1.2' implementation 'pl.droidsonroids.gif:android-gif-drawable:1.2.3' implementation 'me.gujun.android.taggroup:library:1.4@aar' implementation 'uk.co.chrisjenx:calligraphy:2.3.0' implementation 'androidx.constraintlayout:constraintlayout:1.1.3' implementation 'io.alterac.blurkit:blurkit:1.1.0' implementation 'com.google.android.material:material:1.1.0' //Scroller implementation 'com.futuremind.recyclerfastscroll:fastscroll:0.2.5' //Toasty implementation 'com.github.GrenderG:Toasty:1.5.0' //字符串比较 implementation 'net.ricecode:string-similarity:1.0.0' implementation 'com.jayway.jsonpath:json-path:2.4.0' //RxAndroid implementation 'io.reactivex.rxjava2:rxjava:2.2.19' implementation 'io.reactivex.rxjava2:rxandroid:2.1.1' //ImmersionBar implementation 'com.gyf.immersionbar:immersionbar:3.0.0' //简繁转换 implementation 'com.luhuiguo:chinese-utils:1.0' //颜色选择 implementation 'com.jaredrummler:colorpicker:1.1.0' //二维码 implementation 'cn.bingoogolapple:bga-qrcode-zxing:1.3.7' //编码识别 implementation 'com.github.albfernandez:juniversalchardet:2.4.0' // 标签 https://github.com/hongyangAndroid/FlowLayout implementation 'com.hyman:flowlayout-lib:1.1.2' } greendao { schemaVersion 23 daoPackage 'xyz.fycz.myreader.greendao.gen' // targetGenDir 'src/main/java' }