Question about "isDetached"

Hi,

I have a question about the “isDetached” setting in app.json.

If an ejected app is built using Android Studio while “isDetached” is set to false in app.json, will the build ignore all the native/java code and just rely on the JS from unejected version?

If an APK is built with “isDetached”: true in Android Studio while the iOS version is built with “isDetached”: false in Expo, will this cause any issues as the setting in app.json will be incorrect for one of these versions?

Hi.

Building the app with Android Studio while the app is not detached does not make any sense.

Before detaching/ejecting you should not even have an android directory.

Android Studio does not build the JavaScript bundle. That is done by the Metro bundler.

What are you trying to accomplish? It sounds like you want to use the managed workflow on iOS, but need some native code for the Android version, so you want to eject only the Android version? I suspect that would not be a supported configuration.

However, I don’t think Android Studio/Xcode cares about app.json at all, so if you did somehow manage to continue to use the managed workflow with the iOS app after ejecting, I think you would want to keep “isDetached” set to false in app.json.

@wodin, I am able to build the iOS app using the managed workflow after ejecting by changing "isDetached" to false in app.json. When I ejected, only the android directory was created as I ejected on a Windows device. If I build this way for iOS and then change "isDetached" to true for building the Android version (and then do expo publish), would this cause any conflict with the iOS version since it was built with "isDetached": false? I have not noticed any issues so far.

As I said, I doubt that is supported, but if it works reliably for you then maybe it’s fine.

I would guess that the “isDetached” setting only makes a difference for the build, because expo needs to know if Android Studio/Xcode is doing the build. After that it probably doesn’t make a difference. But since this way of doing things is unsupported it could break in future.

Wouldn’t it perhaps be better to make separate Android and iOS apps that just happen to share most/all of the code? Then you would avoid any confusion caused by having a half ejected/detached app.

Since one of the main advantages of using Expo is to concurrently create code for both iOS and Android, I think it makes sense for it to work this way.

This feature request seems related to what you are trying to do. You might want to upbote it: