Expo loading wrong app in production!

Please provide the following:

  1. SDK Version: 33
  2. Platforms(Android/iOS/web/all): all

I am encountering a very weird behaviour, where I have installed in android two apps named “similar-prefix+appname”, and when I open one of them, close and open the other, it will then load the wrong app (the one I previously opened). This also happens if the app crashes (it reloads with the other app).

This is a complete disaster. How do I even go about debugging this?

I don’t know if it’s reloated, but the expo client also gets stuck with the wrong version from time to time, despite restarting the client and “expo start”, only removing application cache resolves it.

Hey @falqondev, can you share the app.json for each project?

Cheers,
Adam

I’ve redacted the slug, just keeping the same naming pattern, if necessary I can pass it privately?

This is the app.json for the app that loads incorrectly(in a build, after opening the second app):

{
  "expo": {
    "name": "APPX",
    "slug": "appxclient",
    "privacy": "unlisted",
    "sdkVersion": "33.0.0",
    "platforms": [
      "ios",
      "android",
      "web"
    ],
    "version": "3.0.0",
    "orientation": "portrait",
    "icon": "./assets/icon.png",
    "loading": {
      "icon": "./assets/icon.png"
    },
    "splash": {
      "backgroundColor": "#fff",
      "resizeMode": "contain",
      "height": "100%",
      "with": "100%",
      "image": "./assets/icons/splash.png"
    },
    "updates": {
      "fallbackToCacheTimeout": 0
    },
    "assetBundlePatterns": [
      "**/*"
    ],
    "ios": {
      "supportsTablet": false,
      "bundleIdentifier": "com.company.appxclient",
      "icon": "./assets/icon.png",
      "infoPlist": {
        "NSCameraUsageDescription": "Use camera for profile pictures"
      }
    },
    "android": {
      "package": "com.company.appxclient",
      "versionCode": 1,
      "permissions": [
        "CAMERA",
        "READ_EXTERNAL_STORAGE",
        "WRITE_EXTERNAL_STORAGE",
        "USE_FINGERPRINT",
        "USE_BIOMETRIC",
        "ACCESS_COARSE_LOCATION",
        "ACCESS_FINE_LOCATION"
      ],
      "config": {
        "googleMaps": {
          "apiKey": "----redacted----"
        }
      }
    }
  }
}

This is the app.json for the app that works fine:

{
  "expo": {
    "name": "APPX2",
    "slug": "appxprovider",
    "privacy": "unlisted",
    "sdkVersion": "33.0.0",
    "platforms": ["ios", "android", "web"],
    "version": "1.0.0",
    "orientation": "portrait",
    "icon": "./assets/icon.png",
    "loading": {
      "icon": "./assets/icon.png"
    },
    "splash": {
      "backgroundColor": "#fff",
      "resizeMode": "contain",
      "height": "100%",
      "with": "100%",
      "image": "./assets/splash.png"
    },
    "updates": {
      "fallbackToCacheTimeout": 0
    },
    "assetBundlePatterns": ["**/*"],
    "ios": {
      "supportsTablet": false,
      "bundleIdentifier": "com.company.appxprovider",
      "icon": "./assets/icon.png",
      "infoPlist": {
        "NSCameraUsageDescription": "Use camera for profile picture"
      }
    },
    "android": {
      "package": "com.company.appxprovider",
      "permissions": [
        "CAMERA",
        "READ_EXTERNAL_STORAGE",
        "WRITE_EXTERNAL_STORAGE",
        "USE_FINGERPRINT",
        "USE_BIOMETRIC"
      ],
      "config": {
        "googleMaps": {
          "apiKey": "---redacted---"
        }
      }
    },
    "hooks": {
      "postPublish": [
        {
          "file": "sentry-expo/upload-sourcemaps",
          "config": {
            "organization": "company",
            "project": "appx",
            "authToken": "---redacted---"
          }
        }
      ]
    }
  }
}

In summary:

  1. Open APPX: opens the correct version
  2. Open APPX2: opens the correct version
  3. Open APPX: opens APPX2
  4. Open APPX2: opens the correct version

I am in the process of upgrading both to SDK 35, hope it solves the issue.

I ran into this issue with the Expo app on the weekend. In the end I had to clear the app’s cache and data before it forgot about the “old” app and started showing what expo start was actually serving. (I did not try clearing just the cache, so not sure if that would have been sufficient.)

I’m not sure how this would be possible on a standalone app, though, unless maybe the code from app1 was bundled when building app2, e.g. because of some caching on your development machine.

Maybe because I ran expo:build:android on both at the same time, using the same bundler instance?

Yes, that would be problematic.

You’ll need to build each one separately (or maybe as two separate users at least, but I’m not sure about this.)

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.