react-native run android error on windows (react-native gesture handler:compile DebugJava withJavac)

Hi guys. I am new to programming and react-native. I got basic javascript knowledge and i been trying to develop an app using react but when i try run-android command i get react-native gesture handler:compile Debug Java with Javac Failed. I attached the error code below. Anybody that can possibly point me in a certain direction of what i should do to run the android emulator.

Your environment has been set up for using Node.js 10.16.0 (x64) and npm.

C:\Users\User>cd HitchApp2/

C:\Users\User\HitchApp2>react-native run-android
error React Native CLI uses autolinking for native dependencies, but the followi
ng modules are linked manually:

  • react-native-gesture-handler (to unlink run: “react-native unlink react-nati
    ve-gesture-handler”)
    This is likely happening when upgrading React Native from below 0.60 to 0.60 or
    above. Going forward, you can unlink this dependency via “react-native unlink <d
    ependency>” and it will be included in your app automatically. If a library isn’
    t compatible with autolinking, disregard this message and notify the library mai
    ntainers.
    Read more about autolinking: https://github.com/react-native-community/cli/blob/
    master/docs/autolinking.md
    info Running jetifier to migrate libraries to AndroidX. You can disable it using
    “–no-jetifier” flag.
    Jetifier found 897 file(s) to forward-jetify. Using 4 workers…
    info Starting JS server…
    info Installing the app…
    Starting a Gradle Daemon, 2 incompatible and 1 stopped Daemons could not be reus
    ed, use --status for details
    > Task :react-native-gesture-handler:compileDebugJavaWithJavac FAILED

Deprecated Gradle features were used in this build, making it incompatible with
Gradle 6.0.
Use ‘–warning-mode all’ to show the individual deprecation warnings.
See https://docs.gradle.org/5.4.1/userguide/command_line_interface.html#sec:comm
and_line_warnings
14 actionable tasks: 2 executed, 12 up-to-date

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ‘:react-native-gesture-handler:compileDebugJavaWithJav
ac’.
> Could not find tools.jar. Please check that C:\Program Files\Java\jdk1.8.0_201
\jre contains a valid JDK installation.

* 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 57s

error Failed to install the app. Make sure you have the Android development envi
ronment set up: https://facebook.github.io/react-native/docs/getting-started.htm
l#android-development-environment. Run CLI with --verbose flag for more details.

Error: Command failed: gradlew.bat app:installDebug -PreactNativeDevServerPort=8
081

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ‘:react-native-gesture-handler:compileDebugJavaWithJav
ac’.
> Could not find tools.jar. Please check that C:\Program Files\Java\jdk1.8.0_201
\jre contains a valid JDK installation.

* 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 57s

at checkExecSyncError (child_process.js:629:11)
at execFileSync (child_process.js:647:13)
at runOnAllDevices (C:\Users\User\HitchApp2\node_modules@react-native-commu
nity\cli-platform-android\build\commands\runAndroid\runOnAllDevices.js:75:39)
at buildAndRun (C:\Users\User\HitchApp2\node_modules@react-native-community
\cli-platform-android\build\commands\runAndroid\index.js:155:41)
at then.result (C:\Users\User\HitchApp2\node_modules@react-native-community
\cli-platform-android\build\commands\runAndroid\index.js:121:12)
at process._tickCallback (internal/process/next_tick.js:68:7)

