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 FileNotFoundException("无法读取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 { } } 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" 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' //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' //Material Dialogs /*//email implementation 'com.sun.mail:android-mail:1.6.2' implementation 'com.sun.mail:android-activation:1.6.2'*/ /*def dialog_version = '3.3.0' implementation "com.afollestad.material-dialogs:core:$dialog_version" implementation "com.afollestad.material-dialogs:input:$dialog_version" implementation "com.afollestad.material-dialogs:files:$dialog_version" implementation "com.afollestad.material-dialogs:bottomsheets:$dialog_version"*/ } greendao { schemaVersion 18 daoPackage 'xyz.fycz.myreader.greendao.gen' // targetGenDir 'src/main/java' }