Temporary Bare Mode Affect Builds?

I notice that when I do expo run:android it creates the android directory. When I call eas build to run build in the cloud, it now shows “Workflow: Bare” until I delete the android directory at which point it switches back to “Workflow: Managed”.

Does the EAS build in the cloud use anything from this /android directory? Is it important to delete the /android directory before building with EAS?

Hi @tennisbum

expo run:android runs expo prebuild, which is basically the same as ejecting.
Personally I think that expo run:android (or ios) is not something that people should run normally given the way it currently works, because if you’re not sure of what you’re doing or maybe if you’re not that familiar with Git you might end up committing the android and ios directories and other changes and not realise you have switched to the Bare workflow.

I use expo prebuild if I am testing a config plugin. After that I use git status and remove/checkout the new/changed files and run yarn. Of course you should make sure you have everything committed before running expo run:android or expo prebuild for this to work well:

e.g.:

% git status
On branch main
Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git restore <file>..." to discard changes in working directory)
	modified:   .gitignore
	modified:   package.json
	modified:   yarn.lock

Untracked files:
  (use "git add <file>..." to include in what will be committed)
	android/
	index.js
	ios/
	metro.config.js

no changes added to commit (use "git add" and/or "git commit -a")
% rm -rf android index.js ios metro.config.js
% git checkout -- .gitignore package.json yarn.lock
% yarn
[...]
% git status
On branch main
nothing to commit, working tree clean

You can also use git reset --hard and git clean -xdf or something along those lines, but I like to do things a bit more manually and run git diff to make sure there’s nothing I’ve forgotten to commit.

I am pretty sure that if you have an android directory then EAS Build will treat it as a Bare app and expo prebuild will not be run during the build, so e.g. if you change certain things in app.json those changes might not take effect. It would depend on whether your eas.json has cli.requireCommit set to true and whether you have the android/ios directories committed to Git.

Is this hinted to in the docs? That running expo run:android/ios essentially ejects your app and that could carry over to the eas build when you eventually do it. This seems like a big issue especially when builds it’s hard to correct builds because they are taking 40 min for android (at least until monday when they fix that issue) and for newbies who are going into the EAS ecosystem, there are already so many workflow things that need changing, this just seems like one of those things that should be explained clearly. Basically a simple “eas build” reads /android and /ios directories if they are there, so please remove when building on EAS managed workflow. Something like that would go a long way for Expo documentation.

Maybe I’ll make a medium post, like a cheat sheet for devs new to EAS to cover the things I wish someone told me as a solo developer.

Well there’s this:

expo.fyi/prebuild-cleanup

which is linked from here:

I think it would be more user friendly if they did something like a checkout to a temporary location when you run expo run:* instead of polluting the working directory. I’m not sure why they do it the way they do.

1 Like

I guess the one thing I didn’t see in either of those pages is:

“Managed will be treated as “bare” workflow apps if you leave the /android and /ios directories. These directories will be used for EAS build.”

Could have completely missed it somewhere but didn’t see it.

1 Like

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