expo: "Could not load app. Can't connect to internet. Please try again" - SDK27-30 w/ ExpoKit
I recently updated to SDK27 (am using ExpoKit), and I’m trying to use the offline JS bundle functionality. I followed the instructions from [here] (https://gist.github.com/janicduplessis/30ec95451733d34ffcf7d5cb27ba0e28), but I keep seeing this screen after rebuilding:

I double-checked that:
- detach-scripts contains both
run-exp.batandrun-exp.sh app/build.graddlecontainsapply from: 'expo.gradle'android/appcontainsexpo.gradle
And now I’m not sure if I did the right thing, but what I’ve done is:
- Since I wasn’t sure what “my manifest” is and the build was asking for it, I created a
shell-app-manifest.jsonin myandroid\app\src\main\assets, with the following content:
{
"android": {
"publishBundlePath": "android/app/src/main/assets/shell-app.bundle",
"publishManifestPath": "android/app/src/main/assets/shell-app-manifest.json"
},
}
But it seemed to be the right move since build completes successfully, can confirm it creates a shell-app.bundle in src/main/assets, and installs on device successfully. But then if I stop wifi and run the app I get the initial blue screen error again.
Is it something that I’m missing?
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Comments: 19 (11 by maintainers)
Wow, thank you so much for the detailed response. That was indeed the case, I hadn’t changed
publishedUrlinMainActivity. Thanks for solving my oversight and teaching me a bit of how the internals work. 😄The way app loading works in rough is:
staticblock inAppConstantsregisters embedded responses, i. e. contents for a sort of a caching proxy, so when the app loader asks for eg.https://exp.host/@sjchmiela/android292it doesn’t need to do a real network request — the response is embedded right here (assets://shell-app-manifest.json).MainActivity#publishedUrl()(eg.exp://exp.host/@sjchmiela/android292is being turned intohttps://exp.host/@sjchmiela/android292byExponentUrls.java)For embedded responses to work, username and app name must match between
MainActivityand the embedded response defined inAppConstants.When you publish an application on account
@newbetteraccount,expo-cliwill register an embedded response for@newbetteraccount/theappand ifMainActivitystill points to@theoriginalaccount/theapp, embedded response won’t be hit. So if the app works in offline mode when publishing from one account and not from the other, make surepublishedUrlreflects the desired change too. 🙂Thanks for the reply! Can confirm it works. Publishing the app with
expo-cli2.4.0 automatically removes the suffix on that line. Running then the release version of the app for the first time on a device on airplane mode correctly loads the JS bundle. Thank you!It’s definitely not the same issue, at least for me. I’ve checked that the bundle gets generated when I run
exp publishand the app still doesn’t start offline. I’ll be able to do more tests in a couple of days, and I’ll try to replicate the behaviour on a new app.