Creating an Android .APK with Rork to install and test your app on an Android phone.
If you are adding third-party libraries or modules that are outside of Expo Go, you need to use a development build. This development build will allow you to test and make changes on a physical phone with access to native modules and libraries that Expo Go doesn’t support.PrerequisitesYou must do this from a desktop/laptop, not the Rork phone app.Create a free account on expo.dev. If you need to signup go to https://expo.dev/signupPrint this out or have it up on another screen, as you will want to do this quickly without leaving the terminal or risk having the Rork sandbox reset, and you will have to start over.Go to your app in Rork and click the brackets icon at the top of the page (next to the preview button) to open the code editor.Next, you should see the code editor. Look at the bottom of the screen and locate the new terminal button.Click the new terminal button to open a terminal screen. Type bun expo install expo-dev-client and hit enter.Once that completes, you should get the following:Next type eas initThis will bring you a prompt that is asking you for your expo.dev account that you created earlier. Enter your email and password for expo.dev. If it asks you if you want to link your project type Y.Next type eas build:configureYou should get a message like this that asks you if you want Expo to run git init. Select Yes by entering Y on your keyboard.Enter the email address that you used for your expo.dev account for the user name and email address.You can just hit the enter key for the commit message.Next, you should be asked to select which platform you want to build for. Select Android.Now we’ll run the command to start building the .APK file. Copy and paste the command below—it’s long and may appear jumbled in the terminal, so cut and paste to ensure accuracy.
Copy
Ask AI
eas build --platform android --profile development
Once this command is entered, it will start the build process on expo.dev. You should get a URL to your Expo dashboard that will show you the build process of your APK file. Depending on how busy the Expo dev servers are, this can take a while.Navigate to the Expo log URL provided in the terminal, which will take you to your Expo dashboard. Once your build is finished, you should see an install button.Click the “Install” button and use your phone to scan the QR code. If you are unable to scan the QR code, you can use the URL at the bottom of the screen to download the APK file. Download the file to your phone, but don’t open or install it yet. The image below is what you should see when clicking on the blue install button shown above.Now we will go back to our Rork code editor screen and select the terminal window called App Preview at the bottom of the screen. You may need to scroll up a bit in the terminal, but you should see a QR code and a menu like the image below.Check whether you’re currently running Expo Go or Development mode. The image above shows Expo Go on the fourth line. If it says “Using Development build,” skip the next step. If it says “Expo Go,” click into the terminal screen and press the S key. This will switch the metro bundler to Development mode (if it doesn’t work, you may need to reinstall the dev client). You should now see that the metro bundler is in Development build mode.On your phone, double-click on the .APK file that you downloaded and install it. If the development server is running, it should start bundling your app and then open it just like using Expo Go. If the development server is not running, you will see the following:Start the development server in Rork and then select Scan QR Code. Scan the QR Code, and that should load your app, and you should be up and running.