Expo version up procedures

Ats
5 min readMar 9, 2024

--

This is my documents to upgrade Expo for next time I’ll update it again.

Photo by Aleksey Smagin on Unsplash

First of all

I don’t use ESA build because my app started before it became common.

Background

I use Expo for my job to develop a cross-platform native app. In Expo, there are a few major upgrades in a year. Then they drop the one or two oldest SDKs from their support. This is the message from them.

Expo maintains approximately 6 months of backward compatibility. Once an SDK version has been deprecated, you can no longer use it in the Expo Go app. SDK deprecations will not affect the standalone apps you have in production or your development builds, and backwards compatibility for older SDK versions on EAS services tends to be much longer, but not forever.

So I try to follow their supported SDK as much as possible, which means I have to upgrade my app every 4~6 months. Then I decided to make a procedure document to help me do it next time.

What I did

I upgraded my app to SDK 49 this time. I know they have 50 at the latest but I try to use the second latest version if it’s possible because I had many experiences where other packages didn’t work well with the latest version. I think JavaScript packages are changing very fast and many of them can’t catch up to each other. So I usually follow the changes on the core packages from the back after most of them catch up with the changes. So I followed their 49 upgrade document this time.

First of all, I took a look at a glance. I checked if there are breaking changes in Deprecations, renamings, and removals . This time, I upgraded Sentry and changed the Constants.manifest names. Normally, I upgrade packages that have few dependencies to the latest first. Then I check the changelog in GitHub and fix/downgrade if I have issues from the upgrade.

Preparation

I upgraded Sentry using yarn upgrade-interactive — latest , moved to ios directory, and updated Podfile using pod update Sentry/HybridSDK --no-repo-update . I usually check the packages which I need to upgrade with npx pod-install .

ios ❯❯❯ npx pod-install                                                                                                                                                                                           ats/upgrade_expo_49 ✱
..
Command `pod install` failed.
└─ Cause: CocoaPods could not find compatible versions for pod "Sentry/HybridSDK":
In snapshot (Podfile.lock):
Sentry/HybridSDK (= 7.31.5)

In Podfile:
RNSentry (from `../node_modules/@sentry/react-native`) was resolved to 5.19.1, which depends on
Sentry/HybridSDK (= 8.17.1)


You have either:
* changed the constraints of dependency `Sentry/HybridSDK` inside your development pod `RNSentry`.
You should run `pod update Sentry/HybridSDK` to apply changes you've made.
~/p/m/ios ❯❯❯ pod update Sentry/HybridSDK hermes-engine --no-repo-update                                                                                                                                            ✘ 1 ats/upgrade_expo_49 ✱
...
Pod install took 71 [s] to run
Integrating client project
expo_patch_react_imports! took 0.369 seconds to transform files.
Pod installation complete! There are 75 dependencies from the Podfile and 87 total pods installed.

Expo upgrade

From here, I followed Upgrading your app in the upgrade document.

  1. Changed expo from 48 to 49 in package.json and ran yarn.
  2. Ran npx expo install --fix to upgrade all related packages
  3. Ran npx expo-doctor@latest to check for any possible issues in your project dependencies
  4. Ran npx pod-install for iOS

I did these four steps this time. However, there could be more/less depends on the changes.

Update react-native diffs

I usually upgrade the diff of the files which react-native builds automatically. I’m not 100% sure it’s necessary but I had some experiences where that solved upgrade building issues. I use the helper tool to see the diffs between the old react-native and the new one.

So expo 48 has 0.71.8 react-native and expo 49 has 0.72.10. The diffs should be like that.

As I told you, I’m not sure if I need to do but it’s quite helpful to understand what’s changed inside Android/iOS. Once I get errors while building the app, I can come up with some ideas about the causes just by looking at the error logs. So even if I don’t need to do it, I’ll check the diffs for that purpose.

Building app

Keep in mind that if you use ESA build, this is not true in your case.

I started to build iOS first with run expo run:ios. Fortunately, I didn’t get any errors this time.

Then I built Android with run expo run:android. Unfortunately, I got an error this time.

FAILURE: Build failed with an exception.

* What went wrong:
Could not determine the dependencies of task ':app:processDebugResources'.
> Could not resolve all task dependencies for configuration ':app:debugRuntimeClasspath'.
> Could not find any matches for app.notifee:core:+ as no versions of app.notifee:core are available.
Searched in the following locations:
...
Required by:
project :app > project :notifee_react-native

It looked like something with notifee. So I googled it quickly then I found the issue in the notifee repository.

From the conversation, I ran npx expo install expo-build-properties and added the code snippets to the app.json


"plugins": [
[
"expo-build-properties",
{
"android": {
"extraMavenRepos": [
"../../node_modules/@notifee/react-native/android/libs"
]
},
"ios": { }
}
],
"@react-native-firebase/app",
"@react-native-firebase/messaging"
],

Then the error had gone and got another.

FAILURE: Build failed with an exception.

* What went wrong:
Could not determine the dependencies of task ':react-native-wifi-reborn:bundleLibCompileToJarDebug'.
> Could not create task ':react-native-wifi-reborn:compileDebugJavaWithJavac'.
> In order to compile Java 9+ source, please set compileSdkVersion to 30 or above

Seemed like there would be an unmatch between Expo and react-native-wifi-reborn. So I checked the changelog of react-native-wifi-reborn and I found the changes on its compile-SDK version.

So I updated the package above than the change, in this case, I updated it to the latest. Then the error had gone.

Finally, the Android build succeeded as well.

That’s it!

--

--

Ats
Ats

Written by Ats

I like building something tangible like touch, gesture, and voice. Ruby on Rails / React Native / Yocto / Raspberry Pi / Interaction Design / CIID IDP alumni

No responses yet