apply plugin: 'com.android.application' apply plugin: 'org.greenrobot.greendao'//greendao插件dependencies apply plugin: 'kotlin-android' apply plugin: 'kotlin-android-extensions' 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 GradleException("无法读取version_code.properties文件!") } } def name = "风月读书" def version = getVersionCode() android { compileSdkVersion 29 buildToolsVersion '29.0.3' defaultConfig { applicationId "xyz.fycz.myreader" minSdkVersion 21 targetSdkVersion 29 versionCode version versionName '1.' + releaseTime() testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner' javaCompileOptions { annotationProcessorOptions { includeCompileClasspath = 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" } } 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 { } } dependencies { implementation fileTree(include: ['*.jar'], dir: 'libs') 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" implementation 'com.jakewharton:butterknife:10.0.0' annotationProcessor 'com.jakewharton:butterknife-compiler:10.0.0' //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' implementation 'org.jsoup:jsoup:1.11.3' //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' implementation 'com.h6ah4i.android.widget.verticalseekbar:verticalseekbar:1.0.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' } greendao { schemaVersion 16 daoPackage 'xyz.fycz.myreader.greendao.gen' // targetGenDir 'src/main/java' }