npx expo run:android

Good morning, good afternoon and good night,
I would like to know what you need to have installed or configured on your computer to be able to execute this command: “npx expo run:android”
Since I get the following errors, that java, gradle, adb…

Could you give me a list or the requirements to run such a command and generate my development build?

PS C:\Desktop\ReactNative\Aplication> npx expo run:android
› Building app…
Starting a Gradle Daemon, 1 incompatible Daemon could not be reused, use --status for details
Configuration on demand is an incubating feature.

FAILURE: Build failed with an exception.

  • What went wrong:
    A problem occurred configuring root project ‘Aplication’.

Could not determine the dependencies of null.
Could not resolve all task dependencies for configuration ‘:classpath’.
Could not resolve com.android.tools.build:gradle:7.4.1.
Required by:
project :
No matching variant of com.android.tools.build:gradle:7.4.1 was found. The consumer was configured to find a runtime of a library compatible with Java 8, packaged as a jar, and its dependencies declared externally, as well as attribute ‘org.gradle.plugin.api-version’ with value ‘7.5.1’ but:
- Variant ‘apiElements’ capability com.android.tools.build:gradle:7.4.1 declares a library, packaged as a jar, and its dependencies declared externally:
- Incompatible because this component declares an API of a component compatible with Java 11 and the consumer needed a runtime of a component compatible with Java 8
- Other compatible attribute:
- Doesn’t say anything about org.gradle.plugin.api-version (required ‘7.5.1’)
- Variant ‘javadocElements’ capability com.android.tools.build:gradle:7.4.1 declares a runtime of a component, and its dependencies declared externally:
- Incompatible because this component declares documentation and the consumer needed a library
- Other compatible attributes:
- Doesn’t say anything about its target Java version (required compatibility with Java 8)
- Doesn’t say anything about its elements (required them packaged as a jar)
- Doesn’t say anything about org.gradle.plugin.api-version (required ‘7.5.1’)
- Variant ‘runtimeElements’ capability com.android.tools.build:gradle:7.4.1 declares a runtime of a library, packaged as a jar, and its dependencies declared externally:
- Incompatible because this component declares a component compatible with Java 11 and the consumer needed a component compatible with Java 8
- Other compatible attribute:
- Doesn’t say anything about org.gradle.plugin.api-version (required ‘7.5.1’)
- Variant ‘sourcesElements’ capability com.android.tools.build:gradle:7.4.1 declares a runtime of a component, and its dependencies declared externally:
- Incompatible because this component declares documentation and the consumer needed a library
- Other compatible attributes:
- Doesn’t say anything about its target Java version (required compatibility with Java 8)
- Doesn’t say anything about its elements (required them packaged as a jar)
- Doesn’t say anything about org.gradle.plugin.api-version (required ‘7.5.1’)
Could not resolve com.android.tools.build:gradle:7.3.1.
Required by:
project : > project :react-native-gradle-plugin
No matching variant of com.android.tools.build:gradle:7.4.1 was found. The consumer was configured to find a runtime of a library compatible with Java 8, packaged as a jar, and its dependencies declared externally, as well as attribute ‘org.gradle.plugin.api-version’ with value ‘7.5.1’ but:
- Variant ‘apiElements’ capability com.android.tools.build:gradle:7.4.1 declares a library, packaged as a jar, and its dependencies declared externally:
- Incompatible because this component declares an API of a component compatible with Java 11 and the consumer needed a runtime of a component compatible with Java 8
- Other compatible attribute:
- Doesn’t say anything about org.gradle.plugin.api-version (required ‘7.5.1’)
- Variant ‘javadocElements’ capability com.android.tools.build:gradle:7.4.1 declares a runtime of a component, and its dependencies declared externally:
- Incompatible because this component declares documentation and the consumer needed a library
- Other compatible attributes:
- Doesn’t say anything about its target Java version (required compatibility with Java 8)
- Doesn’t say anything about its elements (required them packaged as a jar)
- Doesn’t say anything about org.gradle.plugin.api-version (required ‘7.5.1’)
- Variant ‘runtimeElements’ capability com.android.tools.build:gradle:7.4.1 declares a runtime of a library, packaged as a jar, and its dependencies declared externally:
- Incompatible because this component declares a component compatible with Java 11 and the consumer needed a component compatible with Java 8
- Other compatible attribute:
- Doesn’t say anything about org.gradle.plugin.api-version (required ‘7.5.1’)
- Variant ‘sourcesElements’ capability com.android.tools.build:gradle:7.4.1 declares a runtime of a component, and its dependencies declared externally:
- Incompatible because this component declares documentation and the consumer needed a library
- Other compatible attributes:
- Doesn’t say anything about its target Java version (required compatibility with Java 8)
- Doesn’t say anything about its elements (required them packaged as a jar)
- Doesn’t say anything about org.gradle.plugin.api-version (required ‘7.5.1’)

  • 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.

BUILD FAILED in 13s
Error: C:\Desktop\ReactNative\Aplication\android\gradlew.bat exited with non-zero code: 1
Error: C:\Desktop\ReactNative\Aplication\android\gradlew.bat exited with non-zero code: 1
at ChildProcess.completionListener (C:\Desktop\ReactNative\Aplication\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 cp.emit (C:\Desktop\ReactNative\Aplication\node_modules\cross-spawn\lib\enoent.js:34:29)
at maybeClose (node:internal/child_process:1091:16)
at ChildProcess._handle.onexit (node:internal/child_process:302:5)

at Object.spawnAsync [as default] (C:\Desktop\ReactNative\Aplication\node_modules@expo\spawn-async\build\spawnAsync.js:17:21)
at spawnGradleAsync (C:\Desktop\ReactNative\Aplication\node_modules@expo\cli\build\src\start\platforms\android\gradle.js:72:46)
at Object.assembleAsync (C:\Desktop\ReactNative\Aplication\node_modules@expo\cli\build\src\start\platforms\android\gradle.js:52:18)
at runAndroidAsync (C:\Desktop\ReactNative\Aplication\node_modules@expo\cli\build\src\run\android\runAndroidAsync.js:31:24)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

Hi @wizardrevenge

Try the instructions here:

hi @wizardrevenge,
I am facing the same issue. Did you find a solution for it?

I was facing the same issue in my MAC and my Windows. I could not find any solution online. So I did the following to make it work and no idea if there is any incompatibility or surprise down the road or any other implications.

  • Remove current java version
  • Match up Gradle and Java version(Gradle 7.5.1 and Java 18)
  • Set Android sdk home environment variable(In windows gitbash, use bash style path i.e export ANDROID_HOME=/c/Users/[USERNAME]/AppData/Local/Android/Sdk)
  • run npx expo run:android
  • Forced to enjoy my sweet app

i tried. but still same error occur.

What are your java and gradle versions? Check out the mapping here: Compatibility Matrix

On Mac, you need to be careful as there are additional shell scripts steps.