expo: path may not be null or empty string && compileSdkVersion is not specified

Minimal reproducible example

instructions on summary.

Summary

Guys, I detect a problem on newest versions of expo, following the getstarting and don’t changing anything we can simulate the error.

basically we can simulate this only running these two commands: ❯ npx create-expo-app@latest -t expo-template-blank-typescript test-failednpx expo run:android



CMD 1: npx create-expo-app@latest -t expo-template-blank-typescript test-failed

✔ Downloaded and extracted project files.
> npm install
npm WARN deprecated @npmcli/move-file@1.1.2: This functionality has been moved to @npmcli/fs
npm WARN deprecated source-map-url@0.4.1: See https://github.com/lydell/source-map-url#deprecated
npm WARN deprecated urix@0.1.0: Please see https://github.com/lydell/urix#deprecated
npm WARN deprecated resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated
npm WARN deprecated source-map-resolve@0.5.3: See https://github.com/lydell/source-map-resolve#deprecated
npm WARN deprecated uuid@3.4.0: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.
npm WARN deprecated uglify-es@3.3.9: support for ECMAScript is superseded by `uglify-js` as of v3.13.0

added 1222 packages, and audited 1223 packages in 1m

62 packages are looking for funding
  run `npm fund` for details

14 vulnerabilities (9 moderate, 5 high)

To address issues that do not require attention, run:
  npm audit fix

To address all issues (including breaking changes), run:
  npm audit fix --force

Run `npm audit` for details.


✅ Your project is ready!

To run your project, navigate to the directory and run one of the following npm commands.

- cd test-failed
- npm run android
- npm run ios
- npm run web




CMD 2: npx expo run:android

📝  Android package Learn more: https://expo.fyi/android-package

✔ What would you like your Android package name to be? … com.teste.failed

✔ Created native project | gitignore skipped
✔ Added Metro config
✔ Updated package.json and added index.js entry point for iOS and Android
› Removed "main": "node_modules/expo/AppEntry.js" from package.json because we recommend using index.js as main instead

› Installing using npm
> npm install
Using node to generate images. This is much slower than using native packages.
› Optionally you can stop the process and try again after successfully running `npm install -g sharp-cli`.

» android: userInterfaceStyle: Install expo-system-ui in your project to enable this feature.
✔ Config synced
› Building app...
Configuration on demand is an incubating feature.

FAILURE: Build completed with 2 failures.

1: Task failed with an exception.
-----------
* Where:
Build file '/Users/ag/proto/test-failed/android/app/build.gradle' line: 21

* What went wrong:
A problem occurred evaluating project ':app'.
> path may not be null or empty string. path=''

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
==============================================================================

2: Task failed with an exception.
-----------
* What went wrong:
A problem occurred configuring project ':app'.
> compileSdkVersion is not specified. Please add it to build.gradle

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
==============================================================================

* Get more help at https://help.gradle.org

BUILD FAILED in 3s
5 actionable tasks: 4 executed, 1 from cache
Error: /Users/ag/proto/test-failed/android/gradlew exited with non-zero code: 1
Error: /Users/ag/proto/test-failed/android/gradlew exited with non-zero code: 1
    at ChildProcess.completionListener (/Users/ag/proto/test-failed/node_modules/@expo/spawn-async/build/spawnAsync.js:52:23)
    at Object.onceWrapper (node:events:628:26)
    at ChildProcess.emit (node:events:513:28)
    at maybeClose (node:internal/child_process:1091:16)
    at ChildProcess._handle.onexit (node:internal/child_process:302:5)
    ...
    at Object.spawnAsync [as default] (/Users/ag/proto/test-failed/node_modules/@expo/spawn-async/build/spawnAsync.js:17:21)
    at spawnGradleAsync (/Users/ag/proto/test-failed/node_modules/@expo/cli/build/src/start/platforms/android/gradle.js:72:46)
    at Object.assembleAsync (/Users/ag/proto/test-failed/node_modules/@expo/cli/build/src/start/platforms/android/gradle.js:52:18)
    at runAndroidAsync (/Users/ag/proto/test-failed/node_modules/@expo/cli/build/src/run/android/runAndroidAsync.js:31:24)

Environment

