Expo EAS build error on Android Apk

My eas-cli version is eas-cli/3.10.2 darwin-x64 node-v19.8.1

i got an error when i run eas build -p android --profile preview

here is the error code in Prepare credentials phrase

Writing secrets to the project's directory
Injecting signing config into build.gradle
Failed to find 'build.gradle' file for project: /home/expo/workingdir/build/wts_crm_app/android/app.

and this is my eas.json file content

{
  "cli": {
    "version": ">= 2.8.0"
  },
  "build": {
    "preview": {
      "android": {
        "buildType": "apk"
      }
    },
    "preview2": {
      "android": {
        "gradleCommand": ":app:assembleRelease"
      }
    },
    "preview3": {
      "developmentClient": true
    },
    "production": {}
  },
  "submit": {
    "production": {}
  }
}

what i have tried is update the my eas-cli version with npm install -g eas-cli to upgrade my eas-cli version. and i also have ran expo doctor checked and no error occured.

i also tried to prebuild my app with android and ios with no error, i do not have any idea why eas cant find the β€˜build.gradle’ file to create credentials, can someone help me?

I am facing the same issue since 5-6 hours today. Did you find any solution for this?
If you check the step where the build runs the expo-doctor, that shows a lot of issues:

Running "expo doctor"
- Validating global prerequisites versions...
βœ” Validating global prerequisites versions passed
- Checking for incompatible packages...
βœ– Checking for incompatible packages failed
[stderr] Error: Failed to find dependency tree for @unimodules/react-native-adapter: npm exited with non-zero code: 7
- Checking for conflicting global packages in project...
βœ– Checking for conflicting global packages in project failed
- Verifying prebuild support package versions are compatible...
[stderr] Error: Failed to find dependency tree for expo-cli: npm exited with non-zero code: 7
βœ– Verifying prebuild support package versions are compatible failed
- Checking dependency versions for compatibility with the installed Expo SDK...
[stderr] Error: Failed to find dependency tree for @expo/config-plugins: npm exited with non-zero code: 7
βœ– Checking dependency versions for compatibility with the installed Expo SDK failed
Issues:
[stderr] /home/expo/workingdir/build/node_modules/npm/lib/cli.js:35
[stderr]       throw err
[stderr]       ^
[stderr]
[stderr]   TypeError: Class extends value #<Object> is not a constructor or null
[stderr]       at Object.<anonymous> (/home/expo/workingdir/build/node_modules/npm/node_modules/fs-minipass/lib/index.js:136:4)
[stderr]       at Module._compile (node:internal/modules/cjs/loader:1155:14)
[stderr]       at Object.Module._extensions..js (node:internal/modules/cjs/loader:1209:10)
[stderr]       at Module.load (node:internal/modules/cjs/loader:1033:32)
[stderr]       at Function.Module._load (node:internal/modules/cjs/loader:868:12)
[stderr]       at Module.require (node:internal/modules/cjs/loader:1057:19)
[stderr]       at require (node:internal/modules/cjs/helpers:103:18)
[stderr]       at Object.<anonymous> (/home/expo/workingdir/build/node_modules/npm/node_modules/cacache/lib/content/read.js:4:13)
[stderr]       at Module._compile (node:internal/modules/cjs/loader:1155:14)
[stderr]       at Object.Module._extensions..js (node:internal/modules/cjs/loader:1209:10)
Advice:
  β€’ Use npx expo install --check to review and upgrade your dependencies.
- Validating Expo Config...
βœ” Validating Expo Config passed
- Checking package.json for common issues...
βœ” Checking package.json for common issues passed
[stderr] βœ– Found one or more possible issues with the project. See above logs for issues and advice to resolve.
Command "expo doctor" failed.
npx exited with non-zero code: 1

Note that when I run expo-doctor in my local setup, it does not show any error.

Hi @derek112211

Do you have an android directory in your project?

If you do, have you made any changes to the stuff under that directory?

