EAS cloud build for iOS needs Apple dev ac; PWA support for RN and Expo apps ... etc.
The standard Apple Developer Program costs $99 USD per year (or the equivalent in local currency).
eas build --platform android --profile production
for your Android release builds, even if you've already successfully built locally.Here's why it's a perfectly valid and often advantageous approach:
- Consistency: EAS Build provides a consistent, clean build environment. This reduces "it works on my machine" issues and ensures that your app is built using the same process and dependencies every time, regardless of your local setup.
- No Local Android Setup Required: Just like with iOS, if you didn't want to maintain your local Android SDK, Gradle, and Java environment, EAS handles all of that for you in the cloud.
- Managed Keystore (Optional but Recommended): EAS can securely manage your Android keystore file and credentials. This means you don't need to manually copy your
my-release-key.keystore
file or editgradle.properties
/build.gradle
for every build. You upload it once securely to EAS, and it handles the signing during the cloud build. This is a significant convenience and security benefit.- If you've never used EAS for Android before, it will guide you through setting up your keystore or letting EAS generate and manage one for you.
- CI/CD Integration: EAS Build is designed to integrate seamlessly into Continuous Integration/Continuous Deployment (CI/CD) workflows. You can trigger builds automatically on code pushes to your repository.
- Artifact Management: All your build artifacts (APKs, AABs, logs) are stored in the EAS dashboard, making it easy to track and download past builds.
- Build from
app.json
andeas.json
: When you runeas build
, it primarily relies on yourapp.json
(for basic app config) andeas.json
(for build profiles, e.g.,production
settings for Android). It doesn't require you to have theandroid
folder present locally if you're doing a purely cloud-based build.
How to use it (and what to expect):
When you run eas build --platform android --profile production
:
- EAS CLI will bundle your JS code and assets and upload them to the Expo servers.
- It will look at your
eas.json
for theandroid.production
profile. - If you haven't configured Android signing for EAS yet: It will prompt you about how you want to handle your Android signing key (keystore). You'll typically have options like:
- Let EAS generate a new key for you (simplest, recommended if you don't have an existing one).
- Upload your existing
my-release-key.keystore
file to EAS. - Use a local key (less common for cloud builds, as it defeats some of the convenience).
- Crucially, if you let EAS manage your key, you will no longer need steps 4, 5, and 6 from your local build process.
- The build will be queued on an EAS build machine.
- Upon successful completion, you'll get a link to download the
.apk
or.aab
(Android App Bundle) from the EAS dashboard. AABs are generally preferred for Google Play Store submissions as they result in smaller downloads for users.
Here's the breakdown:
-
APK (Android Package Kit):
- A single, monolithic file that contains all the necessary code, resources, assets (e.g., images for different screen densities like
mdpi
,hdpi
,xhdpi
,xxhdpi
,xxxhdpi
), and native libraries (for different CPU architectures likearmeabi-v7a
,arm64-v8a
,x86
,x86_64
). - When you build an APK locally, it bundles everything to ensure it can run on virtually any Android device. This leads to a larger file size. Your 57MB APK has all these variants bundled within it.
- A single, monolithic file that contains all the necessary code, resources, assets (e.g., images for different screen densities like
-
AAB (Android App Bundle):
- An AAB is a publishing format, not an installation format. It's like a universal container for your app.
- It contains all the different versions of your app's code and resources, but in a structured way that allows the app store (primarily Google Play) to deliver only what's needed for a specific device.
- How it works (App Bundle Delivery):
- You upload the single AAB to Google Play Console.
- When a user downloads your app, Google Play's "Dynamic Delivery" system analyzes the user's device (e.g., screen density, CPU architecture, language).
- Google Play then generates a customized APK specifically for that device, containing only the resources and native code that the device actually needs.
- This customized APK is significantly smaller than a "universal" APK.
-
Why your AAB is 37 MB and your APK is 57 MB:
- The 37 MB AAB contains all the various slices (for different densities, architectures) that, when combined into one APK for all devices, would add up to 57 MB.
- The AAB itself is smaller than a full universal APK because it's optimized for internal storage and parsing by Google Play. It doesn't need to be a fully installable binary. It's more of an archive of components.
In essence, the AAB (37 MB) is a more efficient way to package all your app's variants, allowing the app store to then generate smaller, optimized APKs (which could be, say, 20-30 MB for an individual device) for download.
So, the 37 MB AAB is not directly comparable to the 57 MB APK as an installable file. The 57 MB APK is what a user would download if you provided a single APK that works on all devices, whereas the 37 MB AAB is the source from which Google Play would generate smaller, tailored APKs for users.
Me: I guess I will not be able to test the AAB file by trying to install it on Android emulator or phone?
Gem: You are correct in your guess!
No, you cannot directly test an .aab
(Android App Bundle) file by trying to install it on an Android emulator or a physical phone.
As we discussed, an AAB is a publishing format, not an installable format..apk
file.
How to Test an AAB (if you want to simulate Play Store behavior):
If you want to test the .aab
as it would be delivered by the Play Store, you have two primary options:
-
Google Play Internal Test Track:
- This is the recommended way to test your AAB as close to the real user experience as possible.
- Upload your
.aab
file to the Google Play Console (you'll need a Google Play Developer account for this, which has a one-time $25 fee). - Set up an "Internal Test Track" (or "Internal Testing" as it's now called).
- Add your own Google accounts (and those of your testers) to this track.
- Testers will then download the app from the Play Store (just like a regular user) on their devices.
Google Play will automatically generate and serve the optimized APKs from your AAB to their specific devices. - This allows you to verify that the app behaves correctly when distributed by Google Play, including any optimizations applied by the app bundle.
-
Bundletool (Command Line Tool):
- This is a more technical approach for local testing without uploading to Google Play.
- Google provides a command-line tool called
bundletool
that can take an.aab
file and generate a set of APKs (called "APKs splits" or an "APKs set") that you can then install on a device. - You would use
bundletool build-apks --bundle=your_app.aab --output=your_app.apks
to create an.apks
file (which is actually a ZIP archive). - Then, to install it, you'd use
bundletool install-apks --apks=your_app.apks
.Bundletool will automatically select the correct APKs for your connected device and install them. - This method is more involved but is useful for deep local testing of the AAB output.
bundletool
is used with a "connected device" in its most straightforward install-apks
usage. However, it's more powerful than that.Yes, you absolutely can specify what device type (or more accurately, device configuration) of APKs you want bundletool
to create, and then copy those specific APKs over to a device or emulator based on that configuration, without needing the device connected during the build-apks
step.
Comments
Post a Comment