The master now sends COMMAND_UPDATE to Android hosts: it picks a "Build Client -> Android" APK, checks the ZIP magic and that the package carries this master's fingerprint, then sends [cmd][size][APK][xxh64]. The client verifies length and hash, writes filesDir/update.apk and commits a PackageInstaller session, so the system installer still asks the user to confirm - an app cannot replace itself silently. Write and hash failures come back over TOKEN_CLIENT_MSG, so the master sees why nothing happened instead of a silently dropped packet. Sending the wrong file is what the fingerprint check guards against: a template without the master id installs fine and then cannot connect back. "Send anyway" is offered only after spelling that out, and the client advertises CLIENT_CAP_APK_UPDATE (0x0400) so an old APK gets "install a new build once by hand" instead of a packet it would discard. Also report the real versionName/versionCode at login instead of the hardcoded v1.0.0, add android/tools/verify_update_apk.py (pre-send check of size, ZIP_STORED libs, ABI, package, versionCode and the decrypted CONNECT_ADDRESS, which it still locates after BuildDlg rewrote szFlag), and translate the nine new strings in en_US, zh_TW and de_DE. Verified on the emulator and against the live release server: generate, sign, send, install, and the device reconnects and re-grants screen capture. Language packs are GBK and were appended as bytes. Co-Authored-By: deepseek-flash
89 lines
2.2 KiB
Groovy
89 lines
2.2 KiB
Groovy
plugins {
|
||
id 'com.android.application'
|
||
id 'org.jetbrains.kotlin.android'
|
||
}
|
||
|
||
// 模拟器调试时传 -PincludeEmulatorAbis=true;build_apk.sh 发布时强制传 false
|
||
def INCLUDE_EMULATOR_ABIS = project.findProperty('includeEmulatorAbis')?.toBoolean() ?: false
|
||
|
||
android {
|
||
namespace 'com.yama.client'
|
||
compileSdk 35
|
||
ndkVersion "30.0.14904198"
|
||
|
||
defaultConfig {
|
||
applicationId "com.yama.client"
|
||
minSdk 21
|
||
targetSdk 35
|
||
versionCode 2
|
||
versionName "1.1"
|
||
|
||
ndk {
|
||
if (INCLUDE_EMULATOR_ABIS) {
|
||
abiFilters 'arm64-v8a', 'armeabi-v7a', 'x86', 'x86_64'
|
||
} else {
|
||
abiFilters 'arm64-v8a', 'armeabi-v7a'
|
||
}
|
||
}
|
||
|
||
externalNativeBuild {
|
||
cmake {
|
||
cppFlags '-std=c++17'
|
||
arguments '-DANDROID_STL=c++_static'
|
||
}
|
||
}
|
||
}
|
||
|
||
externalNativeBuild {
|
||
cmake {
|
||
path "src/main/cpp/CMakeLists.txt"
|
||
version "3.22.1"
|
||
}
|
||
}
|
||
|
||
buildFeatures {
|
||
// AGP 8 默认不生成 BuildConfig;登录时要把真实版本号/versionCode 上报给服务端
|
||
buildConfig true
|
||
}
|
||
|
||
signingConfigs {
|
||
release {
|
||
storeFile file("../yama-release.jks")
|
||
storePassword System.getenv("YAMA_PWD") ?: ""
|
||
keyAlias 'yama'
|
||
keyPassword System.getenv("YAMA_PWD") ?: ""
|
||
}
|
||
}
|
||
|
||
buildTypes {
|
||
release {
|
||
minifyEnabled true
|
||
shrinkResources true
|
||
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'),
|
||
'proguard-rules.pro'
|
||
signingConfig signingConfigs.release
|
||
}
|
||
}
|
||
|
||
packagingOptions {
|
||
jniLibs {
|
||
// .so 文件不压缩(ZIP_STORED),使服务端 patch 工具可直接在 APK 中搜索 FLAG_GHOST
|
||
useLegacyPackaging false
|
||
}
|
||
}
|
||
|
||
compileOptions {
|
||
sourceCompatibility JavaVersion.VERSION_17
|
||
targetCompatibility JavaVersion.VERSION_17
|
||
}
|
||
|
||
kotlinOptions {
|
||
jvmTarget = '17'
|
||
}
|
||
}
|
||
|
||
dependencies {
|
||
implementation 'androidx.core:core-ktx:1.13.1'
|
||
implementation 'androidx.appcompat:appcompat:1.7.0'
|
||
}
|