06/04/2021 - react-native setup on windows and vscode
tutorial
https://www.youtube.com/watch?v=Hf4MJH0jDb4
https://www.youtube.com/watch?v=Hf4MJH0jDb4
docs
https://reactnative.dev/docs/environment-setup
error
JAVA_HOME is not set and no 'java' command could be found in your PATH.
JAVA_HOME is not set and no 'java' command could be found in your PATH.
cause
user variable were set via the control panel but the system variable not in sync, had to set as admin in command prompt
solution
https://confluence.atlassian.com/doc/setting-the-java_home-variable-in-windows-8895.html
dependencies for windows
- java sdk (same version as the jre within the android sdk folder), android has the jre but lacks the jdk
- android studio (android runs on java)
- paths and windows environment variable must be set
and then you can use the react-native cli on vscode
- command prompt terminal choco install -y nodejs.install openjdk8
- browser search and install android studio
- android studio app > config>sdk manager> sdk> check for android 10 q else add
- control panel pane set ANDROID_HOME, the url is inside the sdk manager
- command prompt terminal set JAVA_HOME, it should be under c:/programme files/java
- control panel pane set the PATH for android home > platform tools and java home>bin (where the java file is)
- vscode terminal npm i -g react native cli
- vscode terminal npx react-native init [name]
- vscode terminal react-native run-android
Comments