92 lines
3.8 KiB
Groovy
92 lines
3.8 KiB
Groovy
apply plugin: 'com.android.application'
|
|
|
|
// 发版签名凭证放在 android/keystore.properties(已 gitignore),不进版本库。
|
|
// 缺失时 assembleRelease 会产出未签名包,脚本会拦住并提示补全。
|
|
def keystorePropertiesFile = rootProject.file("keystore.properties")
|
|
def keystoreProperties = new Properties()
|
|
if (keystorePropertiesFile.exists()) {
|
|
keystorePropertiesFile.withInputStream { keystoreProperties.load(it) }
|
|
}
|
|
|
|
android {
|
|
namespace = "com.imyeyu.gao.customer"
|
|
compileSdk = rootProject.ext.compileSdkVersion
|
|
defaultConfig {
|
|
applicationId "com.imyeyu.gao.customer"
|
|
minSdkVersion rootProject.ext.minSdkVersion
|
|
targetSdkVersion rootProject.ext.targetSdkVersion
|
|
versionCode 4
|
|
versionName "1.2.0"
|
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
|
aaptOptions {
|
|
// Files and dirs to omit from the packaged assets dir, modified to accommodate modern web apps.
|
|
// Default: https://android.googlesource.com/platform/frameworks/base/+/282e181b58cf72b6ca770dc7ca5f91f135444502/tools/aapt/AaptAssets.cpp#61
|
|
ignoreAssetsPattern = '!.svn:!.git:!.ds_store:!*.scc:.*:!CVS:!thumbs.db:!picasa.ini:!*~'
|
|
}
|
|
}
|
|
signingConfigs {
|
|
release {
|
|
if (keystorePropertiesFile.exists()) {
|
|
storeFile rootProject.file(keystoreProperties['storeFile'])
|
|
storePassword keystoreProperties['storePassword']
|
|
keyAlias keystoreProperties['keyAlias']
|
|
keyPassword keystoreProperties['keyPassword']
|
|
}
|
|
}
|
|
}
|
|
buildTypes {
|
|
release {
|
|
minifyEnabled false
|
|
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
|
if (keystorePropertiesFile.exists()) {
|
|
signingConfig signingConfigs.release
|
|
}
|
|
}
|
|
}
|
|
// 与 capacitor-android 保持一致,避免 JVM target 不一致的编译告警
|
|
compileOptions {
|
|
sourceCompatibility JavaVersion.VERSION_21
|
|
targetCompatibility JavaVersion.VERSION_21
|
|
}
|
|
}
|
|
|
|
repositories {
|
|
flatDir{
|
|
dirs '../capacitor-cordova-android-plugins/src/main/libs', 'libs'
|
|
}
|
|
}
|
|
|
|
dependencies {
|
|
implementation fileTree(include: ['*.jar'], dir: 'libs')
|
|
implementation "androidx.appcompat:appcompat:$androidxAppCompatVersion"
|
|
implementation "androidx.coordinatorlayout:coordinatorlayout:$androidxCoordinatorLayoutVersion"
|
|
implementation "androidx.core:core-splashscreen:$coreSplashScreenVersion"
|
|
implementation project(':capacitor-android')
|
|
|
|
// 相机管线:扫码与拍照共用,避免 WebView getImageCapture 的差异与掉帧
|
|
implementation "androidx.camera:camera-core:$androidxCameraVersion"
|
|
implementation "androidx.camera:camera-camera2:$androidxCameraVersion"
|
|
implementation "androidx.camera:camera-lifecycle:$androidxCameraVersion"
|
|
implementation "androidx.camera:camera-view:$androidxCameraVersion"
|
|
// 纯 JVM 解码库,不依赖 Google Play 服务
|
|
implementation "com.google.zxing:core:$zxingVersion"
|
|
// 指纹 / 面容解锁
|
|
implementation "androidx.biometric:biometric:$androidxBiometricVersion"
|
|
|
|
testImplementation "junit:junit:$junitVersion"
|
|
androidTestImplementation "androidx.test.ext:junit:$androidxJunitVersion"
|
|
androidTestImplementation "androidx.test.espresso:espresso-core:$androidxEspressoCoreVersion"
|
|
implementation project(':capacitor-cordova-android-plugins')
|
|
}
|
|
|
|
apply from: 'capacitor.build.gradle'
|
|
|
|
try {
|
|
def servicesJSON = file('google-services.json')
|
|
if (servicesJSON.text) {
|
|
apply plugin: 'com.google.gms.google-services'
|
|
}
|
|
} catch(Exception e) {
|
|
logger.info("google-services.json not found, google-services plugin not applied. Push Notifications won't work")
|
|
}
|