How to build .APK file to use on your phone locally (expo)
React Native Tutorials

How to build .APK file to use on your phone locally (expo)

In the previous article, we described the process on how to deploy our app to Google playstore using expo. Doing wo, we built .AAB file. In this article, we are going to see how we can generate .APK file to install app locally on our phone.

Building an APK file using Expo

To build an APK file to run on your phone, you need to copy/paste following lines of code in eas.json file. Make sure to save the previously generated code, as we will need that for .AAB file.

{
  "build": {
    "preview": {
      "android": {
        "buildType": "apk"
      }
    },
    "preview2": {
      "android": {
        "gradleCommand": ":app:assembleRelease"
      }
    },
    "preview3": {
      "developmentClient": true
    },
    "production": {}
  }
}

Next Steps

After you have copied the code in eas.json, go ahead and do the following:

eas login ( provide your expo username / password ) 
eas:build configure ( Select android and press Enter )
eas build --platform android  ( Press Enter )
// Build process will get started and you will get .APK file after that. 
You can now copy the file in your phone, install the app, and do your testing there. 

Conclusion

In this short article, we saw how we can build .APK file to use on our phone locally. It is very straightforward method, which we can use to switch between the two. But we need to save both methods for both types of files.

Leave a Reply

Your email address will not be published. Required fields are marked *