If you do have an android directory, but you have not made any changes to it, then you should delete it or move it out of the way.

Does that help?

Hi @danish-dct

This looks like a different issue.

What version of the Expo SDK do you have installed?

Also, do you have anything mentioning unimodules in your dependencies?

Unimodules are no longer. Check the release notes for version 43 and 44 of the Expo SDK:

Hi @wodin

Based on what you’re saying that it’s a different issue. I mean I’m getting the same error as Derek.
It’s just that I shared the complete logs of expo-doctor while Derek shared the final build failure message.

Also, my dependencies has no mention of unimodules whatsoever.

I’m using version 47.

  expo-env-info 1.0.5 environment info:
    System:
      OS: Linux 5.19 Ubuntu 22.04.1 LTS 22.04.1 LTS (Jammy Jellyfish)
      Shell: 5.1.16 - /bin/bash
    Binaries:
      Node: 16.18.1 - ~/.nvm/versions/node/v16.18.1/bin/node
      Yarn: 1.22.19 - /usr/bin/yarn
      npm: 9.3.1 - ~/Documents/MobileApps/dct/node_modules/.bin/npm
      Watchman: 20230108.221750.0 - /usr/local/bin/watchman
    npmPackages:
      @expo/webpack-config: ^0.17.2 => 0.17.4 
      expo: ~47.0.12 => 47.0.13 
      react: 18.1.0 => 18.1.0 
      react-dom: 18.1.0 => 18.1.0 
      react-native: 0.70.8 => 0.70.8 
      react-native-web: ~0.18.9 => 0.18.10 
    npmGlobalPackages:
      expo-cli: 6.3.2
    Expo Workflow: managed

hmmm… OK can you please post your dependencies and devDependencies from package.json?

i havent any android directory to run eas build

and i also tried to run the following code to make a new android directory but i got the same error

npx expo prebuild --clean
npx expo prebuild
eas build -p android --profile preview

but my expo doctor didn’t find any issues with the project.

is that related to my expo version? because this error just happened recently. i was able to build the app last week

ill share my package.json here for reference

{
  "name": "helloworld",
  "version": "1.0.0",
  "scripts": {
    "start": "expo start --dev-client",
    "android": "expo run:android",
    "ios": "expo run:ios",
    "web": "expo start --web",
    "postinstall": "patch-package"
  },
  "dependencies": {
    "@expo-google-fonts/noto-sans-hk": "^0.2.2",
    "@expo/ngrok": "^4.1.0",
    "@expo/vector-icons": "^13.0.0",
    "@freakycoder/react-native-bounceable": "^1.0.3",
    "@react-native-async-storage/async-storage": "^1.17.11",
    "@react-native-community/slider": "4.2.4",
    "@react-navigation/bottom-tabs": "^6.4.3",
    "@react-navigation/material-top-tabs": "^6.4.0",
    "@react-navigation/native": "^6.0.16",
    "@react-navigation/native-stack": "^6.9.4",
    "axios": "^1.2.1",
    "babel-preset-react-app": "^10.0.1",
    "dayjs": "^1.11.6",
    "deprecated-react-native-prop-types": "^3.0.1",
    "emoji-datasource-apple": "^14.0.0",
    "expo": "~47.0.14",
    "expo-app-loading": "~2.1.0",
    "expo-av": "~13.0.3",
    "expo-device": "~5.0.0",
    "expo-image-picker": "~14.0.2",
    "expo-media-library": "~15.0.0",
    "expo-notifications": "~0.17.0",
    "expo-splash-screen": "~0.17.5",
    "expo-status-bar": "~1.4.2",
    "immutable": "^4.1.0",
    "install": "^0.13.0",
    "npm": "^9.1.3",
    "patch-package": "^6.5.0",
    "postinstall-postinstall": "^2.1.0",
    "pretty-format": "^29.5.0",
    "react": "18.1.0",
    "react-dom": "18.1.0",
    "react-hook-form": "^7.40.0",
    "react-native": "0.70.8",
    "react-native-animatable": "^1.3.3",
    "react-native-animated-spinkit": "^1.5.2",
    "react-native-config": "^1.4.11",
    "react-native-dynamic-search-bar": "^2.0.2",
    "react-native-emoji-selector": "^0.2.0",
    "react-native-extra-dimensions-android": "^1.2.5",
    "react-native-flipper-performance-plugin": "^0.3.1",
    "react-native-gesture-handler": "~2.8.0",
    "react-native-image-viewing": "^0.2.2",
    "react-native-material-menu": "^2.0.0",
    "react-native-modal": "^13.0.1",
    "react-native-pager-view": "6.0.1",
    "react-native-popup-menu": "^0.16.1",
    "react-native-reanimated": "~2.12.0",
    "react-native-safe-area-context": "4.4.1",
    "react-native-screens": "~3.18.0",
    "react-native-spinkit": "^1.5.1",
    "react-native-svg": "13.4.0",
    "react-native-tab-view": "^3.3.2",
    "react-native-textinput-effects": "^0.6.3",
    "react-native-vector-icons": "^9.2.0",
    "react-native-web": "~0.18.7",
    "react-redux": "^8.0.5",
    "redux": "^4.2.0",
    "redux-logger": "^3.0.6",
    "redux-promise-middleware": "^6.1.3",
    "redux-thunk": "^2.4.2",
    "rn-emoji": "^1.0.4",
    "rn-emoji-picker": "^1.1.6",
    "runes": "^0.4.3",
    "socket.io-client": "^4.6.1"
  },
  "devDependencies": {
    "@babel/core": "^7.20.5",
    "react-native-dotenv": "^3.4.6"
  },
  "private": true
}

