Reputation: 1537
My App after installation weighted 12mb when I used good old .apk. I wanted to switch using Android App Bundle so I:
Used
gradlew bundle
to obtain .aab file (weight: 15mb - for comparison .apk was 16 mb)
Used
bundletool build-apks that produced .apks file that weight 80mb!
Used
bundletool install-apks
and installed on my phone but just the clean installation weights 25mb! So instead of weighting less than previous ~16mb after installation - it weights more quite significantly.
I tested that on Moto G5, Android Oreo which (drawables are: xxhdpi)
Did I make something wrong ? Maybe it's a bug coming from bundletool ?
EDIT: When using flag --connected-device in step 2. The generated .apks is way smaller but in the end (step 3) the final storage of my app is still 25/26mb :(
Upvotes: 1
Views: 6371
Reputation: 5003
Google Play’s new app serving model, called Dynamic Delivery, then uses your app bundle to generate and serve optimized APKs for each user’s device configuration, so they download only the code and resources they need to run your app. You no longer have to build, sign, and manage multiple APKs to support different devices, and users get smaller, more optimized downloads.
So as far as I understand it, the AAB might be larger, but when the phone installs the app, Google Play will generate the APK for that specific device, which will be smaller.
For example:
My ABB file is 30MB.
When I installed my app via Google Play, the file size is only 10MB on my phone.
Upvotes: 3
Reputation: 17417
The size reported by Android is the size your app takes on the device: because the platform optimizes the dex file, the size it occupies on the device can be much bigger than the actual size of the file you see on your machine.
And the size reported by Play Console is the download size, which is usually smaller than the file you see on your machine since it is further compressed
Upvotes: 3
Reputation: 791
What I have understood from https://developer.android.com/guide/app-bundle/
Bundle is a new upload format that includes all your app’s compiled code and resources
Google Play’s Dynamic Delivery uses your Android App Bundle to build and serve APKs that are optimized for each device configuration. This results in a smaller app download for end-users by removing unused code and resources needed for other devices.
So basically apk will be build using Dynamic delivery which will combine only necessary resources and will ensure that the build installed on particular design is optimized. There is no mention that bundle size is smaller, but it ensures that download size for end user will be less.
But why should we consider using the Android App Bundle?
First of all, the approach promotes a clean and separated structure to your codebase. Because of the way bundles work (and especially with dynamic delivery, which we’ll come onto later), modularization by feature will become a part of your app. This is similar to the modular approach within Instant apps or general modularize-by-feature approaches. Regardless, this helps to decouple the different parts of your app and help to make your codebase easier to work with.
Where we previously may have been required to build multiple APKs to target different API versions, device types and so on — Android App Bundles means that we can now just upload the single artifact with all of our application resources and the tooling will take care of what needs to be built and delivered to our users. This essentially automates this process for us and means we can shift that focus onto other parts of our development process.
Because the App Bundle will build the APK that is targeted for a specific device and its configuration, this means that the APKs delivered will generally of a smaller size. This will really depend on your application, as the main savings will be from density/locale specific resources and any other unused code. Some of these size savings by early adopters of App Bundles show some great results:
App bundles introduce us to a new concept known as Dynamic Delivery. This allows our applications to provide new features to users and allow them to be downloaded and installed at runtime as an extension to our application. This allows us to make the initial size of our application smaller and offer these extras only to users who may actually make use of them.
And soon, the app bundle format will support instant enable on bundles — this means that users will be able to launch our feature modules instantly without installing our application, similar to the way in which instant apps currently work.
Upvotes: 1