How can I eject Android project only?

Currently, I already have the iOS project been ejected, how can I eject the Android project base on that? I have tried running “expo eject”, but it didn’t work, throwing an error message "ios directory already exists. Please remove it and try again."


Maybe you could try this:

  • Make sure everything is committed in Git so that you can run git reset --hard HEAD to get back to the current state if something goes wrong.
  • Rename the ios directory to ios.real and remove the android directory if there is one.
  • Run expo eject.
  • Remove the new ios directory.
  • Rename the ios.real directory back to ios.
1 Like

Seems a good workaround :grin:, thanks!

@becavalier , @wodin Is there any way to eject android only option.

EDIT: Ignore the stuff below and read Adam’s answer:

I don’t know enough about how everything works to understand the implications of doing that. You could try ejecting and then reverting the Android-specific changes, but it might cause problems.

One thing that comes to mind is that you could have a branch where you eject and a branch where you don’t.
Then you could develop the Android app on the ejected branch and the iOS app on the managed branch. This is far from ideal, though, because you would have to basically copy common changes between branches all the time.

Maybe look into monorepos. I have not tried them before so again I’m unsure of how everything works, but maybe you could essentially have two separate projects for the Android and iOS versions of the app, but you could move the bulk of the code (everything that’s shared) to basically a library that you use from both of the apps.

Yes. Just checked Adam’s answer. Thanks.