The assets in my Flutter app are about 300 MB in total (lots of media files, which are the essence of the app and can't sensibly be trimmed down).
As I understand it, there are two ways to upload apps to the Play Store:
- An APK file (legacy) containing binaries for all platforms. It looks like APKs are limited to 100 MB.
- An App Bundle (new) which lets the Play Store figure out what bits to deploy where. App Bundles have a limit of 150 MB on what the user actually downloads.
For APKs, the way to work around this limit is APK Expansion Files (often "obb" files), which can be up to 2 GB. I could try to get this to work with Flutter, but the APK delivery method is somewhat deprecated, and has other drawbacks like bloating the install size with unused binaries. So I'd rather not use this approach.
For App Bundles, a similar mechanism exists in the form of Dynamic Asset Delivery. There are three options, depending on when the user will download the asset pack: during installation, right after installation, or on demand. The install-time
option sounds most transparent and simple and is limited to 1 GB, so it would be great for my use case.
Sadly, Flutter does not yet support Dynamic Asset Delivery. Fortunately, when using install-time
delivery, it looks like these assets become available through the regular AssetManager
class provided by the system. At first I thought Flutter might pick them up without having to write any Java/Kotlin code, but no, it uses its own assets mechanism, and there is nothing but a proposal for getting access to the AssetManager
. So I'd have to do some legwork myself to interact with the Java world, but it sounds doable.
To create the bundle in the first place, I followed these steps. Now how do I run the app?
flutter run
produces no errors, but doesn't seem to install the asset bundle, so all my assets are missing during testing. I suspect it builds an APK directly, rather than building an app bundle and then creating an APK from that. And because IntelliJ IDEA also seems to invoke flutter run
or something similar, my debugger and other IDE integration are useless now.
flutter build appbundle
seems to work and spits out an .aab
file. For testing, presumably I could use bundletool to create an APK out of this and install it, but that would be a terrible development experience compared to Flutter's usual sub-second hot reload.
Is this a dead end? Is there another way to deliver an app with large assets through the Play Store? Please note, I'm not interested in external hosting unless it offers free and (near) unlimited traffic, because this is a noncommercial project.
(On the App Store for iOS, the limit seems to be 4 GB, no questions asked. Whot?)