expo-env-info 1.0.5 environment info: System: OS: macOS 13.2.1 Shell: 5.8.1 - /bin/zsh Binaries: Node: 18.16.0 - ~/.asdf/installs/nodejs/lts/bin/node Yarn: 1.22.19 - /opt/homebrew/bin/yarn npm: 9.5.1 - ~/.asdf/plugins/nodejs/shims/npm Watchman: 2023.04.24.00 - /opt/homebrew/bin/watchman Managers: CocoaPods: 1.12.1 - /opt/homebrew/bin/pod SDKs: iOS SDK: Platforms: DriverKit 22.4, iOS 16.4, macOS 13.3, tvOS 16.4, watchOS 9.4 IDEs: Android Studio: Electric Eel 2022.1.1 Patch 2 Electric Eel 2022.1.1 Patch 2 Xcode: 14.3/14E222b - /usr/bin/xcodebuild npmPackages: expo: ~48.0.15 => 48.0.16 react: 18.2.0 => 18.2.0 react-dom: 18.2.0 => 18.2.0 react-native: 0.71.8 => 0.71.8 react-native-web: ~0.18.11 => 0.18.12 npmGlobalPackages: eas-cli: 3.12.0 expo-cli: 6.3.7 Expo Workflow: bare

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Reactions: 14
  • Comments: 36 (3 by maintainers)

Most upvoted comments

I got this after upgrading to Expo SDK 49. iOS build was fine. Android not.

I was getting this error:

A problem occurred evaluating settings 'Sally POS'.
> path may not be null or empty string. path='null'

@samipe solution worked for me, all i had to do is change settings.gradle line 10 to:

includeBuild('../node_modules/@react-native/gradle-plugin')

Thanks @samipe !

@tolypash I got the same error when upgrading to Expo SDK 49 but I think your solution is kind of a weird workaround.

I had a look what the issue with the replaced line of code was. I came to this conclusion: You replaced includeBuild(new File(["node", "--print", "require.resolve('react-native-gradle-plugin/package.json')"].execute(null, rootDir).text.trim()).getParentFile()) with includeBuild('../node_modules/@react-native/gradle-plugin'). My take is, that expo wants to use react-native-gradle-plugin instead of the gradle-plugin inside @react-native.

After executing npx expo install react-native-gradle-plugin it worked without replacing code in settings.gradle.

I got this after upgrading to Expo SDK 49. iOS build was fine. Android not.

I was getting this error:

A problem occurred evaluating settings 'project'.
> path may not be null or empty string. path='null'

@samipe solution worked for me, all i had to do is change settings.gradle line 10 to:

includeBuild('../node_modules/@react-native/gradle-plugin')

Thanks @samipe !

Got this fixed by comparing my existing expo (android) files with latest changes in RN template and copying some changes by hunch: https://react-native-community.github.io/upgrade-helper/?from=0.71.8&to=0.72.1

At least in build.gradle classpath('com.android.tools.build:gradle:7.4.1') to classpath('com.android.tools.build:gradle')

and this abomination in settings.gradle includeBuild(new File(["node", "--print", "require.resolve('@react-native/gradle-plugin')"].execute(null, rootDir).text.trim()).getParentFile()) to includeBuild('../node_modules/@react-native/gradle-plugin')

Also this addition in gradlew, maybe it was necessary? No idea what I’m doing APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit

Havent done extensive tests but so far so good with newArchEnabled! 😃

this is happening in bare projects that missed upgrade instructions for the react-native gradle plugin package: https://react-native-community.github.io/upgrade-helper/?from=0.71.0&to=0.72.1#RnDiffApp-android-settings.gradle - the package name changed from react-native-gradle-plugin to @react-native/gradle-plugin.

we use a slightly different version of that diff in android/settings.gradle projects created through create-expo-app/prebuild, in order to support monorepos by default:

includeBuild(new File(["node", "--print", "require.resolve('react-native-gradle-plugin/package.json')"].execute(null, rootDir).text.trim()).getParentFile())

you should change this to:

includeBuild(new File(["node", "--print", "require.resolve('@react-native/gradle-plugin/package.json')"].execute(null, rootDir).text.trim()).getParentFile())

we always recommend reviewing the update helper diff in our upgrade instructions in sdk release notes. if you have any doubt about the changes suggested in upgrade helper diffs, you can refer to a new project on the target sdk version by creating it or looking at the template project on the corresponding sdk branch on github: https://github.com/expo/expo/tree/sdk-49/templates/expo-template-bare-minimum

