chore: Shrink the Android app size to minimal, release type
This commit is contained in:
parent
21d0943aa4
commit
15d56e8e7e
@ -95,7 +95,12 @@ tauri-plugin-single-instance = { version = "2.0.0", features = ["deep-link"] }
|
|||||||
# Release profile optimizations for minimal binary size
|
# Release profile optimizations for minimal binary size
|
||||||
[profile.release]
|
[profile.release]
|
||||||
opt-level = "z" # Optimize for size
|
opt-level = "z" # Optimize for size
|
||||||
lto = true # Enable Link Time Optimization
|
lto = "fat" # Aggressive Link Time Optimization
|
||||||
strip = true # Strip symbols for smaller binary
|
strip = "symbols" # Strip debug symbols for smaller binary
|
||||||
codegen-units = 1 # Reduce parallel codegen for better optimization
|
codegen-units = 1 # Reduce parallel codegen for better optimization
|
||||||
panic = "abort" # Don't unwind on panic, saves space
|
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
|
||||||
|
|||||||
@ -38,11 +38,23 @@ android {
|
|||||||
}
|
}
|
||||||
getByName("release") {
|
getByName("release") {
|
||||||
isMinifyEnabled = true
|
isMinifyEnabled = true
|
||||||
|
isShrinkResources = true // Remove unused resources
|
||||||
|
signingConfig = signingConfigs.getByName("release")
|
||||||
proguardFiles(
|
proguardFiles(
|
||||||
*fileTree(".") { include("**/*.pro") }
|
*fileTree(".") { include("**/*.pro") }
|
||||||
.plus(getDefaultProguardFile("proguard-android-optimize.txt"))
|
.plus(getDefaultProguardFile("proguard-android-optimize.txt"))
|
||||||
.toList().toTypedArray()
|
.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 {
|
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 |
@ -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 {
|
fn parse_c_string_u8(buf: &[u8]) -> String {
|
||||||
unsafe { std::ffi::CStr::from_ptr(buf.as_ptr() as *const std::ffi::c_char) }
|
unsafe { std::ffi::CStr::from_ptr(buf.as_ptr() as *const std::ffi::c_char) }
|
||||||
.to_str()
|
.to_str()
|
||||||
|
|||||||
@ -14,7 +14,10 @@ use tokio::sync::Mutex;
|
|||||||
|
|
||||||
#[cfg_attr(mobile, tauri::mobile_entry_point)]
|
#[cfg_attr(mobile, tauri::mobile_entry_point)]
|
||||||
pub fn run() {
|
pub fn run() {
|
||||||
|
#[cfg(desktop)]
|
||||||
let mut builder = tauri::Builder::default();
|
let mut builder = tauri::Builder::default();
|
||||||
|
#[cfg(mobile)]
|
||||||
|
let builder = tauri::Builder::default();
|
||||||
#[cfg(desktop)]
|
#[cfg(desktop)]
|
||||||
{
|
{
|
||||||
builder = builder.plugin(tauri_plugin_single_instance::init(|_app, argv, _cwd| {
|
builder = builder.plugin(tauri_plugin_single_instance::init(|_app, argv, _cwd| {
|
||||||
|
|||||||
@ -1,4 +1,8 @@
|
|||||||
{
|
{
|
||||||
|
"build": {
|
||||||
|
"devUrl": null,
|
||||||
|
"frontendDist": "../web-app/dist"
|
||||||
|
},
|
||||||
"app": {
|
"app": {
|
||||||
"security": {
|
"security": {
|
||||||
"capabilities": ["default"]
|
"capabilities": ["default"]
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user