rive-flutter
rive-flutter copied to clipboard
APK size has massively grown when upgrading from 0.9.1 to 0.10.x
My App APK hovers around 70MB
on 0.9.1. With the only change being a move to 0.10.0
, the APK size grows to 185MB
I have the same issue. *.apk, *.aab file size doubled.
Same question. Is there any solution?
0.10.0 adds some groundwork for the upcoming text feature. It should add ~450KB. Sounds like we have a configuration bug. We'll take a look. For now use 0.9.1.
Can anyone confirm if that's the size of the final stripped store APK? The included binaries will definitely need to be compiled for each target arch so a fat binary will be generated that should be stripped, but 70MB sounds far too big.
0.10.0 adds some groundwork for the upcoming text feature. It should add ~450KB. Sounds like we have a configuration bug. We'll take a look. For now use 0.9.1.
Can anyone confirm if that's the size of the final stripped store APK? The included binaries will definitely need to be compiled for each target arch so a fat binary will be generated that should be stripped, but 70MB sounds far too big.
Mine is 70MB
on my disk and 34MB
when in the Play Store. That's with 0.9.1
. Have not attempted to put the 0.10.0
version onto the store out of fear when I saw the 185MB
on my disk
I ran flutter build apk
for our example app and I see the following sizes:
Version | Size |
---|---|
0.9.1 | 18.1MB |
0.10.0 | 21.4MB |
~3.3MB bigger, which is definitely more but nowhere near the increase you're seeing. Our native library is about 450KB but we also now depend on ffi
and plugin_platform_interface
which definitely add some of their own size too.
What build command are you using?
I ran
flutter build apk
for our example app and I see the following sizes:Version Size 0.9.1 18.1MB 0.10.0 21.4MB ~3.3MB bigger, which is definitely more but nowhere near the increase you're seeing. Our native library is about 450KB but we also now depend on
ffi
andplugin_platform_interface
which definitely add some of their own size too.What build command are you using?
flutter build apk
the difference is for sure coming from rive 0.10.0
Literally running the build back to back and only changing pubspec.yaml
for different version of rive results in the massive size difference in APK
I did it just now again: 0.9.1 ==>
Running Gradle task 'assembleRelease'... 227.6s
✓ Built build/app/outputs/flutter-apk/app-release.apk (72.8MB).
0.10.0 ==>
Running Gradle task 'assembleRelease'... 386.9s
✓ Built build/app/outputs/flutter-apk/app-release.apk (190.2MB).
0.9.1 (back down again) ==>
Running Gradle task 'assembleRelease'... 148.4s
✓ Built build/app/outputs/flutter-apk/app-release.apk (72.8MB).
On a related / unrelated note, when building with 0.10.0 I do also get this message, although build otherwise progresses normally:
One or more plugins require a higher Android NDK version.
Fix this issue by adding the following to /android/app/build.gradle:
android {
ndkVersion 25.1.8937393
...
}
this is interesting! taking a look at the apk built from the example app locally in android studio shows that the additional ~3.3MB we see seem to come from 4 versions of the librive_text.so
.
I would be very curious to be able to take a look at the contents of your apk's to see where the additional size is coming from, that might show us where we need to look here.
if you do not mind sharing them, sharing them with [email protected] would be very helpful, (or over discord), but at this point even just a screenshot might be enough to point us in the right direction.
also, is it possible to try updating your ndk version?
this is interesting! taking a look at the apk built from the example app locally in android studio shows that the additional ~3.3MB we see seem to come from 4 versions of the
librive_text.so
.I would be very curious to be able to take a look at the contents of your apk's to see where the additional size is coming from, that might show us where we need to look here.
if you do not mind sharing them, sharing them with [email protected] would be very helpful, (or over discord), but at this point even just a screenshot might be enough to point us in the right direction.
also, is it possible to try updating your ndk version?
Ok I have taken screen shots of the two, hopefully this helps
0.9.1
0.10.0
As for the ndk, that is a whole other can of worms. For some reason it does not want to accept that I have the latest ndk at that level already installed. Id rather not hardcode that version in, so I still have to work on that "issue"

