bevy/examples/mobile/Cargo.toml
Niklas Eicker b61397e32b
Reduce android example APK size (#8932)
# Objective

The current mobile example produces an APK of 1.5 Gb.
- Running the example on a real device takes significant time (around
one minute just to copy the file over USB to my phone).
- Default virtual devices in Android studio run out of space after the
first install. This can of course be solved/configured, but it causes
unnecessary friction.
- One impression could be, that Bevy produces bloated APKs. 1.5Gb is
even double the size of debug builds for desktop examples.

## Solution

- Strip the debug symbols of the shared libraries before they are copied
to the APK

APK size after this change: 200Mb
Copy time on my machine: ~8s

## Considered alternative

APKs built in release mode are only 50Mb in size, but require setting up
signing for the profile and compile longer.
2023-07-05 23:21:33 +00:00

31 lines
813 B
TOML

[package]
name = "bevy_mobile_example"
version = "0.1.0"
edition = "2021"
description = "Example for building an iOS or Android app with Bevy"
publish = false
license = "MIT OR Apache-2.0"
[lib]
name = "bevy_mobile_example"
crate-type = ["staticlib", "cdylib"]
[dependencies]
bevy = { path = "../../" }
[package.metadata.android]
package = "org.bevyengine.example"
apk_name = "bevyexample"
assets = "../../assets"
resources = "../../assets/android-res"
# This strips debug symbols from the shared libraries, drastically reducing APK size. If you need them, remove the option.
strip = "strip"
build_targets = ["aarch64-linux-android", "armv7-linux-androideabi"]
[package.metadata.android.sdk]
target_sdk_version = 31
[package.metadata.android.application]
icon = "@mipmap/ic_launcher"
label = "Bevy Example"