expo: [SDK48.beta.2] Failing EAS android build, A problem occurred evaluating project ':app'. (No error message when using entrypoint in config)

Summary

I’m getting this error after updating to SDK 48 in eas build for android

Daemon will be stopped at the end of the build
> Task :react-native-gradle-plugin:pluginDescriptors
> Task :react-native-gradle-plugin:processResources
> Task :react-native-gradle-plugin:compileKotlin
> Task :react-native-gradle-plugin:compileJava NO-SOURCE
> Task :react-native-gradle-plugin:classes
> Task :react-native-gradle-plugin:inspectClassesForKotlinIC
> Task :react-native-gradle-plugin:jar
[stderr] FAILURE: Build completed with 2 failures.
[stderr] 1: Task failed with an exception.
[stderr] -----------
[stderr] * Where:
[stderr] Build file '/home/expo/workingdir/build/android/app/build.gradle' line: 23
[stderr] * What went wrong:
[stderr] A problem occurred evaluating project ':app'.
[stderr] > path may not be null or empty string. path=''
[stderr] * Try:
[stderr] > Run with --stacktrace option to get the stack trace.
[stderr] >
[stderr] Run with --info or --debug option to get more log output.
[stderr] > Run with --scan to get full insights.
[stderr] ==============================================================================
[stderr] 2: Task failed with an exception.
[stderr] -----------
[stderr] * What went wrong:
[stderr] A problem occurred configuring project ':app'.
[stderr] > compileSdkVersion is not specified. Please add it to build.gradle
[stderr] * Try:
[stderr] > Run with --stacktrace option to get the stack trace.
[stderr] > Run with --info or --debug option to get more log output.
[stderr] > Run with --scan
[stderr] to get full insights.
[stderr] ==============================================================================
[stderr] * Get more help at https://help.gradle.org
[stderr] BUILD FAILED in 1m 35s
5 actionable tasks: 5 executed
Error: Gradle build failed with unknown error. See logs for the "Run gradlew" phase for more information.

my package.json