hi @danish-dct

Still not found any solution on it. Yes. I do have the same issue you have mentioned on the sever log, but i cant find any of it when i run expo doctor locally.

OK, if you did not have an android directory then you should rather not run npx expo prebuild and you should remove the android and ios directories that were generated by prebuild.

I doubt you need this if you have @babel/core as a devDependency.

Are these intentional? They look like they might have been installed accidentally.

As a matter of interest, what are you patching?

It looks like you have three separate Emoji pickers installed. Perhaps you’re only using one of them and can remove the other two?

You might want to check if there are any other unused dependencies you can get rid of.

If I add all of your dependencies to a test app and run npx expo-doctor, I get the following:

% npx expo-doctor
βœ” Validating global prerequisites versions
βœ– Checking for incompatible packages
Error: Failed to find dependency tree for @unimodules/core: npm exited with non-zero code: 7
βœ– Checking for conflicting global packages in project
Error: Failed to find dependency tree for expo-cli: npm exited with non-zero code: 7
βœ– Verifying prebuild support package versions are compatible
Error: Failed to find dependency tree for expo-modules-autolinking: npm exited with non-zero code: 7
βœ– Checking dependency versions for compatibility with the installed Expo SDK
Issues:
  /Users/michael/work/personal/scratch/deps/node_modules/npm/lib/cli.js:35
      throw err
      ^

  TypeError: Class extends value #<Object> is not a constructor or null
      at Object.<anonymous> (/Users/michael/work/personal/scratch/deps/node_modules/npm/node_modules/fs-minipass/lib/index.js:136:4)
      at Module._compile (node:internal/modules/cjs/loader:1191:14)
      at Object.Module._extensions..js (node:internal/modules/cjs/loader:1245:10)
      at Module.load (node:internal/modules/cjs/loader:1069:32)
      at Function.Module._load (node:internal/modules/cjs/loader:904:12)
      at Module.require (node:internal/modules/cjs/loader:1093:19)
      at require (node:internal/modules/cjs/helpers:108:18)
      at Object.<anonymous> (/Users/michael/work/personal/scratch/deps/node_modules/npm/node_modules/cacache/lib/content/read.js:4:13)
      at Module._compile (node:internal/modules/cjs/loader:1191:14)
      at Object.Module._extensions..js (node:internal/modules/cjs/loader:1245:10)
