Building standalone expo app locally with Turtle CLI

Rahul Ravindran
2 min readDec 24, 2020

Building standalone expo app locally with Turtle CLI

This should be a short post. One thing I struggled with when building Drone Trails on Android using expo is testing firebase login functionality. Expo provides two ways to do this — one is using google sign in web and the other one is the native experience. Here is the official link suggesting it can only be used in standalone apps. If you are like me and love testing on the expo client itself, it’s a pain when you want to test firebase login. You need to build and upload to expo every single time you want to test your apk.

Around a few days back, I found out you can install turtle locally. The same build tools that expo utilizes. Let’s go through step-by-step process to do this.

Step 1 — Install Turtle

$ npm install -g turtle-cli

This step is super simple. Install turtle cli.

Step 2 — Lock in turtle and expo SDK version

$ turtle setup:android --sdk-version 39.0.0

This step is important to make sure the build version expo is using and the one you use locally is the same. Expo versions bump pretty often, so don’t get caught in the rabbit hole in here.

Step 3 — Fetch keypair from expo

To do this, you need to do expo build at least once. This is because expo generates the keypair for you. Honestly, this is much more easier than having to maintain the keystore locally.

This will generate the keypairs. To fetch the keypairs locally. You can perform this command at the root of your project.

$ expo fetch:android:keystore

This will generate the keystore files locally.

Step 4 — Make it easy with a Makefile recipe

I have the recipe ready for Android, but I think you can make it for iOS just by changing some bits of code. The contents of the Makefile are below. I usually split out the Makefile and the actual script to make it easier to maintain.

You need turtle cli and python3 to do this. This is because we are hosting the server content using that. You will need the following variables

  • KEYSTORE_FILE: path to the file you get when you fetch the keystore details from expo command.
  • USER: You can replace USER with your username or just use the variable as is.
  • KEYSTORE_ALIAS: This value is the one you get from the cli for fetching keystore details.
  • mkdir $(pwd)/local-releases

Once you have all of these variables plug it into the makefile recipe and perform make local-release. You should then have your APK ready in local-releases folder which you can drag to the Android simulator and start testing.

Originally published at https://soupynoodles.dev on December 24, 2020.

--

--

Rahul Ravindran

Software Engineer | Gamer | Soccer | Tennis | Drone Enthusiast | Follow me @ https://soupynoodles.dev