{
  "name": "fidelity-client",
  "version": "1.0.0",
  "scripts": {
    "start": "expo start --dev-client",
    "start:mac": "export EXPOENV=mac && expo start --dev-client",
    "android": "expo run:android",
    "ios": "expo run:ios",
    "web": "expo start --web",
    "start:dev": "cross-env EXPODEV=mac && expo start --dev-client",
    "run:ios": "export EXPOENV=mac && expo run:ios",
    "lint": "eslint src --fix",
    "compile": "graphql-codegen",
    "watch": "graphql-codegen -w",
    "download:schema": "yarn apollo service:download --endpoint=http://localhost:3000/graphql"
  },
  "dependencies": {
    "@apollo/client": "^3.7.4",
    "@expo-google-fonts/montserrat": "^0.2.2",
    "@expo/config-plugins": "~6.0.0",
    "@expo/config-types": "^48.0.0",
    "@expo/vector-icons": "^13.0.0",
    "@freakycoder/react-native-helpers": "^2.0.2",
    "@homielab/react-native-auto-scroll": "^0.0.8",
    "@hookform/resolvers": "^2.9.10",
    "@kichiyaki/react-native-barcode-generator": "^0.6.7",
    "@react-native-async-storage/async-storage": "~1.17.3",
    "@react-native-clipboard/clipboard": "^1.11.1",
    "@react-native-community/netinfo": "9.3.7",
    "@react-native-firebase/analytics": "^17.1.0",
    "@react-native-firebase/app": "^17.1.0",
    "@react-native-masked-view/masked-view": "0.2.8",
    "@react-navigation/bottom-tabs": "^6.4.0",
    "@react-navigation/drawer": "^6.5.0",
    "@react-navigation/elements": "^1.3.6",
    "@react-navigation/native": "^6.0.13",
    "@react-navigation/native-stack": "^6.9.2",
    "@react-navigation/stack": "^6.3.3",
    "@reduxjs/toolkit": "^1.9.1",
    "@sentry/react-native": "4.12.0",
    "@twotalltotems/react-native-otp-input": "^1.3.11",
    "add": "^2.0.6",
    "apollo-link-token-refresh": "^0.4.0",
    "apollo3-cache-persist": "^0.14.1",
    "axios": "^1.2.3",
    "date-fns": "^2.29.2",
    "expo": "~48.0.0-beta.2",
    "expo-application": "~5.1.1",
    "expo-asset": "~8.9.0",
    "expo-blur": "~12.2.1",
    "expo-brightness": "~11.2.1",
    "expo-build-properties": "~0.5.1",
    "expo-constants": "~14.2.1",
    "expo-device": "~5.2.1",
    "expo-font": "~11.1.1",
    "expo-linear-gradient": "~12.1.1",
    "expo-linking": "~4.0.1",
    "expo-localization": "^14.1.1",
    "expo-modules-core": "~1.2.1",
    "expo-notifications": "~0.18.1",
    "expo-splash-screen": "~0.18.1",
    "expo-status-bar": "~1.4.4",
    "expo-system-ui": "~2.2.1",
    "expo-updates": "^0.16.1",
    "graphql": "^16.6.0",
    "i18n-js": "^4.1.1",
    "jwt-decode": "^3.1.2",
    "libphonenumber-js": "^1.10.14",
    "moment": "^2.29.4",
    "native-base": "^3.4.25",
    "react": "18.2.0",
    "react-dom": "18.2.0",
    "react-hook-form": "^7.39.1",
    "react-native": "0.71.2",
    "react-native-alert-notification": "^0.3.4",
    "react-native-androw": "^0.0.34",
    "react-native-config": "^1.5.0",
    "react-native-custom-switch": "^1.0.7",
    "react-native-dash-2": "^0.2.3",
    "react-native-element-textinput": "^2.0.1",
    "react-native-emoji": "https://github.com/luluhoc/react-native-emoji.git",
    "react-native-geolocation-service": "^5.3.1",
    "react-native-gesture-handler": "~2.9.0",
    "react-native-haptic-feedback": "^1.14.0",
    "react-native-keyboard-aware-scroll-view": "^0.9.5",
    "react-native-maps": "1.4.0",
    "react-native-mask-input": "^1.2.3",
    "react-native-modal": "^13.0.1",
    "react-native-otp-inputs": "^7.4.0",
    "react-native-pager-view": "6.1.2",
    "react-native-passkit-wallet": "^0.1.6",
    "react-native-qrcode-svg": "^6.2.0",
    "react-native-reanimated": "~2.14.4",
    "react-native-safe-area-context": "4.5.0",
    "react-native-screens": "~3.19.0",
    "react-native-scrollable-tab-view": "https://github.com/luluhoc/react-native-scrollable-tab-view.git",
    "react-native-shadow-2": "^7.0.6",
    "react-native-step-indicator": "^1.0.3",
    "react-native-svg": "13.4.0",
    "react-native-toast-message": "^2.1.5",
    "react-redux": "^8.0.5",
    "redux-persist": "^6.0.0",
    "redux-thunk": "^2.4.2",
    "sentry-expo": "~6.0.0",
    "yup": "^0.32.11",
    "yup-password": "^0.2.2"
  },
  "devDependencies": {
    "@babel/core": "^7.19.3",
    "@graphql-codegen/cli": "^2.16.4",
    "@graphql-codegen/client-preset": "^1.2.6",
    "@types/react": "~18.0.24",
    "@types/react-native-scrollable-tab-view": "^0.10.3",
    "@typescript-eslint/eslint-plugin": "^5.36.2",
    "@typescript-eslint/parser": "^5.36.2",
    "babel-plugin-transform-inline-environment-variables": "^0.4.4",
    "depcheck": "^1.4.3",
    "eslint": "8.2.0",
    "eslint-config-airbnb": "19.0.4",
    "eslint-config-prettier": "^8.5.0",
    "eslint-plugin-import": "2.25.3",
    "eslint-plugin-jsx-a11y": "6.5.1",
    "eslint-plugin-prettier": "^4.2.1",
    "eslint-plugin-react": "7.28.0",
    "eslint-plugin-react-hooks": "4.3.0",
    "eslint-plugin-unused-imports": "^2.0.0",
    "husky": "^8.0.1",
    "lint-staged": "^13.0.3",
    "prettier": "^2.7.1",
    "ts-node": "^10.9.1",
    "typescript": "^4.9.4"
  },
  "private": true
}

What platform(s) does this occur on?

Android

Environment

 expo-env-info 1.0.5 environment info:
    System:
      OS: macOS 13.2
      Shell: 5.8.1 - /bin/zsh
    Binaries:
      Node: 18.12.1 - ~/.nvm/versions/node/v18.12.1/bin/node
      Yarn: 1.22.19 - ~/.yarn/bin/yarn
      npm: 9.1.2 - ~/.nvm/versions/node/v18.12.1/bin/npm
    Managers:
      CocoaPods: 1.11.3 - /opt/homebrew/bin/pod
    SDKs:
      iOS SDK:
        Platforms: DriverKit 22.1, iOS 16.1, macOS 13.0, tvOS 16.1, watchOS 9.1
    IDEs:
      Android Studio: 2021.3 AI-213.7172.25.2113.9014738
      Xcode: 14.1/14B47b - /usr/bin/xcodebuild
    npmPackages:
      expo: ~48.0.0-beta.2 => 48.0.0-beta.2 
      react: 18.2.0 => 18.2.0 
      react-dom: 18.2.0 => 18.2.0 
      react-native: 0.71.2 => 0.71.2 
    npmGlobalPackages:
      eas-cli: 3.5.2
      expo-cli: 6.1.0
    Expo Workflow: bare