Advice:
  β€’ Use npx expo install --check to review and upgrade your dependencies.
βœ” Validating Expo Config
βœ” Checking package.json for common issues

βœ– Found one or more possible issues with the project. See above logs for issues and advice to resolve.

If I remove babel-preset-react-app, install and npm and re-run npx expo-doctor, I get the following:

% npx expo-doctor
βœ” Validating global prerequisites versions
βœ” Checking for incompatible packages
βœ” Checking for conflicting global packages in project
βœ” Verifying prebuild support package versions are compatible
βœ– Checking dependency versions for compatibility with the installed Expo SDK
Issues:
  Some dependencies are incompatible with the installed expo version:
    @react-native-async-storage/async-storage@1.18.1 - expected version: ~1.17.3
  Your project may not work correctly until you install the correct versions of the packages.
  Install individual packages by running npx expo install @react-native-async-storage/async-storage@~1.17.3
  Found outdated dependencies
Advice:
  β€’ Use npx expo install --check to review and upgrade your dependencies.
βœ” Validating Expo Config
βœ” Checking package.json for common issues

βœ– Found one or more possible issues with the project. See above logs for issues and advice to resolve.

If I then run npx expo install --fix, I get the following:

% npx expo install --fix
Some dependencies are incompatible with the installed expo version:
  @react-native-async-storage/async-storage@1.18.1 - expected version: ~1.17.3
Your project may not work correctly until you install the correct versions of the packages.
Install individual packages by running npx expo install @react-native-async-storage/async-storage@~1.17.3
β€Ί Installing 1 SDK 47.0.0 compatible native module using Yarn
> yarn add @react-native-async-storage/async-storage@~1.17.3
yarn add v1.22.19
[1/4] πŸ”  Resolving packages...
[2/4] 🚚  Fetching packages...
[3/4] πŸ”—  Linking dependencies...
[4/4] πŸ”¨  Building fresh packages...
success Saved lockfile.
success Saved 1 new dependency.
info Direct dependencies
└─ @react-native-async-storage/async-storage@1.17.12
info All dependencies
└─ @react-native-async-storage/async-storage@1.17.12
✨  Done in 7.23s.

And now npx expo-doctor is happy:

% npx expo-doctor
βœ” Validating global prerequisites versions
βœ” Checking for incompatible packages
βœ” Checking for conflicting global packages in project
βœ” Verifying prebuild support package versions are compatible
βœ” Checking dependency versions for compatibility with the installed Expo SDK
βœ” Validating Expo Config
βœ” Checking package.json for common issues

Didn't find any issues with the project!

Looking more closely at your error message it looks like you have npm installed as a local dependency. You should remove it. It should only be installed globally. Not as a dependency of your app.

I don’t have any android or ios folder in my project.

Here you go:

{
  "name": "test",
  "version": "1.0.1",
  "main": "node_modules/expo/AppEntry.js",
  "scripts": {
    "start": "expo start",
    "android": "expo start --android",
    "ios": "expo start --ios",
    "web": "expo start --web"
  },
  "dependencies": {
    "@expo-google-fonts/poppins": "^0.2.2",
    "@expo/webpack-config": "^0.17.2",
    "@react-native-async-storage/async-storage": "~1.17.3",
    "@react-native-community/datetimepicker": "6.5.2",
    "@react-native-community/netinfo": "9.3.5",
    "@react-native-picker/picker": "2.4.8",
    "@react-navigation/bottom-tabs": "^6.5.3",
    "@react-navigation/drawer": "^6.6.0",
    "@react-navigation/native": "^6.1.2",
    "@react-navigation/native-stack": "^6.9.8",
    "@react-navigation/stack": "^6.3.11",
    "@reduxjs/toolkit": "^1.9.1",
    "axios": "^1.2.3",
    "babel-preset-es2015": "^6.24.1",
    "base-64": "^1.0.0",
    "expo": "~47.0.12",
    "expo-build-properties": "~0.4.1",
    "expo-checkbox": "~2.2.2",
    "expo-clipboard": "~4.0.1",
    "expo-file-system": "~15.1.1",
    "expo-font": "~11.0.1",
    "expo-image-picker": "~14.0.2",
    "expo-linear-gradient": "~12.0.1",
    "expo-media-library": "~15.0.0",
    "expo-secure-store": "~12.0.0",
    "expo-splash-screen": "~0.17.5",
    "expo-status-bar": "~1.4.2",
    "expo-system-ui": "~2.0.1",
    "expo-updates": "~0.15.6",
    "formik": "^2.2.9",
    "i": "^0.3.7",
    "i18next": "^22.4.9",
    "nativewind": "^2.0.11",
    "npm": "^9.3.1",
    "react": "18.1.0",
    "react-dom": "18.1.0",
    "react-i18next": "^12.1.4",
    "react-native": "0.70.8",
    "react-native-gesture-handler": "~2.8.0",
    "react-native-modal": "^13.0.1",
    "react-native-picker-select": "^8.0.4",
    "react-native-reanimated": "~2.12.0",
    "react-native-reanimated-carousel": "^3.3.0",
    "react-native-safe-area-context": "4.4.1",
    "react-native-screens": "~3.18.0",
    "react-native-svg": "13.4.0",
    "react-native-web": "~0.18.9",
    "react-native-webview": "11.23.1",
    "react-redux": "^8.0.5",
    "recharts": "^2.3.2",
    "victory-native": "^36.6.8",
    "web3": "^1.8.2",
    "yup": "^0.32.11"
  },
  "devDependencies": {
    "@babel/core": "^7.12.9",
    "babel-plugin-module-resolver": "^5.0.0",
    "react-devtools": "^4.27.1",
    "react-native-svg-transformer": "^1.0.0",
    "tailwindcss": "^3.2.4"
  },
  "private": true
}

When I run npx expo-doctor, it does not show any error. Everything passes:

βœ” Validating global prerequisites versions passed
βœ” Checking for incompatible packages passed
βœ” Checking for conflicting global packages in project passed
βœ” Verifying prebuild support package versions are compatible passed
βœ” Checking dependency versions for compatibility with the installed Expo SDK passed
βœ” Validating Expo Config passed
βœ” Checking package.json for common issues passed

Didn't find any issues with the project!

Yes, I can see npm as dependency but the thing is that it is there as a dependency since 3 months and the build was working fine until 26th April but what changed in EAS server that is failing the build since 27th April?

Yes, removing the local npm fixes the EAS build issue.

I’ve seen a couple of people recently getting expo-doctor warnings that were caused by having this installed. Not sure it’s needed these days.

Did you intend to install this? It looks like it might possibly have been installed accidentally.

I suspect that the latest version of expo-doctor introduced a change that, in conjunction with the local npm dependency caused this problem. And you might be running a slightly older version.

You could try npx expo-doctor@latest to force it to run the latest version.

Or it might be the other way around: It could be that there was a bug in a recent version of expo-doctor that was fixed in the latest version, but it was not yet updated on the build servers.

I just checked and found that I had version 1.0.2, but when I ran npx expo-doctor@latest it installed version 1.0.6.

Either way, you should not have npm installed as a local dependency.

EDIT: I have just discovered that the version of the expo package also affects this. It seems that expo-doctor does not crash if the app is using Expo SDK 48. So the expo-doctor bug is somehow affected by the expo version. But as I said above, you should remove npm as a dependency anyway.

1 Like

Thanks for your help and advice. i think my issue also related to the npm dependency, i removed the npm and fixed the EAS build issue

1 Like