For me, my fat APK size is decreased from 55MB to 17MB when I downgraded from rive 0.10.0
to rive 0.9.1
Something is clearly wrong, we have not been able to reproduce the bloated application size with our sample application, but there must be something else at play here that we are missing.
It also seems that our "raw size" is significantly different to in our sample app for the flutter.so as well, even though the download size is comparable there
Do any of you mind sharing access your source code with our team, I think that might help us find the issue faster as we will hopefully be able to reproduce the size bloating issue then. If this is an option, please reach out to us on [email protected] or on discord (I'm Max @ Rive)
@mjtalbot Actually, I can reproduce the issue with the rive example app, it's ~35MB difference in the example app between 0.9.1 and 0.10.0
FYI, I'm on on the latest Flutter version, are you?
Ofcourse, this is sounds promising... on flutter --version Flutter 3.7.0-15.0.pre
... which version are you on? going to try this with stable and see what results I get
I've just built a the example
app in a clean checkout of the https://github.com/rive-app/rive-flutter
repository using flutter channel beta
& flutter channel stable
and I am not able to reproduce the issue you are seeing
Might there be another difference? I'm running on an intel mac running macOS Ventura 13.2 (a) Beta (22D7750270d)

(also just ran master branch which also gets to about 21.9 MB for me)
I've also just gotten my windows machine building this, it also gets to 21.5MB (its running on the flutter stable channel, 3.3.10)
Ofcourse, this is sounds promising... on
flutter --version Flutter 3.7.0-15.0.pre
... which version are you on? going to try this with stable and see what results I get
I'm on Flutter 3.3.10 • channel stable
also I can reproduce the issue on Codemagic CI, let me try to make it public and share it with you.
@mjtalbot I have messaged you on Discord.
Mine were also on 3.3.10 stable
Could one of you that's getting a large apk send me the .aar generated (after running flutter build apk) in the build/rive_common/outputs/aar folder? You can either attach it here (rename to .zip might work) or email [email protected].
Mine looks like this for the example app:
I grabbed one from the codemagic CI someone shared. These are larger but not as bad as some of the ones posted here.
I suspect this must boil down to Android SDK differences and compilers used. Could @mark8044 @mickyliu945 or anyone getting the huge APKs share their Flutter Doctor output? The android SDK for my Flutter setup is 33.0.0:
Android toolchain - develop for Android devices (Android SDK version 33.0.0)
I grabbed one from the codemagic CI someone shared. These are larger but not as bad as some of the ones posted here.
I suspect this must boil down to Android SDK differences and compilers used. Could @mark8044 @mickyliu945 or anyone getting the huge APKs share their Flutter Doctor output? The android SDK for my Flutter setup is 33.0.0:
Android toolchain - develop for Android devices (Android SDK version 33.0.0)
[✓] Flutter (Channel stable, 3.3.10, on macOS 12.6 21G115 darwin-x64, locale en-US)
• Flutter version 3.3.10 on channel stable at /Users/xx/flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 135454af32 (4 weeks ago), 2022-12-15 07:36:55 -0800
• Engine revision 3316dd8728
• Dart version 2.18.6
• DevTools version 2.15.0
[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.1)
• Android SDK at /Users/xx/Library/Android/sdk
• Platform android-33, build-tools 33.0.1
• Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 11.0.13+0-b1751.21-8125866)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 14.2)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Build 14C18
• CocoaPods version 1.11.2
[✗] Chrome - develop for the web (Cannot find Chrome executable at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome)
! Cannot find Chrome. Try setting CHROME_EXECUTABLE to a Chrome executable.
[✓] Android Studio (version 2021.3)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 11.0.13+0-b1751.21-8125866)
[✓] Connected device (2 available)
[✓] HTTP Host Availability
• All required HTTP hosts are available
! Doctor found issues in 1 category.
I grabbed one from the codemagic CI someone shared. These are larger but not as bad as some of the ones posted here.
I suspect this must boil down to Android SDK differences and compilers used. Could @mark8044 @mickyliu945 or anyone getting the huge APKs share their Flutter Doctor output? The android SDK for my Flutter setup is 33.0.0:
Android toolchain - develop for Android devices (Android SDK version 33.0.0)
@luigi-rosso I have shared my Codemagic CI build with @mjtalbot
My android SDK is 33.0.1
flutter doctor -v
[✓] Flutter (Channel stable, 3.3.10, on macOS 12.5 21G72 darwin-arm, locale en-US)
• Flutter version 3.3.10 on channel stable at xx
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 135454af32 (4 weeks ago), 2022-12-15 07:36:55 -0800
• Engine revision 3316dd8728
• Dart version 2.18.6
• DevTools version 2.15.0
[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.1)
• Android SDK at xx
• Platform android-33, build-tools 33.0.1
• Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 11.0.12+0-b1504.28-7817840)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 14.2)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Build 14C18
• CocoaPods version 1.11.3
[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[✓] Android Studio (version 2021.2)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 11.0.12+0-b1504.28-7817840)
[✓] IntelliJ IDEA Community Edition (version 2022.2.3)
• IntelliJ at /Applications/IntelliJ IDEA CE.app
• Flutter plugin version 71.2.5
• Dart plugin version 222.4345.14
[✓] VS Code (version 1.74.2)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension can be installed from:
🔨 https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter
[✓] Connected device (2 available)
• macOS (desktop) • macos • darwin-arm64 • macOS 12.5 21G72 darwin-arm
• Chrome (web) • chrome • web-javascript • Google Chrome 109.0.5414.87
[✓] HTTP Host Availability
• All required HTTP hosts are available
• No issues found!
The librive_text.so decrease to 2.1M, upgrade ndk to "25.1.8937393"
thank you @tarek360 for the codemagic repro, I've forked your sample & created a codemagic pipeline to repro the issue & I can confirm that updating the NDK fixes the bulk of the size increase, and brings us back to what we are seeing when building our sample project.
& @mickyliu945 I am also able to confirm that upgrading the ndk resolves this size issue. even though I am seeing a smaller librive_text.so size, can you share what the analyze screenshot looks like for yours?
I've forked your sample to https://github.com/mjtalbot/rive-demo, and started building releases on codemagic, the latest (with the fixed sizes is available here https://codemagic.io/app/63c535de9e9846469ee7d5a2/build/63c544b9e94b05b3719f3a5f)
building against 0.9.1 results in 18M 16 Jan 11:55 app-release.code.0.9.x.apk
building against 0.10.1 results in 51M 16 Jan 12:11 app-release.code.0.10.x.apk
updating the build.gradle https://github.com/mjtalbot/rive-demo/blob/main/android/app/build.gradle
to include ndkVersion 25.1.8937393
results in 21M 16 Jan 12:34 app-release.code25.0.10.x.apk
this brings the librive_text.so size to 700-900kb per platform
This may not be related, but could be part of the issue for some of you.
See the hot fixes for the latest Flutter 3.7.3 - https://github.com/flutter/flutter/wiki/Hotfixes-to-the-Stable-Channel
In particular: Asset inclusion regression can cause unexpected app bundle size increase
This may not be related, but could be part of the issue for some of you.
See the hot fixes for the latest Flutter 3.7.3 - https://github.com/flutter/flutter/wiki/Hotfixes-to-the-Stable-Channel
In particular: Asset inclusion regression can cause unexpected app bundle size increase
Unfortunately, still massive APK size with Flutter 3.7.3.
Devs are saying the fix is to set a higher NDK version, but would prefer not to hardcode one in
When integrating Rive in our CI I noticed a huge spike in build times. It turned out that it exceeded the cache limit of our service provider. I dived a bit more into it and noticed Rive's size in pub cache is huge. Is there a reason why this is so huge and how to optimize the size?
Now Rive alone exceeds the cache limits of CI providers and dramatically slowing down our build times. When downgrading to v0.9.1 it is way less.
@millerovv & @remonh87, which ndk version are you targeting? & do you get a warning like the following when you build? (if you have a flutter doctor output that would be helpful)
One or more plugins require a higher Android NDK version.
Fix this issue by adding the following to /android/app/build.gradle:
android {
ndkVersion 25.1.8937393
...
}
That being said I can reproduce the bloated cache size, so taking a look at what is causing this, but it looks like a separate issue to this, so i've filed a ticket for that here
which ndk version are you targeting?
@mjtalbot I also used the same ndkVersion "25.1.8937393" in gradle.build
.
All in all this issue is less critical for our project, compared to 291, since for us size increase is not that "massive", but of course it's still there.
@mjtalbot I can confirm I use the idk mentioned. I agree with splitting the issue 👍