Minimal reproducible example

the expo config@5.0.4 is coming from

npm why @expo/config-plugin
s@5.0.4
@expo/config-plugins@5.0.4
node_modules/@react-native-firebase/app/node_modules/@expo/config-plugins
  @expo/config-plugins@"^5.0.4" from @react-native-firebase/app@17.1.0
  node_modules/@react-native-firebase/app
    @react-native-firebase/app@"^17.1.0" from the root project
    peer @react-native-firebase/app@"17.1.0" from @react-native-firebase/analytics@17.1.0
    node_modules/@react-native-firebase/analytics
      @react-native-firebase/analytics@"^17.1.0" from the root project
Running "expo doctor"
- Finding all copies of expo-modules-autolinking
- Finding all copies of @expo/config-plugins
[stderr] [00:59:32] Expected package @expo/config-plugins@~6.0.0
[stderr] [00:59:32] Found invalid:
[stderr] [00:59:32]   @expo/config-plugins@5.0.4
[stderr] [00:59:32]   (for more info, run: npm why @expo/config-plugins)
- Finding all copies of @expo/prebuild-config
- Finding all copies of @unimodules/core
- Finding all copies of @unimodules/react-native-adapter
- Finding all copies of react-native-unimodules
[stderr] [00:59:41] Your project may not work correctly until you install the correct versions of the packages.
[stderr] To install the correct versions of these packages, please run: expo doctor --fix-dependencies,
[stderr] or install individual packages by running expo install [package-name ...]
Command "expo doctor" failed.
bash exited with non-zero code: 1

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Reactions: 1
  • Comments: 44 (7 by maintainers)

Commits related to this issue

Most upvoted comments

Hi! We’re experiencing the same in SDK 48, however, we don’t have any entryPoint in our config. Any ideas on this? We’ve also tracked it down to expo/scripts/resolveAppEntry and that the output of it gets converted to ‘’.

If I run the node -e "require('expo/scripts/resolveAppEntry')" "./" "android" "absolute" in a standalone terminal from my project root, it gives back the correct entrypoint.

Sorry to give bad or misguiding example. What I was trying to say is that I have faced the same issue as the @luluhoc has described in this open issue, to put is shortly:

A problem occurred evaluating project ':app'.
[stderr] > path may not be null or empty string. path=''

I made a clean typescript repo and tried to add piece by piece to check what eventually birthed the above mentioned issue. Adding pnpm, dotenv, zod, testing env variable in app.config.ts > resulted in the following error in my case. If I run node -e "require('expo/scripts/resolveAppEntry')" "./" "android" "absolute" (as @f4z3k4s mentioned) in a standalone terminal from my project root, it gives back the correct entrypoint.

EDIT Can confirm that in my case getting env values straight from process.env and not using const parsed = schema.safeParse(process.env); to access them fixed the issue and build succeeded. No idea why this affected the same issue described here and only in android build.

@fuelkoy Nice finding! I actually have a similar setup here, however we are using envsafe instead of zod to validate the environment variables in app-config.ts. I was getting the exact same issue as described. Everything was working fine on SDK 47 but not on SDK 48. Not using envsafe and using process.env directly fixed the Android build 🤯

However, after a bit more testing, I ended up keeping parts of the envsafe code and realized that it was actually working if I did the following change:

-const version = JSON.parse(readFileSync(join(process.cwd(), 'package.json'), 'utf-8')).version
+const version = JSON.parse(readFileSync(join(__dirname, '../../..', 'package.json'), 'utf-8')).version

Basically, replacing process.cwd() with __dirname and navigating the folder tree up to the root of my Expo App (where app-config.ts lives in my case), fixed it.

@fuelkoy My guess in your case is that you would need to specify the path to dotenv using __dirname. Maybe that would do the trick, as we use dotenv as well, but configure it like so:

dotenv.config({ path: path.join(__dirname, `./.env.${appEnvironment}`) })

My guess as to why people are getting this issue is that EAS runs ./gradlew :app:assembleDebug and it seems that Gradle executes app.config.js|ts with a different working-directory, hence causing process.cwd() to return the wrong path. Using a dependency that relies on process.cwd() might be causing the issue as well.

This is not happening locally in my case, but on EAS remote build.

In this case what can I do (already passing --clear-cache parameter)?

Wasn’t happening on SDK 47.

+1, same error on Android after upgrading to SDK 48. We also do not have entryPoint in our config.

@luluhoc I ran into this same issue and it turned out to be caused by having the deprecated entryPoint field in app.json. Try removing that field if you have it and then see if it works.

