skip to Main Content

I’ve been pulling my hair over this for 3 days now,

every time I run the command react-native run-android I get this error:

info Running jetifier to migrate libraries to AndroidX. You can disable it using "--no-jetifier" flag.
(node:10284) Warning: Accessing non-existent property 'padLevels' of module exports inside circular dependency
(Use `node --trace-warnings ...` to show where the warning was created)
Jetifier found 871 file(s) to forward-jetify. Using 16 workers...
info JS server already running.
info Installing the app...

FAILURE: Build failed with an exception.

* What went wrong:
The supplied javaHome seems to be invalid. I cannot find the java executable. Tried location: C:Program FilesJavajdk-17binjava.exe

* 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

error Failed to install the app. Make sure you have the Android development environment set up: https://reactnative.dev/docs/environment-setup.
Error: Command failed: gradlew.bat app:installDebug -PreactNativeDevServerPort=8081

FAILURE: Build failed with an exception.

* What went wrong:
The supplied javaHome seems to be invalid. I cannot find the java executable. Tried location: C:Program FilesJavajdk-17binjava.exe

* 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

    at makeError (C:UsersusernameDesktopcodeReact NativeBuild AppSchedulernode_modulesexecaindex.js:174:9)
    at C:UsersusernameDesktopcodeReact NativeBuild AppSchedulernode_modulesexecaindex.js:278:16
    at processTicksAndRejections (internal/process/task_queues.js:95:5)
    at async runOnAllDevices (C:UsersusernameDesktopcodeReact NativeBuild AppSchedulernode_modules@react-native-communitycli-platform-androidbuildcommandsrunAndroidrunOnAllDevices.js:106:5)
    at async Command.handleAction (C:UsersusernameDesktopcodeReact NativeBuild AppSchedulernode_modulesreact-nativenode_modules@react-native-communityclibuildindex.js:192:9)info Run CLI with --verbose flag for more details.

I created my directory using basic react-native init projectTesting

My gradle is version 6.9
.androidgradlewrappergradle-wrapper.properties =>distributionUrl=https://services.gradle.org/distributions/gradle-6.9-all.zip

My android studios version is Android Studio 2020.3.1

My java version is 15

C:Usersusername>java -version
java version "15" 2020-09-15
Java(TM) SE Runtime Environment (build 15+36-1562)
Java HotSpot(TM) 64-Bit Server VM (build 15+36-1562, mixed mode, sharing)

C:Usersusername>javac -version
javac 15

I was thinking of using java 17 but in the compatibility docs it said:

A Java version between 8 and 15 is required to execute Gradle. Java 16
and later versions are not yet supported when executing Gradle.

any help would be really really appreciated!!

14

Answers


  1. Make sure of your JAVA_HOME Path in your terminal with

    echo %JAVA_HOME%
    

    Its a common mistake to have bin , while bin should be in the PATH the java home is only your jdk folder like C:Program FilesJavajdk-15 .

    Deleted the jdk-17 folder and then uninstalled 31 and 30 version of sdk build tools and this should fix the issue .

    Login or Signup to reply.
  2. Deleting Java17 SDK and C:Program FilesJava folder worked for me. Use openjdk11 instead of Java17 SDK

    Login or Signup to reply.
  3. The supplied javaHome seems to be invalid. I cannot find the java executable. Tried location: C:Program FilesJavajdk1.8.0_341binjava

    I was in a similar problem and you can solve it in the following way –> Go to Disk C, Find the java folder in android and delete the previous version of jdk by default it comes with 1.8
    C:Program FilesJava for Reac native version 11 of jdk is recommended.

    Login or Signup to reply.
  4. I faced the problem as I have multiple sdks, e.g 1.8 inside my java folder along with java 11. Deleted other jdks except 11 worked for me.

    Login or Signup to reply.
  5. If someone faces this error after Android Studio update to Android Studio Electric Eel | 2022.1.1 than simply follow following steps:

    Go To android studio directory (Default C:Program FilesAndroidAndroid Studio), remove or rename the jre folder, run cmd as administrator and create a symbolic link:

    cd /d C:Program FilesAndroidAndroid Studio
    mklink /D jre jbr
    

    Thanks to this link

    Login or Signup to reply.
  6. after update to Android Studio 22.1.1, just delete folder jre in C:Program FilesAndroidAndroid Studio
    it works for me

    Login or Signup to reply.
  7. If someone faces this error after Android Studio update to Android Studio Electric Eel | 2022.1.1
    just delete folder jre in C:Program FilesAndroidAndroid Studio it works for me

    Login or Signup to reply.
  8. I get help from other answers and with my tries i find this solution:

    1. Delete jdk folder in Android Studio directory
    2. Change path in Windows Env. Variables JAVA_HOME: …/Android Studio/jdk => …/Android Studio/jbr
    3. Restart your IDE
    Login or Signup to reply.
  9. after update to ANDROID STUDIO ELECTRIC EEL,
    Delete jre folder in

    default path: C:Program FilesAndroidAndroid Studio.

    I had my jre in D:ANDROID_STUDIOjre and it worked for me.

    Login or Signup to reply.
  10. Delete jre file in C:Program FilesAndroidAndroid Studio. Then create new jre folder and paste all contents from copy contents in C:Program FilesAndroidAndroid Studiojbr. Works like a charm.

    Login or Signup to reply.
  11. just open the program files folder and navigate to the android folder then open the android folder and then cut all the file from jbr folder to jre folder make to replace all the file when you paste the cut files from the jbr folder i think this will surely work for all .

    Login or Signup to reply.
  12. This is happens on update Android Studio Electric Eel | 2022.1.1.

    Do just this steps

    • Go to -> C:Program FilesAndroidAndroid Studio (Android studio installed directory)
    • Delete jre folder

    Then run ta project again. That’s all

    Login or Signup to reply.
  13. Go to C:Program FilesAndroidAndroid Studio, and delete jre folder and build. Its will work.

    Login or Signup to reply.
  14. Go To android studio directory (Default C:Program FilesAndroidAndroid Studio) remove jre folder run cmd as administrator

    This solution works with me 🙂

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search