Skip to main content

πŸ€– Android Deployment

This guide will walk you through the process of building and submitting your Shipnative application to the Google Play Store. Shipnative leverages Expo Application Services (EAS) to simplify the complexities of Android development and deployment.

Prerequisites

Before you begin, ensure you have:
  • A Google Play Developer account.
  • Java Development Kit (JDK) installed.
  • Android Studio installed (optional, but useful for emulator setup).
  • EAS CLI installed (npm install -g eas-cli).
  • Your app’s Package Name configured (e.g., com.yourcompany.yourapp) during yarn setup.

1. Configure app.json

Ensure your app.json file (located in apps/app/app.json) is correctly configured for Android. Key properties include:
  • expo.name: Your app’s display name.
  • expo.slug: A URL-friendly name for your app.
  • expo.version: Your app’s version string (e.g., β€œ1.0.0”).
  • expo.android.package: Your unique Android package name (e.g., com.yourcompany.yourapp).
  • expo.android.versionCode: Your app’s version code (an integer that must be incremented for each new build).
{
  "expo": {
    "name": "My Shipnative App",
    "slug": "my-shipnative-app",
    "version": "1.0.0",
    "orientation": "portrait",
    "icon": "./assets/icon.png",
    "userInterfaceStyle": "automatic",
    "splash": {
      "image": "./assets/splash.png",
      "resizeMode": "contain",
      "backgroundColor": "#ffffff"
    },
    "assetBundlePatterns": [
      "**/*"
    ],
    "ios": {
      // ... iOS specific configurations
    },
    "android": {
      "adaptiveIcon": {
        "foregroundImage": "./assets/adaptive-icon.png",
        "backgroundColor": "#ffffff"
      },
      "package": "com.yourcompany.yourapp", // IMPORTANT: Your unique package name
      "versionCode": 1 // Increment this for each new build
    },
    "web": {
      // ... Web specific configurations
    },
    "plugins": [
      "expo-router",
      [
        "expo-notifications",
        {
          "icon": "./assets/notification-icon.png",
          "color": "#000000"
        }
      ]
    ],
    "extra": {
      "router": {
        "origin": false
      },
      "eas": {
        "projectId": "YOUR_EAS_PROJECT_ID" // Replace with your EAS Project ID
      }
    }
  }
}
If you ran yarn setup, your package name and other basic Android settings should already be configured.

2. Create an EAS Build Profile

EAS Build uses profiles to define how your app is built. You’ll typically have development, preview, and production profiles. Open eas.json (in your shipnativeapp/ directory) and ensure you have a production profile for Android:
{
  "cli": {
    "version": ">= 3.13.2"
  },
  "build": {
    "development": {
      "developmentClient": true,
      "distribution": "internal",
      "android": {
        "resourceClass": "m-medium"
      }
    },
    "preview": {
      "distribution": "internal",
      "android": {
        "resourceClass": "m-medium"
      }
    },
    "production": {
      "autoIncrement": true,
      "env": {
        "APP_ENV": "production"
      },
      "android": {
        "resourceClass": "m-medium"
      }
    }
  },
  "submit": {
    "production": {
      "android": {
        "serviceAccountKeyPath": "./path/to/your/google-play-service-account.json", // Path to your service account key
        "track": "production" // or "beta", "alpha", "internal"
      }
    }
  }
}
Replace ./path/to/your/google-play-service-account.json with the actual path to your Google Play service account key. This JSON file is required for automated submissions to the Google Play Store.

3. Generate an Android Build

To create a production-ready .aab (Android App Bundle) or .apk file for the Play Store, use the EAS CLI:
cd shipnativeapp
eas build --platform android --profile production
This command will:
  1. Start a new build on EAS servers.
  2. Handle keystore and signing automatically (if configured in EAS).
  3. Produce an .aab file (recommended for Play Store) or .apk file upon successful completion.
You can monitor the build status in your terminal or on the EAS Dashboard.

4. Submit to Google Play Console

Once your build is complete and you have the .aab file, you can submit it to the Google Play Console using EAS Submit:
cd shipnativeapp
eas submit --platform android --latest --profile production
This command will:
  1. Prompt you for your Google Play service account key path (if not already configured in eas.json).
  2. Upload the latest successful production build to the Google Play Console.
  3. Create a new release in the specified track (e.g., production, beta).
Alternatively, you can download the .aab file from the EAS Dashboard and upload it manually through the Google Play Console.

5. Prepare for Review in Google Play Console

After successful submission, log in to the Google Play Console to:
  • Add app listing details (description, screenshots, privacy policy).
  • Configure pricing and distribution.
  • Complete content rating questionnaire.
  • Select the build you just uploaded for release.

Troubleshooting

  • Build Failures: Check the EAS build logs carefully for error messages. Common issues include incorrect package names, missing keystore configurations, or syntax errors in app.json.
  • Submission Errors: Ensure your eas.json submit profile is correctly configured with your service account key and track. Verify that your app version code is incremented for new submissions.
  • Push Notifications: If you’re using push notifications, ensure you’ve configured Firebase Cloud Messaging (FCM) and placed google-services.json correctly, as described in the Push Notifications guide.

Resources