This issue has been resolved for me. I missed some path resolutions that needed to be fixed. Thanks to everyone who helped.

I am still facing the issue. The suggested solutions haven’t worked for me.

Sorry to give bad or misguiding example. What I was trying to say is that I have faced the same issue as the @luluhoc has described in this open issue, to put is shortly:

A problem occurred evaluating project ':app'.
[stderr] > path may not be null or empty string. path=''

I made a clean typescript repo and tried to add piece by piece to check what eventually birthed the above mentioned issue. Adding pnpm, dotenv, zod, testing env variable in app.config.ts > resulted in the following error in my case. If I run node -e "require('expo/scripts/resolveAppEntry')" "./" "android" "absolute" (as @f4z3k4s mentioned) in a standalone terminal from my project root, it gives back the correct entrypoint.

EDIT Can confirm that in my case getting env values straight from process.env and not using const parsed = schema.safeParse(process.env); to access them fixed the issue and build succeeded. No idea why this affected the same issue described here and only in android build.

Sorry to give bad or misguiding example. What I was trying to say is that I have faced the same issue as the @luluhoc has described in this open issue, to put is shortly:

A problem occurred evaluating project ':app'.
[stderr] > path may not be null or empty string. path=''

I made a clean typescript repo and tried to add piece by piece to check what eventually birthed the above mentioned issue. Adding pnpm, dotenv, zod, testing env variable in app.config.ts > resulted in the following error in my case. If I run node -e "require('expo/scripts/resolveAppEntry')" "./" "android" "absolute" (as @f4z3k4s mentioned) in a standalone terminal from my project root, it gives back the correct entrypoint. EDIT Can confirm that in my case getting env values straight from process.env and not using const parsed = schema.safeParse(process.env); to access them fixed the issue and build succeeded. No idea why this affected the same issue described here and only in android build.

@fuelkoy Nice finding! I actually have a similar setup here, however we are using envsafe instead of zod to validate the environment variables in app-config.ts. I was getting the exact same issue as described. Everything was working fine on SDK 47 but not on SDK 48. Not using envsafe and using process.env directly fixed the Android build 🤯

However, after a bit more testing, I ended up keeping parts of the envsafe code and realized that it was actually working if I did the following change:

-const version = JSON.parse(readFileSync(join(process.cwd(), 'package.json'), 'utf-8')).version
+const version = JSON.parse(readFileSync(join(__dirname, '../../..', 'package.json'), 'utf-8')).version

Basically, replacing process.cwd() with __dirname and navigating the folder tree up to the root of my Expo App (where app-config.ts lives in my case), fixed it.

@fuelkoy My guess in your case is that you would need to specify the path to dotenv using __dirname. Maybe that would do the trick, as we use dotenv as well, but configure it like so:

dotenv.config({ path: path.join(__dirname, `./.env.${appEnvironment}`) })

My guess as to why people are getting this issue is that EAS runs ./gradlew :app:assembleDebug and it seems that Gradle executes app.config.js|ts with a different working-directory, hence causing process.cwd() to return the wrong path. Using a dependency that relies on process.cwd() might be causing the issue as well.

this is absolutely insane. Debugging level max

@brentvatne I believe the closing of this issue is a mistake.

it sounds like the problem that folks were having here was related to using process.cwd() instead of __dirname

That was this comment, which is hitting the same error message but not related to entryPoint and thus off-topic from the title.

No error message when using entrypoint in config has not been addressed, and probably should be. https://github.com/expo/expo/issues/21172#issuecomment-1426932726:

I think this may still be actionable however – it should emit a useful error message but it doesn’t. The underlying call to node -e require('expo/scripts/resolveAppEntry') .... IIRC gives a useful error but gradle is swallowing it for some reason.

In my case I fix it removing

"main": "index.ts"

from my package.json

@erisvaldojunior Not sure, I just know that that fix doesn’t make much sense in EAS, maybe it works only locally without prebuild.

Any updates from anyone? This is very annoying issue 😣

Ok, I find solution for this problem:

package.json >

...
"react-native": "0.71.4"
...

and add this row to your env file ENTRY_FILE=“./index.js”

Didn’t work for me 🤔 Also expo prebuild will downgrade react native to 0.71.3 anyways 🤔

Ok, I find solution for this problem:

package.json >

...
"react-native": "0.71.4"
...

and add this row to your env file ENTRY_FILE=“./index.js”

@luluhoc Do you use app.config.(ts/js)

I am suspecting we all have a common issue in app.config.(ts/js)

@Nasseratic I’m using app.config.ts. Removing entry point deleting ios, android, .expo, node_modules and rebuilding the project with expo prebuild, and installing all the deps worked for me.