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() // 读取keystore.properties def keyProps = new Properties() def keyPropsFile = rootProject.file('keystore/keystore.properties') if (keyPropsFile.exists()) { keyProps.load(new FileInputStream(keyPropsFile)) } 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' } signingConfigs { myConifg { keyAlias keyProps['keyAlias'] keyPassword keyProps['keyPassword'] storeFile keyProps['storeFile'] ? file(keyProps['storeFile']) : null storePassword keyProps['storePassword'] } } buildFeatures { viewBinding true } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' ndk { abiFilters "x86", "armeabi", "armeabi-v7a" } signingConfig signingConfigs.myConifg } debug { ndk { abiFilters "x86", "armeabi", "armeabi-v7a" } minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' signingConfig signingConfigs.myConifg } 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 { } packagingOptions { // pickFirsts:当出现重复文件,会使用第一个匹配的文件打包进入apk pickFirst 'lib/*/libRSSupport.so' pickFirst 'lib/*/librsjni.so' } } repositories { flatDir { dirs 'libs' } } dependencies { implementation fileTree(dir: 'libs', include: ['*.aar']) implementation fileTree(include: ['*.jar'], dir: 'libs') implementation project(path: ':DialogX') 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.8.0' annotationProcessor 'com.github.bumptech.glide:compiler:4.8.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 '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' implementation 'com.liulishuo.filedownloader:library:1.7.7' // 如使用视频广告必须依赖,否则会导致视频播放崩溃 implementation 'tv.danmaku.ijk.media:ijkplayer-java:0.8.8' implementation 'tv.danmaku.ijk.media:ijkplayer-armv7a:0.8.8' implementation 'tv.danmaku.ijk.media:ijkplayer-exo:0.8.8' //SwipeBackLayout implementation 'me.imid.swipebacklayout.lib:library:1.1.0' //JS //noinspection GradleDependency implementation 'com.github.gedoor:rhino-android:1.3' //XXPermissions implementation 'com.github.getActivity:XXPermissions:11.2' //epub implementation('com.positiondev.epublib:epublib-core:3.1') { exclude group: 'org.slf4j' exclude group: 'xmlpull' } } greendao { schemaVersion 29 daoPackage 'xyz.fycz.myreader.greendao.gen' // targetGenDir 'src/main/java' }