Just had this issue, running ./gradlew --stop in the android directory to kill all gradle daemons then trying again worked for me.

This is likely caused by stopping an Android build early.

+1 same error here, only on android, iOS build works fine

I got this after upgrading to Expo SDK 49. iOS build was fine. Android not.

I was getting this error:

A problem occurred evaluating settings 'project'.
> path may not be null or empty string. path='null'

@samipe solution worked for me, all i had to do is change settings.gradle line 10 to:

includeBuild('../node_modules/@react-native/gradle-plugin')

Thanks @samipe !

Give this guy some tacos 🌮 🌮 🔥 💯

Same for me but it was because I using

"env": {
        "APP_NAME": "value"
}

in eas.json and it seems that Gradle override this value with “Gradle (Gradle)”.

But imho, the real problem is how node_modules/expo/scripts/resolveAppEntry.js works. It clear the console so the real error was not seen. Any error in this script returns just the infamous

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

trace.

This usually happen if you have a plug-in config but not the package…for instance…you remove mapbox…but still have the config in app.config.js or app.json…that’s what happen in my case…

We are getting the same error 🤔. If anyone comes up with a solution would be appreciated as this is becoming a blocker for our project. Thanks!

I’m encountering this same issue and reproduced it as well with:

❯ npx create-expo-app@latest -t expo-template-blank-typescript test-failed ❯ npx expo run:android

In my actual project I tried the suggestions of using EXPO_DEBUG=“false” as well as copying my app.config.js to app.config.json, neither of which helped.

I just want to share my point of view

to fix this remove your android project files generated by expo remove package-lock.json and node modules

npm install then run the prebuild command again

this is the clean way, we won’t need to patch the older expo configuration this is not the way. this is how i fixed it on my side

I got this after upgrading to Expo SDK 49. iOS build was fine. Android not. I was getting this error:

A problem occurred evaluating settings 'Sally POS'.
> path may not be null or empty string. path='null'

@samipe solution worked for me, all i had to do is change settings.gradle line 10 to: includeBuild('../node_modules/@react-native/gradle-plugin') Thanks @samipe !

@tolypash I got the same error when upgrading to Expo SDK 49 but I think your solution is kind of a weird workaround.

I had a look what the issue with the replaced line of code was. I came to this conclusion: You replaced includeBuild(new File(["node", "--print", "require.resolve('react-native-gradle-plugin/package.json')"].execute(null, rootDir).text.trim()).getParentFile()) with includeBuild('../node_modules/@react-native/gradle-plugin'). My take is, that expo wants to use react-native-gradle-plugin instead of the gradle-plugin inside @react-native.

After executing npx expo install react-native-gradle-plugin it worked without replacing code in settings.gradle.

Thank you @phillihoch, this solution worked for me, just don’t forget to run npx expo prebuild before local build.

just create a project not long ago and had that problem…solved it by doing this rm -rf node_modules && rm -rf yarn.lock && yarn install && yarn run android…

something curious made the android build work, i edited the node_modules/expo/scripts/resolveAppEntry.js hoping to have some debug log, adding a console.log on line 20 of that file and running prebuild + npx expo run:android did the build magically works, I can’t explain why but it worked

NOTE: i tested this in two situations, my actual project and a fresh expo project, same result in both

I experienced the same error mentioned above. If you have config plugins attached to your app.json, make sure to double-check them so that they are correctly installed/configured.

would be good if someone could help to check the error stacktrace. if that the same from Uncaught Error Error: GetEnv.NoBoolean: is not a boolean., would be good to help investigating what is the actual value.

debugging the build code, I found this error:

resolveEntryPoint(projectRoot, { platform })
Uncaught Error Error: GetEnv.NoBoolean:  is not a boolean.
    at boolish (/Users/ag/ofto/mobile/node_modules/getenv/index.js:70:15)
    at <anonymous> (/Users/ag/ofto/mobile/node_modules/getenv/index.js:84:27)
    at <anonymous> (/Users/ag/ofto/mobile/node_modules/@expo/config/build/plugins/withInternal.js:14:42)

to fix it I put EXPO_DEBUG=“false” on build process.

I think this bug is on withInternal.js:14:42