Skip to main content

How to Build an Android App with Expo Using eas build --local

 

Developing and deploying an Android app with Expo’s EAS (Expo Application Services) has simplified many aspects of mobile app development. Here’s a step-by-step guide to building an Android app bundle using eas build --local, signing it with a custom keystore, and deploying it to Google Play.

Step 1: Open Your App in Android Studio

  1. Launch Android Studio.
  2. Open your Expo project’s Android directory (e.g., my-todo/android).
  3. Go to Build > Generate Signed Bundle / APK…
  • If this option is grayed out, first click Build Bundle(s) / APK(s) to trigger an initial build. Then the option will become available.

Step 2: Generate a Keystore

  1. In the Generate Signed Bundle / APK dialog, select Android App Bundle and click Next.
  2. Under Key store path, choose Create new….
  3. Complete all required fields for the new keystore form (including passwords and alias).
  4. Click OK to save the keystore, then Next to proceed.
  5. Note the location of the generated keystore file.

Step 3: Configure Google Play Console for App Signing

  1. Log into the Google Play Console and navigate to your app.
  2. Under Setup > App Integrity, click Choose Signing Key.
  3. Choose Use a different key (Do not select Use Google-generated key)
  4. Choose Export and upload a key from Java keystore.
  5. Download the encryption public key and PEPK tool provided by Google.

Step 4: Export the Keystore with the PEPK Tool

Run the following command to generate a .zip file that Google Play Console will use to handle your app’s signing key. Replace foo.keystore, foo, and /path/to/encryption_public_key.pem with your specific file paths and keystore details.

java -jar pepk.jar --keystore=foo.keystore --alias=foo --output=output.zip --include-cert --rsa-aes-encryption --encryption-key-path=/path/to/encryption_public_key.pem
  • When prompted, enter the passwords you set up for the keystore and alias.
  • After successfully entering the passwords, you will get an output.zip file.

Upload this zip file to Google Play Console to finish configuring app signing.

Step 5: Build Your App Locally with EAS

Now that your keystore is configured, you’re ready to use eas build for a locally signed Android App Bundle (AAB).

  • Run the following command in your project root:
eas build -p android --profile production --local
  • When prompted to generate a new Android keystore, select No. Instead, provide the path to the keystore you created in Android Studio.
  • Enter your keystore password, key alias, and key password.

If everything is correct, Expo will create a build file that’s signed with the custom keystore you generated.

Step 6: Verify Your Android Keystore on Expo

You can view the saved Android keystore on your Expo account:

  1. Go to expo.dev.
  2. Navigate to your project, then select Configuration > Credentials > Android keystore.

Step 7: Submit Your App to Google Play Console

To deploy your app, you can use eas submit. For the initial release, manually upload the AAB to Google Play Console. For future updates, you can streamline the process with:

eas submit -p android

With this setup, you now have full control over the signing process using Expo’s EAS and your custom keystore, ensuring smooth updates and consistent builds. Happy deploying!

    Popular posts from this blog

    Xcode and iOS Version Mismatch: Troubleshooting "Incompatible Build Number" Errors

    Have you ever encountered a frustrating error while trying to run your iOS app in Xcode, leaving you scratching your head? A common issue arises when your device's iOS version is too new for the Xcode version you're using. This often manifests as an "incompatible build number" error, and looks like this: DVTDeviceOperation: Encountered a build number "" that is incompatible with DVTBuildVersion. This usually happens when you are testing with beta versions of either iOS or Xcode, and can prevent Xcode from properly compiling your storyboards. Let's explore why this occurs and what you can do to resolve it. Why This Error Occurs The core problem lies in the mismatch between the iOS version on your test device and the Software Development Kit (SDK) supported by your Xcode installation. Xcode uses the SDK to understand how to build and run apps for specific iOS versions. When your device runs a newer iOS version than Xcode anticipates, Xcode mi...

    How to Fix the “Invariant Violation: TurboModuleRegistry.getEnforcing(…): ‘RNCWebView’ Could Not Be Found” Error in React Native

    When working with React Native, especially when integrating additional libraries like react-native-signature-canvas , encountering errors can be frustrating. One such error is: Invariant Violation: TurboModuleRegistry. getEnforcing (...): 'RNCWebView' could not be found This error often occurs when the necessary dependencies for a module are not properly linked or when the environment you’re using doesn’t support the required native modules. Here’s a breakdown of how I encountered and resolved this issue. The Problem I was working on a React Native project where I needed to add the react-native-signature-canvas library to capture user signatures. The installation process seemed straightforward: Installed the package: npm install react-native-signature- canvas 2. Since react-native-signature-canvas depends on react-native-webview , I also installed the WebView package: npm install react- native -webview 3. I navigated to the iOS directory and ran: cd ios pod install Everythi...

    Fixing FirebaseMessagingError: Requested entity was not found.

    If you’re working with Firebase Cloud Messaging (FCM) and encounter the error: FirebaseMessagingError: Requested entity was not found. with the error code: messaging/registration-token-not-registered this means that the FCM registration token is invalid, expired, or unregistered . This issue can prevent push notifications from being delivered to users. ๐Ÿ” Possible Causes & Solutions 1️⃣ Invalid or Expired FCM Token FCM tokens are not permanent and may expire over time. If you’re storing tokens in your database, some might be outdated. ✅ Solution: Remove invalid tokens from your database when sending push notifications. Refresh and store the latest FCM token when the app starts. Example: Automatically Refresh Token firebase. messaging (). onTokenRefresh ( ( newToken ) => { // Send newToken to your backend and update the stored token }); 2️⃣ Token Unregistered on Client Device A token might become unregistered if: The app is uninstalled on the user’s device. ...