Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6f6549d897 | ||
|
|
c10505fc10 |
18
README.md
18
README.md
@@ -9,6 +9,7 @@ Android 应用备份与恢复工具,集成 [restic](https://restic.net/) 实
|
||||
- **并行备份/恢复** — 备份并发数 3(Semaphore(3)),恢复并发数 2(Semaphore(2))
|
||||
- **存档完整性校验** — 备份后自动 zstd/gzip 校验数据归档
|
||||
- **restic 增量去重** — 内建 `librestic.so`(~24MB),支持本地和远端仓库
|
||||
- **构建体积优化** — Release APK 仅 11.8 MB(ProGuard/R8 full mode + shrinkResources + BouncyCastle PQC 移除)
|
||||
- **远程后端** — WebDAV(如 123 云盘)/ SMB 协议,本地临时仓库 + 自动双向同步 + 进度回调
|
||||
- **配置持久化** — 仓库路径、密码、后端参数保存在 `backup_settings.conf`
|
||||
- **快照管理** — 初始化仓库、查看统计、按策略清理旧快照(保留 7 天/4 周/3 月)
|
||||
@@ -98,17 +99,26 @@ ConfigViewModel ResticWrapper
|
||||
- **文件大小限制** — WebDAV 上传 50MB 上限(防止 ByteArray OOM)
|
||||
- **存档完整性校验** — 备份后 zstd/gzip 验证数据归档,校验失败回告
|
||||
|
||||
## 编译
|
||||
## 构建
|
||||
|
||||
### 版本历史
|
||||
|
||||
|-|版本|更新内容|
|
||||
|-|---:|--------|
|
||||
| | v1.3 | 累积快照、AppResult 类型化错误、RootShell Mutex、kotlinx-serialization 迁移 |
|
||||
| | v1.4 | APK 体积优化(ProGuard/R8 + shrinkResources + 依赖裁剪),Release APK 从 25 MB 降至 11.8 MB(-52.8%) |
|
||||
|
||||
### 编译命令
|
||||
|
||||
```bash
|
||||
# Debug APK
|
||||
# Debug APK(不压缩,适合开发调试)
|
||||
./gradlew assembleDebug
|
||||
|
||||
# Release (需配置签名)
|
||||
# Release APK(ProGuard/R8 混淆 + 资源裁剪 + 签名)
|
||||
./gradlew assembleRelease
|
||||
```
|
||||
|
||||
`librestic.so` 需放在 `app/src/main/jniLibs/arm64-v8a/` 目录下,在 `build.gradle` 中禁用 `extractNativeLibs` 前的 `useLegacyPackaging`。
|
||||
> Release 构建需配置 `release.keystore` 签名文件;`librestic.so` 放在 `app/src/main/jniLibs/arm64-v8a/` 下。
|
||||
|
||||
## 使用说明
|
||||
|
||||
|
||||
@@ -26,8 +26,8 @@ android {
|
||||
applicationId "com.example.androidbackupgui"
|
||||
minSdk 24
|
||||
targetSdk 34
|
||||
versionCode 4
|
||||
versionName "1.3"
|
||||
versionCode 5
|
||||
versionName "1.4"
|
||||
}
|
||||
buildFeatures {
|
||||
viewBinding true
|
||||
@@ -48,7 +48,8 @@ android {
|
||||
}
|
||||
buildTypes {
|
||||
release {
|
||||
minifyEnabled false
|
||||
minifyEnabled true
|
||||
shrinkResources true
|
||||
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
||||
if (file("release.keystore").exists()) {
|
||||
signingConfig signingConfigs.release
|
||||
@@ -72,6 +73,13 @@ android {
|
||||
jniLibs {
|
||||
useLegacyPackaging true
|
||||
}
|
||||
resources {
|
||||
excludes += [
|
||||
'org/bouncycastle/pqc/crypto/picnic/lowmcL5.bin.properties',
|
||||
'org/bouncycastle/pqc/crypto/picnic/lowmcL3.bin.properties',
|
||||
'org/bouncycastle/pqc/crypto/picnic/lowmcL1.bin.properties',
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -90,7 +98,10 @@ dependencies {
|
||||
|
||||
// 方案A: jcifs-ng (SMB) + sardine-android (WebDAV) 替代 rclone serve
|
||||
implementation "eu.agno3.jcifs:jcifs-ng:2.1.10"
|
||||
implementation "com.github.thegrizzlylabs:sardine-android:v0.9"
|
||||
implementation("com.github.thegrizzlylabs:sardine-android:v0.9") {
|
||||
exclude group: 'xpp3'
|
||||
exclude group: 'stax'
|
||||
}
|
||||
implementation "org.slf4j:slf4j-android:1.7.36"
|
||||
|
||||
// root shell via libsu (Magisk/KernelSU/APatch)
|
||||
|
||||
52
app/proguard-rules.pro
vendored
52
app/proguard-rules.pro
vendored
@@ -1 +1,51 @@
|
||||
# Add project specific ProGuard rules here.
|
||||
# ProGuard/R8 rules for Android Backup GUI
|
||||
# ==========================================
|
||||
|
||||
# --- kotlinx.serialization ---
|
||||
# Keep @SerialName classes and companion serializer fields
|
||||
-keepattributes *Annotation*, InnerClasses
|
||||
-dontnote kotlinx.serialization.AnnotationsKt
|
||||
-keepclassmembers class kotlinx.serialization.json.** {
|
||||
*** Companion;
|
||||
}
|
||||
-keepclasseswithmembers class kotlinx.serialization.json.** {
|
||||
kotlinx.serialization.KSerializer serializer(...);
|
||||
}
|
||||
-keep,includedescriptorclasses class com.example.androidbackupgui.**$$serializer { *; }
|
||||
-keepclassmembers class com.example.androidbackupgui.** {
|
||||
*** Companion;
|
||||
}
|
||||
-keepclasseswithmembers class com.example.androidbackupgui.** {
|
||||
kotlinx.serialization.KSerializer serializer(...);
|
||||
}
|
||||
|
||||
# --- NanoHTTPD ---
|
||||
# NanoHTTPD (package fi.iki.elonen despite Maven group org.nanohttpd)
|
||||
-keep class fi.iki.elonen.** { *; }
|
||||
|
||||
# --- RemoteTransport (WebDAV/SMB) ---
|
||||
-keep class com.example.androidbackupgui.backup.RemoteTransport { *; }
|
||||
|
||||
# --- Data classes (serialization) ---
|
||||
-keep class com.example.androidbackupgui.backup.ResticProgress { *; }
|
||||
-keep class com.example.androidbackupgui.backup.BackupSummary { *; }
|
||||
-keep class com.example.androidbackupgui.backup.ResticSnapshot { *; }
|
||||
-keep class com.example.androidbackupgui.backup.RestoreProgress { *; }
|
||||
-keep class com.example.androidbackupgui.backup.BackupConfig { *; }
|
||||
-keep class com.example.androidbackupgui.backup.AppError { *; }
|
||||
-keep class com.example.androidbackupgui.backup.AppResult { *; }
|
||||
|
||||
|
||||
# --- RemoteTransport implementations ---
|
||||
-keep class com.example.androidbackupgui.backup.SmbTransport { *; }
|
||||
-keep class com.example.androidbackupgui.backup.WebdavTransport { *; }
|
||||
|
||||
# --- WifiManager (called from UI, kept for safety) ---
|
||||
-keep class com.example.androidbackupgui.backup.WifiManager { *; }
|
||||
# --- Keep data models used by kotlinx.serialization ---
|
||||
## Keep all model classes that may be referenced via @Serializable
|
||||
-keep class com.example.androidbackupgui.model.** { *; }
|
||||
|
||||
# --- Keep R classes (referenced by code) ---
|
||||
-keep class com.example.androidbackupgui.R { *; }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user