Files
CubeAoleyunSN/app/build.gradle
fanhuitong 768519e14e version:1.0
update:2021-10-21 10:14:40
fix:
add:增加开机检测弹窗,增加常驻通知
2021-10-21 10:15:39 +08:00

358 lines
14 KiB
Groovy
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
apply plugin: 'com.android.application'
def appName() {
return "DeviceInfo"
}
def releaseTime() {
return new Date().format("yyyyMMdd-HHmmss", TimeZone.getDefault())
}
android {
compileSdkVersion 29
defaultConfig {
applicationId "com.aoleyun.sn"
minSdkVersion 24
targetSdkVersion 29
multiDexEnabled true
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
lintOptions {
checkReleaseBuilds false
}
dexOptions {
jumboMode true
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
//多版本
productFlavors {
//新平台正式
newly {
flavorDimensions "default"
versionCode 1
versionName "1.0"
/*********************************极光推送************************************/
manifestPlaceholders = [
JPUSH_PKGNAME: "com.aoleyun.sn",
JPUSH_APPKEY : "79c64ef41b8728ad6aa29af1", //JPush上注册的包名对应的appkey.
JPUSH_CHANNEL: "developer-default", //暂时填写默认值即可.
channel_value: "newly",
]
/*********************************极光推送end************************************/
buildConfigField "String", "ROOT_URL", '"https://led.aoleyun.cn/api/"'
buildConfigField "String", "SCREEN_BASE_URL", '"https://led.aoleyun.cn:2018/"'
buildConfigField "String", "SCREEN_URL", '"https://led.aoleyun.cn:2018/wm/is_online"'
buildConfigField "String", "WebsocketURL", '"wss://led.aoleyun.cn:2018"'
}
MTKnewly {
flavorDimensions "default"
versionCode 1
versionName "1.0"
/*********************************极光推送************************************/
manifestPlaceholders = [
JPUSH_PKGNAME: "com.aoleyun.sn",
JPUSH_APPKEY : "79c64ef41b8728ad6aa29af1", //JPush上注册的包名对应的appkey.
JPUSH_CHANNEL: "developer-default", //暂时填写默认值即可.
channel_value: "newly",
]
/*********************************极光推送end************************************/
buildConfigField "String", "ROOT_URL", '"https://led.aoleyun.cn/api/"'
buildConfigField "String", "SCREEN_BASE_URL", '"https://led.aoleyun.cn:2018/"'
buildConfigField "String", "SCREEN_URL", '"https://led.aoleyun.cn:2018/wm/is_online"'
buildConfigField "String", "WebsocketURL", '"wss://led.aoleyun.cn:2018"'
}
//新平台测试
beta {
versionNameSuffix "-beta"
flavorDimensions "default"
versionCode 1
versionName "1.0"
/*********************************极光推送************************************/
manifestPlaceholders = [
JPUSH_PKGNAME: "com.aoleyun.sn",
JPUSH_APPKEY : "79c64ef41b8728ad6aa29af1", //JPush上注册的包名对应的appkey.
JPUSH_CHANNEL: "developer-default", //暂时填写默认值即可.
channel_value: "beta",
]
/*********************************极光推送end************************************/
buildConfigField "String", "ROOT_URL", '"https://led.aoleyun.cn/api/"'
buildConfigField "String", "SCREEN_BASE_URL", '"https://led.aoleyun.cn:2018/"'
buildConfigField "String", "SCREEN_URL", '"https://led.aoleyun.cn:2018/wm/is_online"'
buildConfigField "String", "WebsocketURL", '"wss://led.aoleyun.cn:2018"'
}
}
sourceSets {
//测试版的图标
beta.res.srcDirs = ['src/beta/res']
// newly.res.srcDirs = ['src/beta/res']
}
//签名
signingConfigs {
zhanRui {
storeFile file("keystore/zhanxun.keystore")
storePassword "123456"
keyAlias "zhanxun"
keyPassword "123456"
v1SigningEnabled true
v2SigningEnabled true
}
zhanRuiUserdebug {
storeFile file("keystore/zhanxunUserdebug.keystore")
storePassword "123456"
keyAlias "zhanxunUserdebug"
keyPassword "123456"
v1SigningEnabled true
v2SigningEnabled true
}
debug {
storeFile file("keystore/xueshibaoos.jks")
storePassword "123456"
keyAlias "xueshibaoos"
keyPassword "123456"
v1SigningEnabled true
v2SigningEnabled true
}
release {
storeFile file("keystore/xueshibaoos.jks")
storePassword "123456"
keyAlias "xueshibaoos"
keyPassword "123456"
v1SigningEnabled true
v2SigningEnabled false
}
}
// Disable release builds for now
android.variantFilter { variant ->
if (variant.buildType.name.endsWith('zhanRuiRelease')) {
variant.setIgnore(variant.getFlavors().get(0).name.equals('official') || variant.getFlavors().get(0).name.equals('zhongyou'))
}
if (variant.buildType.name.endsWith('zhanRuiDebug')) {
variant.setIgnore(variant.getFlavors().get(0).name.equals('official') || variant.getFlavors().get(0).name.equals('zhongyou'))
}
if (name.contains("MTKnewly")) {
variant.setIgnore(variant.buildType.name.endsWith("zhanRuiRelease") || variant.buildType.name.endsWith("zhanRuiDebug") || variant.buildType.name.endsWith("zhanRuiUserdebug")
|| variant.buildType.name.endsWith("zhanRuiUserdebugReleas"))
}
if (name.endsWith("newlyDebug") || name.endsWith("newlyRelease")) {
variant.setIgnore(!name.contains("MTK"))
}
// // Icon recents is Go only
// if (name.contains("WithQuickstepIconRecents") && !name.contains("l3go")) {
// variant.setIgnore(true)
// }
}
buildTypes {
zhanRuiRelease.initWith(release)
zhanRuiRelease {
manifestPlaceholders = [
AMAP_KEY: "6e339305206eeb43f2b4cc1f31751f89"
]
buildConfigField "String", "platform", '"ZhanRui"'
signingConfig signingConfigs.zhanRui
}
zhanRuiDebug.initWith(debug)
zhanRuiDebug {
manifestPlaceholders = [
AMAP_KEY: "6e339305206eeb43f2b4cc1f31751f89"
]
versionNameSuffix "-debug"
buildConfigField "String", "platform", '"ZhanRui"'
debuggable true
signingConfig signingConfigs.zhanRui
}
//userdebug rom使用这个版本
zhanRuiUserdebug.initWith(zhanRuiDebug)
zhanRuiUserdebug {
manifestPlaceholders = [
AMAP_KEY: "6e339305206eeb43f2b4cc1f31751f89"
]
versionNameSuffix "-debug"
buildConfigField "String", "platform", '"ZhanRui"'
debuggable true
signingConfig signingConfigs.zhanRuiUserdebug
}
zhanRuiUserdebugReleas.initWith(release)
zhanRuiUserdebugReleas {
manifestPlaceholders = [
AMAP_KEY: "6e339305206eeb43f2b4cc1f31751f89"
]
buildConfigField "String", "platform", '"ZhanRui"'
debuggable true
signingConfig signingConfigs.zhanRuiUserdebug
}
debug {
buildConfigField "String", "platform", '"MTK"'
manifestPlaceholders = [
AMAP_KEY: "1af68e0a7edcaac82678b1cbb7643408"
]
versionNameSuffix "-debug"
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
//Zipalign优化
zipAlignEnabled true
signingConfig signingConfigs.debug
applicationVariants.all { variant ->
variant.outputs.each { output ->
def outputFile = output.outputFile
if (outputFile != null) {
def fileName = "${appName()}-${variant.versionCode}-V${variant.versionName}-${releaseTime()}-${buildType.name}.apk"
output.outputFileName = fileName
}
}
}
}
release {
buildConfigField "String", "platform", '"MTK"'
manifestPlaceholders = [
AMAP_KEY: "1af68e0a7edcaac82678b1cbb7643408"
]
//混淆
minifyEnabled false
//前一部分代表系统默认的android程序的混淆文件该文件已经包含了基本的混淆声明后一个文件是自己的定义混淆文件
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
//Zipalign优化
zipAlignEnabled true
//签名
signingConfig signingConfigs.release
//将release版本的包名重命名加上版本及日期
applicationVariants.all { variant ->
variant.outputs.each { output ->
def outputFile = ""
if (outputFile != null) {
def fileName = "${appName()}-${variant.versionCode}-V${variant.versionName}-${releaseTime()}-${productFlavors[0].name}-${buildType.name}.apk"
output.outputFileName = fileName
}
}
}
}
}
externalNativeBuild {
cmake {
path file('CMakeLists.txt')
}
}
}
dependencies {
implementation fileTree(dir: "libs", include: ["*.jar"])
compileOnly files('src/main/libs/classes.jar')
implementation 'androidx.appcompat:appcompat:1.3.1'
implementation 'androidx.recyclerview:recyclerview:1.2.1'
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'androidx.multidex:multidex:2.0.1'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
implementation 'androidx.localbroadcastmanager:localbroadcastmanager:1.0.0'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
//BindView
implementation 'com.jakewharton:butterknife:10.1.0'
annotationProcessor 'com.jakewharton:butterknife-compiler:10.1.0'
//OkHttp
implementation 'com.squareup.okhttp3:okhttp:4.9.1'
//Retrofit
implementation 'com.squareup.retrofit2:retrofit:2.9.0'
implementation 'com.squareup.retrofit2:converter-gson:2.9.0'
implementation 'com.squareup.retrofit2:adapter-rxjava2:2.4.0'
//RxJava
implementation 'io.reactivex.rxjava2:rxjava:2.2.12'
implementation 'io.reactivex.rxjava2:rxandroid:2.1.1'
//生命周期管理
implementation 'com.trello.rxlifecycle2:rxlifecycle:2.2.2'
implementation 'com.trello.rxlifecycle2:rxlifecycle-android:2.2.2'
implementation 'com.trello.rxlifecycle2:rxlifecycle-components:2.2.2'
//implementation "com.uber.autodispose:autodispose:1.3.0"
//implementation "com.uber.autodispose:autodispose-android-archcomponents:1.3.0"
//Google
implementation 'com.google.code.gson:gson:2.8.7'
implementation 'com.google.zxing:core:3.3.0'
//fastjson
implementation 'com.alibaba:fastjson:1.2.76'
//极光推送
implementation 'cn.jiguang.sdk:jpush:4.3.0' // 此处以JPush 3.5.6 版本为例。
implementation 'cn.jiguang.sdk:jcore:2.9.0' // 此处以JCore 2.2.8 版本为例。
//高德地图定位
implementation 'com.amap.api:location:5.1.0'
//MMKV
implementation 'com.tencent:mmkv-static:1.2.10'
//RxHttp
implementation 'com.github.liujingxing.rxhttp:rxhttp:2.6.5'
//implementation 'com.squareup.okhttp3:okhttp:4.9.1' //rxhttp v2.2.2版本起需要手动依赖okhttp
annotationProcessor 'com.github.liujingxing.rxhttp:rxhttp-compiler:2.6.5'
//生成RxHttp类纯Java项目请使用annotationProcessor代替kapt
implementation 'com.github.liujingxing.rxlife:rxlife-coroutine:2.1.0' //管理协程生命周期,页面销毁,关闭请求
//rxjava2 (RxJava2/Rxjava3二选一使用asXxx方法时必须)
//implementation 'io.reactivex.rxjava2:rxjava:2.2.8'
//implementation 'io.reactivex.rxjava2:rxandroid:2.1.1'
implementation 'com.github.liujingxing.rxlife:rxlife-rxjava2:2.1.0' //管理RxJava2生命周期页面销毁关闭请求
//工具类
implementation 'com.blankj:utilcodex:1.30.6'
//Aria
implementation 'com.arialyy.aria:core:3.8.15'
annotationProcessor 'com.arialyy.aria:compiler:3.8.15'
//压缩文件解压
implementation 'org.zeroturnaround:zt-zip:1.13'
//更换字体框架
implementation 'uk.co.chrisjenx:calligraphy:2.3.0'
//Java WebSocket
implementation "org.java-websocket:Java-WebSocket:1.4.1"
//状态栏透明
implementation 'com.gitee.zackratos:UltimateBarX:0.7.1'
// // 基础依赖包,必须要依赖
// implementation 'com.gyf.immersionbar:immersionbar:3.0.0'
// // fragment快速实现可选
// implementation 'com.gyf.immersionbar:immersionbar-components:3.0.0'
// // kotlin扩展可选
// implementation 'com.gyf.immersionbar:immersionbar-ktx:3.0.0'
implementation 'pl.droidsonroids.gif:android-gif-drawable:1.2.23'
}
preBuild {
doLast {
def imlFile = file(project.name + ".iml")
println 'Change ' + project.name + '.iml order'
try {
def parsedXml = (new XmlParser()).parse(imlFile)
def jdkNode = parsedXml.component[1].orderEntry.find { it.'@type' == 'jdk' }
parsedXml.component[1].remove(jdkNode)
def sdkString = "Android API " + android.compileSdkVersion.substring("android-".length()) + " Platform"
println 'what' + sdkString
new Node(parsedXml.component[1], 'orderEntry', ['type': 'jdk', 'jdkName': sdkString, 'jdkType': 'Android SDK'])
groovy.xml.XmlUtil.serialize(parsedXml, new FileOutputStream(imlFile))
} catch (FileNotFoundException e) {
// nop, iml not found
println "no iml found"
}
}
//https://www.pianshen.com/article/93481144911/
//https://blog.csdn.net/dhl_1986/article/details/102856026
//使用系统编译后的framework.jar
}