-
Notifications
You must be signed in to change notification settings - Fork 52
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Space drawback of this stack #51
Comments
Interesting. Can you try with lto enabled too? I guess the generated ndk-sys crate bindings may be quite large and enabling link time optimizations could help remove unused code. Are there any existing tools that can graph the relationship between the total size and the input crates that can give some more insight here (I'd guess there are but haven't looked at this for a while) |
Oh, the apk presumably also supports multiple architectures too. The libmain.so for each architecture is less than 5Mb. You could perhaps reduce the number of architectures you need to support? |
Just checking the Cargo.toml that you linked from https://github.com/bbqsrc/cargo-ndk/blob/main/example/Cargo.toml I see that the release-space-optimized profile already enables Under 5Mb for the binary doesn't seem that alarming to me. In terms of distribution then maybe you can look at removing some of the targets if you want to minimized the size of a single apk. Maybe also check some of the general advice here in case it's helpful: https://developer.android.com/topic/performance/reduce-apk-size If you e.g plan to distribute something via the Play Store then it looks like the best thing to do there is make sure to build with an app bundle: https://developer.android.com/guide/app-bundle and let Google build your final apks that will be optimized for each individual target that may download from the Play Store. I've not tried building an app bundle with the android-activity examples such as agdk-eframe but you can find some guidance about how Gradle can be used to build an app bundle here: https://developer.android.com/studio/build/building-cmdline#build_bundle and hopefully that will automatically work with the examples too. Btw just as a heads up to let you know. I'm planning on moving all the examples in this repo into a standalone repo here: https://github.com/rust-mobile/rust-android-examples see: #50 (just so hopefully you don't get surprised if you see the examples disappear from here soon) |
I build a release apk of
agdk-eframe
with space optimized profile, it's 27M. Without egui_demo_lib, it's 23M. Without jniLibs, it's 5.2M. The drawback of this stack is rust codes are compiled to all targets and bundled to apk(if distributed as a single apk, not via app store). Any tips for slim apk?The text was updated successfully, but these errors were encountered: