Unrecognized VM option error when attempting to run `expo run:android`

When I run expo run:android I get the following error:

❯ expo run:android -d Pixel_4_API_30_2
› Building app...
Starting a Gradle Daemon, 1 stopped Daemon could not be reused, use --status for details

FAILURE: Build failed with an exception.

* What went wrong:
Unable to start the daemon process.
This problem might be caused by incorrect configuration of the daemon.
For example, an unrecognized jvm option is used.
Please refer to the User Manual chapter on the daemon at https://docs.gradle.org/6.9/userguide/gradle_daemon.html
Process command line: /Library/Java/JavaVirtualMachines/jdk-17.0.1.jdk/Contents/Home/bin/java -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError --add-opens java.base/java.util=ALL-UNNAMED --add-opens java.base/java.lang=ALL-UNNAMED --add-opens java.base/java.lang.invoke=ALL-UNNAMED --add-opens java.prefs/java.util.prefs=ALL-UNNAMED -Xmx2048m -Dfile.encoding=UTF-8 -Duser.country=US -Duser.language=en -Duser.variant -cp /Users/stdavis/.gradle/wrapper/dists/gradle-6.9-all/dooywd8nv05k16orzxge2b1bs/gradle-6.9/lib/gradle-launcher-6.9.jar org.gradle.launcher.daemon.bootstrap.GradleDaemon 6.9
Please read the following process output to find out more:
Unrecognized VM option 'MaxPermSize=512m'
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.

* 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
/Users/stdavis/Documents/Projects/roadkill-mobile-rewrite/src/front/android/gradlew exited with non-zero code: 1
Error: /Users/stdavis/Documents/Projects/roadkill-mobile-rewrite/src/front/android/gradlew exited with non-zero code: 1
    at ChildProcess.completionListener (/Users/stdavis/.fnm/node-versions/v14.17.0/installation/lib/node_modules/expo-cli/node_modules/@expo/spawn-async/src/spawnAsync.ts:65:13)
    at Object.onceWrapper (events.js:483:26)
    at ChildProcess.emit (events.js:376:20)
    at maybeClose (internal/child_process.js:1055:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:288:5)
    at spawnAsync (/Users/stdavis/.fnm/node-versions/v14.17.0/installation/lib/node_modules/expo-cli/node_modules/@expo/spawn-async/src/spawnAsync.ts:26:19)
    at spawnGradleAsync (/Users/stdavis/.fnm/node-versions/v14.17.0/installation/lib/node_modules/expo-cli/src/commands/run/android/spawnGradleAsync.ts:83:18)
    at assembleAsync (/Users/stdavis/.fnm/node-versions/v14.17.0/installation/lib/node_modules/expo-cli/src/commands/run/android/spawnGradleAsync.ts:57:16)
    at actionAsync (/Users/stdavis/.fnm/node-versions/v14.17.0/installation/lib/node_modules/expo-cli/src/commands/run/android/runAndroid.ts:143:9)

I have a feeling that I have the incorrect version of some dependency installed but I don’t know where to look.

You need to use Java 1.8.

What works for me on macOS with more than one version installed using Homebrew is to run the following in the terminal before trying to build or run expo run:android:

export JAVA_VERSION=1.8

I had same issue, the problem was there is no enough space in my disk drive… you can see details about you specific situation in layer ‘Event Log’ this layer regularly is in the bottom on Android studio, it was my output Log:

"02:45 PM Emulator: emulator: ERROR: Not enough space to create userdata partition. Available: 3310.363281 MB at /home/user/.android/avd/my_Nexus_5X_API_27.avd, need 7372.800000 MB.