jithin mp
jithin mp

Reputation: 95

I could not run my react-native project due to java installation

//// I set jdk path in environment variables. But the app could not be installed. I have tried many times. But the bugs are still there.do reply if there is any solution.

     D:\React Project\MyApp>react-native run-android
     info Running jetifier to migrate libraries to AndroidX. You can disable it using "--no- 
     jetifier" 
     flag.
     Jetifier found 864 file(s) to forward-jetify. Using 4 workers...
     info Starting JS server...
     info Installing the app...

     ERROR: JAVA_HOME is set to an invalid directory: C:\Program Files\Java\jdk1.8.0_66\bin

     Please set the JAVA_HOME variable in your environment to match the
     location of your Java installation.

     error Failed to install the app. Make sure you have the Android development environment set up: 
     https://facebook.github.io/react-native/docs/getting-starte
     d.html#android-development-environment. Run CLI with --verbose flag for more details.
     Error: Command failed: gradlew.bat app:installDebug -PreactNativeDevServerPort=8081
     at checkExecSyncError (child_process.js:621:11)
     at execFileSync (child_process.js:639:15)
     at runOnAllDevices (D:\React Project\MyApp\node_modules\@react-native-community\cli-platform- 
     android\build\commands\runAndroid\runOnAllDevices.js:94:39
     )
     at buildAndRun (D:\React Project\MyApp\node_modules\@react-native-community\cli-platform- 
     android\build\commands\runAndroid\index.js:158:41)
     at D:\React Project\MyApp\node_modules\@react-native-community\cli-platform- 
     android\build\commands\runAndroid\index.js:125:12
     at processTicksAndRejections (internal/process/task_queues.js:93:5)
     at async Command.handleAction (D:\React Project\MyApp\node_modules\react- 
     native\node_modules\@react- 
     native-community\cli\build\index.js:164:9)

///

Upvotes: 0

Views: 167

Answers (1)

Akash Sarkar
Akash Sarkar

Reputation: 682

Set your JAVA_HOME like This:
JAVA_HOME=C:\Program Files\Java\jdk1.8.0_66

/bin is not required.

Checkout this answer for more references.

Upvotes: 1

Related Questions