-
Notifications
You must be signed in to change notification settings - Fork 87
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
Realm binary files take a lot of space in apk file, and include binary files for non-target platform. #1670
Comments
➤ PM Bot commented: Jira ticket: RDART-1022 |
@nielsenko do you know if Google Play repackages flutter apps to remove binaries for architectures that don't match the install device? I remember this used to work for .NET apps but I'm not sure if there's anything in Flutter that would prevent this mechanism from working. |
I'm not sure where you get the 161MB from. If I do flutter build apk
Directory: '/Users/kasper/.puro/shared/pub_cache/hosted/pub.dev/realm-2.2.1/android/src/main/cpp/lib'
Realm binaries for 2.2.1 already downloaded
Realm install command finished.
Running Gradle task 'assembleRelease'... 5.6s
✓ Built build/app/outputs/flutter-apk/app-release.apk (36.8MB) If I use flutter build apk --split-per-abi
Directory: '/Users/kasper/.puro/shared/pub_cache/hosted/pub.dev/realm-2.2.1/android/src/main/cpp/lib'
Realm binaries for 2.2.1 already downloaded
Realm install command finished.
Running Gradle task 'assembleRelease'... 7.8s
✓ Built build/app/outputs/flutter-apk/app-armeabi-v7a-release.apk (9.8MB)
✓ Built build/app/outputs/flutter-apk/app-arm64-v8a-release.apk (11.7MB)
✓ Built build/app/outputs/flutter-apk/app-x86_64-release.apk (11.6MB) So less than 12MB in all cases, which includes not just realm, but flutter as well. However. In general you should avoid using When I do that I get: flutter build appbundle
Directory: '/Users/kasper/.puro/shared/pub_cache/hosted/pub.dev/realm-2.2.1/android/src/main/cpp/lib'
Realm binaries for 2.2.1 already downloaded
Realm install command finished.
Running Gradle task 'bundleRelease'... 8.5s
✓ Built build/app/outputs/bundle/release/app-release.aab (36.9MB) but notice that the play store will split this up for you, before the user download the app @zhxst Have you tried opening a bundle retrieved from Google play? |
But this made me notice that we build for |
I know that Play Store will generate smaller apk. |
@zhxst |
@zhxst If you insist on sending a fat-apk then yes an app using realm will currently be 36.8MB+, but that includes flutter itself. But I'm dropping the x86 slice in #1682, so that should strip it down a bit (to ~30MB). |
@nielsenko Thank you for your response. |
What happened?
My previous Flutter app takes about 63 MB in apk release build.
After import Realm, the apk file size become 131 MB, which is double from before.
By unpack the release package. It turns out that Realm include binary files for all the target platform.
By default, flutter only build for
android-arm
,android-arm64
andandroid-x64
. But realm also includeandroid-x86
binary files. Which takes 18.6MB extra space.Here is another example , which only target
android-arm64
when build:So please make realm package follow the
flutter --target-platform
, this will save a lot of space for release build apks.Thank you.
Repro steps
--target-platform
or--split-per-abi
.Version
3.19.5
What Atlas Services are you using?
Local Database only
What type of application is this?
Flutter Application
Client OS and version
macOS 13.6
Code snippets
No response
Stacktrace of the exception/crash you're getting
No response
Relevant log output
No response
The text was updated successfully, but these errors were encountered: