androidreact-nativeandroid-studioexpo

Expo How to create a development build for android and how to create a .apk file?


Ive been reading the documentation and my build seems to succeed, however there is no apk file created. Im not fully sure if im running the right commands. my eas.json file looks like this:

{
  "cli": {
    "version": ">= 5.7.0"
  },
  "build": {
    "development": {
      "developmentClient": true,
      "distribution": "internal",
      "android": {
        "buildType": "apk"
      }
    },
    "preview": {
      "distribution": "internal",
      "ios": {
        "enterpriseProvisioning": "universal"
      }
    },
    "preview2": {
      "android": {
        "gradleCommand": ":app:assembleRelease"
      }
    },
    "preview3": {
      "developmentClient": true
    },
    "production": {}
  },
  "submit": {
    "production": {}
  }
}

I am using android on a simulator and ios on device. I run the following command:

eas build --profile development --platform android

as the documentation says. What am I doing wrong?


Solution

  • I use EAS as well and i find it quite handy. Let me explain the profiles quickly.

    All profiles can be found in eas.json

    Development

    This type is for developing, it makes it possible to see live reloads, live changes in the application when you change it. You can even pass env. variables if needed.

    eas build --profile development --platform android

    OR

    To make a local build so the Expo Application Service is skipped

    npx expo run:android

        "development": {
          "developmentClient": true,
          "distribution": "internal",
          "env": {
            "API_URL": "X",
          }
    

    Preview

    This creates a .apk file that you can install on your device or emulator. Note the the env. variable does not need to be the same as development

    eas build --profile preview --platform android

        "preview": {
          "distribution": "internal",
          "env": {
            "API_URL": "Y",
          }
        },
    

    Production

    This creates a .aab file which you can upload on to Google Developer Console, if you want to set your app on the app store.

    eas build --profile production --platform android

        "production": {
          "env": {
            "API_URL": "X",
          }
        },
    

    If you do not need the env values, you can safely delete them.

    After executing on of the commands in your terminal, a link should appear to expo.dev where you can download and install your development or preview .apk file