chore: Shrink the Android app size to minimal, release type

This commit is contained in:
Vanalite 2025-09-18 13:35:50 +07:00
parent 21d0943aa4
commit 15d56e8e7e
8 changed files with 27 additions and 2 deletions

View File

@ -95,7 +95,12 @@ tauri-plugin-single-instance = { version = "2.0.0", features = ["deep-link"] }
# Release profile optimizations for minimal binary size
[profile.release]
opt-level = "z" # Optimize for size
lto = true # Enable Link Time Optimization
strip = true # Strip symbols for smaller binary
lto = "fat" # Aggressive Link Time Optimization
strip = "symbols" # Strip debug symbols for smaller binary
codegen-units = 1 # Reduce parallel codegen for better optimization
panic = "abort" # Don't unwind on panic, saves space
overflow-checks = false # Disable overflow checks for size
debug = false # No debug info
debug-assertions = false # No debug assertions
incremental = false # Disable incremental compilation for release
rpath = false # Don't include rpath

View File

@ -38,11 +38,23 @@ android {
}
getByName("release") {
isMinifyEnabled = true
isShrinkResources = true // Remove unused resources
signingConfig = signingConfigs.getByName("release")
proguardFiles(
*fileTree(".") { include("**/*.pro") }
.plus(getDefaultProguardFile("proguard-android-optimize.txt"))
.toList().toTypedArray()
)
// Additional size optimizations
packaging {
resources.excludes.addAll(listOf(
"META-INF/LICENSE*",
"META-INF/NOTICE*",
"META-INF/*.RSA",
"META-INF/*.SF",
"META-INF/*.DSA"
))
}
}
}
kotlinOptions {

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 0 B

After

Width:  |  Height:  |  Size: 60 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 23 KiB

View File

@ -45,6 +45,7 @@ pub fn get_vulkan_gpus(lib_path: &str) -> Vec<GpuInfo> {
}
}
#[cfg(not(any(target_os = "android", target_os = "ios")))]
fn parse_c_string_u8(buf: &[u8]) -> String {
unsafe { std::ffi::CStr::from_ptr(buf.as_ptr() as *const std::ffi::c_char) }
.to_str()

View File

@ -14,7 +14,10 @@ use tokio::sync::Mutex;
#[cfg_attr(mobile, tauri::mobile_entry_point)]
pub fn run() {
#[cfg(desktop)]
let mut builder = tauri::Builder::default();
#[cfg(mobile)]
let builder = tauri::Builder::default();
#[cfg(desktop)]
{
builder = builder.plugin(tauri_plugin_single_instance::init(|_app, argv, _cwd| {

View File

@ -1,4 +1,8 @@
{
"build": {
"devUrl": null,
"frontendDist": "../web-app/dist"
},
"app": {
"security": {
"capabilities": ["default"]