Generate .aab (Android application bundle) from Meteor project
In this post we will be discussing about how we can generate Android application bundle (.aab) from our Meteor Apps.
For this blog, I am using meteor 1.8 and assuming you have android studio already configured on your machine.
First we will build our meteor project.
For building project we use:
meteor build ../output --server=<your-server>
Once the build is completed, we will have the output directory outside our meteor project.
Now we will open Android studio, in the opening dialog box we have to select open an existing project option and load our android studio project from output/android/project.
Once we have android project ready. We might get recommendation to update android Gradle Plugin.
Just go ahead and press the update button and wait till it gets updated.
Once update is finished We have to build project from build menu. Which gives some errors ( refer images below ).
Reason behind this error is updating Gradle plugin ( as we did in earlier steps ).
In newer version they have deprecated ‘<<’ and replaced it with ‘doLast’ operator. So no need to worry just follow the steps here.
https://stackoverflow.com/a/55793096/6318875
After changing code of build.gradle file it will look some thing like this.
Once it’s completed, try to build project once more. For me, Sadly I got the same error from another gradle file which is located somewhere in cordova-plugin-meteor-webapp/<yourapp>-build-extras.gradle.
It might come for you if you are using the same plugin.
If you are not getting error you can skip this step and move forward.
Here We will follow above steps and get rid of the error.
After replacing << with doLast operator we are ready to move and generate aab of the project.
For generating aab bundle of the project Follow these steps:
go to build menu and select option generate signed bundle /APK.
Once Android studio has done building, we will get success message like this.
Now we will be able to find .aab file in our output directory.
This is the file which you can upload to playstore. Congratulations 🤘.
Pat on the back!
Now if you are doing this for the first time and check it out if everything is working fine. You can use Playstore’s internal testing feature.
Go to manage and add your testers who can download and test the app.
Once your update is live, you can start testing your application and prepare for a release.
If you want to generate APK file from your bundle here’s my blog which can be helpful.
We were able to reduce size of our app by 1.5 mb by uploading .aab rather than .apk.
People who are wondering why aab?
Check this out,
https://stackoverflow.com/questions/52059339/difference-between-apk-apk-and-app-bundle-aab