C:\Users\User\HitchApp2>npm install --save-dev jetifier
npm WARN eslint-plugin-react@7.12.4 requires a peer of eslint@^3.0.0 || ^4.0.0 |
| ^5.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN eslint-plugin-react-native@3.6.0 requires a peer of eslint@^3.17.0 || ^
4 || ^5 but none is installed. You must install peer dependencies yourself.
npm WARN react-redux@7.1.0 requires a peer of redux@^2.0.0 || ^3.0.0 || ^4.0.0-0
but none is installed. You must install peer dependencies yourself.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.9 (node_modules\fse
vents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@
1.2.9: wanted {“os”:“darwin”,“arch”:“any”} (current: {“os”:“win32”,“arch”:“x64”}
)

  • jetifier@1.6.3
    updated 1 package and audited 948200 packages in 30.469s
    found 0 vulnerabilities

C:\Users\User\HitchApp2>npm install --save-dev jetifier
npm WARN eslint-plugin-react@7.12.4 requires a peer of eslint@^3.0.0 || ^4.0.0 |
| ^5.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN eslint-plugin-react-native@3.6.0 requires a peer of eslint@^3.17.0 || ^
4 || ^5 but none is installed. You must install peer dependencies yourself.
npm WARN react-redux@7.1.0 requires a peer of redux@^2.0.0 || ^3.0.0 || ^4.0.0-0
but none is installed. You must install peer dependencies yourself.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.9 (node_modules\fse
vents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@
1.2.9: wanted {“os”:“darwin”,“arch”:“any”} (current: {“os”:“win32”,“arch”:“x64”}
)

  • jetifier@1.6.3
    updated 1 package and audited 948200 packages in 114.382s
    found 0 vulnerabilities

C:\Users\User\HitchApp2>react-native run-android
error React Native CLI uses autolinking for native dependencies, but the followi
ng modules are linked manually:

  • react-native-gesture-handler (to unlink run: “react-native unlink react-nati
    ve-gesture-handler”)
    This is likely happening when upgrading React Native from below 0.60 to 0.60 or
    above. Going forward, you can unlink this dependency via “react-native unlink <d
    ependency>” and it will be included in your app automatically. If a library isn’
    t compatible with autolinking, disregard this message and notify the library mai
    ntainers.
    Read more about autolinking: https://github.com/react-native-community/cli/blob/
    master/docs/autolinking.md
    info Running jetifier to migrate libraries to AndroidX. You can disable it using
    “–no-jetifier” flag.
    Jetifier found 897 file(s) to forward-jetify. Using 4 workers…
    info Starting JS server…
    info Installing the app…
    > Task :react-native-gesture-handler:compileDebugJavaWithJavac FAILED

Deprecated Gradle features were used in this build, making it incompatible with
Gradle 6.0.
Use ‘–warning-mode all’ to show the individual deprecation warnings.
See https://docs.gradle.org/5.4.1/userguide/command_line_interface.html#sec:comm
and_line_warnings
14 actionable tasks: 2 executed, 12 up-to-date

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ‘:react-native-gesture-handler:compileDebugJavaWithJav
ac’.
> Could not find tools.jar. Please check that C:\Program Files\Java\jdk1.8.0_201
\jre contains a valid JDK installation.

* 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 57s

error Failed to install the app. Make sure you have the Android development envi
ronment set up: https://facebook.github.io/react-native/docs/getting-started.htm
l#android-development-environment. Run CLI with --verbose flag for more details.

Error: Command failed: gradlew.bat app:installDebug -PreactNativeDevServerPort=8
081

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ‘:react-native-gesture-handler:compileDebugJavaWithJav
ac’.
> Could not find tools.jar. Please check that C:\Program Files\Java\jdk1.8.0_201
\jre contains a valid JDK installation.

* 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 57s

at checkExecSyncError (child_process.js:629:11)
at execFileSync (child_process.js:647:13)
at runOnAllDevices (C:\Users\User\HitchApp2\node_modules@react-native-commu
nity\cli-platform-android\build\commands\runAndroid\runOnAllDevices.js:75:39)
at buildAndRun (C:\Users\User\HitchApp2\node_modules@react-native-community
\cli-platform-android\build\commands\runAndroid\index.js:155:41)
at then.result (C:\Users\User\HitchApp2\node_modules@react-native-community
\cli-platform-android\build\commands\runAndroid\index.js:121:12)
at process._tickCallback (internal/process/next_tick.js:68:7)

C:\Users\User\HitchApp2>

1 Like

Looking through the trace it seems that the problems are mostly environmental and version based … sorry if this is stating the obvious.

 - Deprecated Gradle features were used in this build, making it incompatible with
Gradle 6.0.

The code you are building/generating is pulling in dependencies that are not compatible with your version of Gradle

 - Could not find tools.jar. Please check that C:\Program Files\Java\jdk1.8.0_201
\jre contains a valid JDK installation.

Double check that the correct version of the JDK is both installed and referenced properly in your PATH environment variable - again, may be stating the obvious, but you need the JDK (Java Development Kit) NOT just the JRE (Java Runtime Environment)

Depending on what you are trying to do with the project (HitchApp2) you can try updating the dependencies (ensure all of the versions of the different tools you are using are compatible)

Alternatively, you could downgrade your environment; this may introduce other problems and security vulnerabilites as an unintended side effect though.

1 Like