Creating prod IPA/APK with embedded JS bundle when using ExpoKit-Detached

I have a project I started with “create-react-native-app”, and then “detached”. I am using ExpoKit so I can use some of the Expo APIs and also use custom native code.

I use exp start so I can reload my JS during development.

I want to publish my project:

  • I want the APK/IPA files to embed the minified JS so they work offline without ever connecting to the Internet.
  • I do not want to publish my JS using exp publish or host my APK/IPA via Expo.
  • A. How do I avoid sending any of my project data to Expo’s services?
  • B. If I use exp publish or exp build, are my private keys sent to Expo servers? Will any source code (JS, iOS/Android) be uploaded to Expo servers?
  • I am happy to build in Android Studio/Xcode, but want to keep exp start for development.

C. This post mentions that I need to exp publish, then exp build which will then download the JS bundle and embed it. Cant this all be done locally?

D. How does the Xcode/A.Studio build know whether it is a development or production build? E.g. How does the apps behaviour change when loading the JS bundle?

F. Why is the JS bundle always a remote URL? Can it be a file that is packaged with the IPA/APK?

G. Also, if my JS bundle is minified, how can I have error reporting with source maps to get the original file/line in stack traces?

We have something coming in SDK 27 that should make this a lot nicer. I’d recommend waiting for that if at all possible.

When will SDK 27 be released, and how will it differ on the points I asked about?

I also have concerns over the above. Essentially, reading about the expokit seems very straightforward at first, but then it seems a bit confusing when we get into the nuts and bolts of things.

  • How are updates handled? I gather that I manually release my first apk/ipa to the app stores, and then I can push JS only code changes through expo apis.

  • Do push notifications work with expokit?

And all the above concerns about not needing to connect to the internet to have the APK/IPA files work.

I’m also pretty unclear as to why an expo account is necessary for the expo kit.

Thanks for the update @thetc - we are in a similar situation where the inconsistencies of the app version deployed to the store may not be the same as the JS bundle published, or users already using an older version of the app, may receive a JS bundle that requires a later version of the app etc.

Would you mind clarifying what type of tooling is going to be in 27, so that we can start planning for it?

We’re targeting sometime next week for the release of SDK 27. We’ll be adding an xcode / AS hook that will automatically bundle your assets so they are available for offline & first load.

Updates work the same in ExpoKit projects as they do for a standalone project: you can publish a new version of the app for a given SDK and release channel, and any installations of the app will use the new version (given they use that channel and are able to run that SDK version) either as soon as it is available or on the next load depending on how you have configured updates.

Hey @thetc thanks for the prompt reply and update!

I’d like to just sketch out a few quick scenarios and ask you to confirm if my understanding is correct on how bundles/updates work in a detached expokit scenario, and hopefully this can serve as a place for posterity:

  1. User A has the app @ SDK 25 and hasn’t been active lately. I exp-publish some new code and also submit the app for review after upgrading the app to SDK 26. SDK 26 is released to both stores, what will user A receive the next time they open the app (they don’t have auto-updates turned on)? Will their app be broken since I’ve exp-published updated code (say I’m using some new api exposed to JS in 26).

  2. User B is using the app at @ SDK 26. I am iterating on the app and make some js updates and exp-publish them. The next time they log in I assume they will see these new js changes. After another week I make some native code changes and submit a new release to testflight, still at SDK 26. In order for me to test on testflight this new code I have to exp-publish the js updates that the native code changes also required. What does User B get at this point? The latest exp-publish technically contains code that runs on testflight, but would break for a user who does not have this bleeding edge unreleased version.

Do I need to be thinking about release channels more or something. I would love some direction here!

Thanks a lot for helping me understand this.

In scenario 1 the user would not receive the new update. Their application will contact our server and ask for the latest version of your js for iOS & SDK 25, so any publishes on a newer SDK versions will never be fetched.

In scenario 2, if your test flight and production builds are both on the same release channel, all of your users will receive the newer code. However, if you build the test flight version to use a different release channel, you’ll be able to have it run a different version of the js than the one your store build is fetching.

@rob117 Sorry things aren’t clearer with ExpoKit. The additional control you get over the project is a double edged sword and it’s a lot harder to provide guidance that works for everyone.

I can say that Expo push notifications do not currently work in expokit projects, and is on our roadmap, but not for the next cycle. If notifications are a requirement now, you’ll need to use something like OneSignal.

We need the Expo account to authenticate that you are the owner of your project when you publish a new update.

1 Like

@thetc I see, thank you. So, if I plan to use a different push solution - say, codepush - I would still need an expo account? I ask because I’m concerned that if one day expo decides to disappear, that I would be effectively unable to use the ecosystem because an expo account is necessary to get everything started.

@thetc Is it possible to get more details on the labelled points A-G? Thanks!

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