Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to build expo apk using eas build

After updating expo it no longer supports building apk files using expo build:android -t apk and instead advices to using eas builds using the command eas build -p android --profile preview but it ended up building an aab instead of the apk. I took a look at the newly added eas.json file which contained:

{
  "cli": {
    "version": ">= 0.52.0"
  },
  "build": {
    "development": {
      "developmentClient": true,
      "distribution": "internal"
    },
    "preview": {
      "distribution": "internal"
    },
    "production": {}
  },
  "submit": {
    "production": {}
  }
}

I read the eas docs and it adviced on changing my eas.json to:

{
  "cli": {
    "version": ">= 0.52.0"
  },
  "build": {
    "preview": {
      "android": {
        "buildType": "apk"
      }
    },
    "preview2": {
      "android": {
        "gradleCommand": ":app:assembleRelease"
      }
    },
    "preview3": {
      "developmentClient": true
    },
    "production": {}
  }
} 

The after running the build command:eas build -p android --profile preview

It build the app correctly as an apk file and installs on android just fine, but on opening it closes itself instantly. After trying to reopen it again closes and now alerts the app crashed.

Is there an error in my eas.json file or am I miss something?

like image 378
coolDog Avatar asked Sep 02 '25 10:09

coolDog


1 Answers

Change production key in eas.json to this

"production": {
    "android": {
       "buildType": "apk"
    }
}

So now your eas.json like this

{
  "cli": {
    "version": ">= 0.52.0"
  },
  "build": {
    "development": {
      "developmentClient": true,
      "distribution": "internal"
    },
    "preview": {
      "distribution": "internal"
    },
    "production": {
      "android": {
        "buildType": "apk"
      }
    }
  },
  "submit": {
    "production": {}
  }
}

To build into .apk file, you can build using production profile. The command like this eas build --profile production --platform android

like image 137
MyFRA Avatar answered Sep 04 '25 05:09

MyFRA