onur
onur

Reputation: 71

gradlew.bat exited with non-zero code: 1 React Native

I'm just trying to run a simple and empty react native project in android emulator but I'm getting this error anyone have any ideas?

error:

Error: C:\Users\Onur\Desktop\ReactNative\MemorizingApp\android\gradlew.bat exited with non-zero code: 1 Error: C:\Users\Onur\Desktop\ReactNative\MemorizingApp\android\gradlew.bat exited with non-zero code: 1 at ChildProcess.completionListener (C:\Users\Onur\Desktop\ReactNative\MemorizingApp\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 ChildProcess.cp.emit (C:\Users\Onur\Desktop\ReactNative\MemorizingApp\node_modules\cross-spawn\lib\enoent.js:34:29) at maybeClose (node:internal/child_process:1093:16) at Process.ChildProcess._handle.onexit (node:internal/child_process:302:5) ... at Object.spawnAsync [as default] (C:\Users\Onur\Desktop\ReactNative\MemorizingApp\node_modules@expo\spawn-async\build\spawnAsync.js:17:21) at spawnGradleAsync (C:\Users\Onur\Desktop\ReactNative\MemorizingApp\node_modules@expo\cli\build\src\start\platforms\android\gradle.js:72:46) at Object.assembleAsync (C:\Users\Onur\Desktop\ReactNative\MemorizingApp\node_modules@expo\cli\build\src\start\platforms\android\gradle.js:52:18) at runAndroidAsync (C:\Users\Onur\Desktop\ReactNative\MemorizingApp\node_modules@expo\cli\build\src\run\android\runAndroidAsync.js:31:24) at processTicksAndRejections (node:internal/process/task_queues:96:5)

Upvotes: 5

Views: 15573

Answers (2)

Marcel64
Marcel64

Reputation: 31

in my case, (with Expo) :

I deleted all folder/files in the folder "android" relative to gradle, so the following :

  • file .gradle
  • folder gradle
  • file build.gradle
  • file gradle.properties
  • file gradlew
  • file gradlew.bat
  • file settings.gradle

And after I run the usual command npx expo run:android and it worked !

Upvotes: 1

Maria
Maria

Reputation: 141

In my case, I did not have Gradle installed on my machine.

  1. check if you have Gradle installed gradle -v
  2. if not, install it with Chocolatey choco install gradle (there are other ways to install it)
  3. If yes, run gradle --stop to ensure that no gradle daemon is running
  4. Remove build folder
  5. refresh terminal by running refreshenv in it

Upvotes: 4

Related Questions