I\'m working on MacOS and just starting with react-native
.
One of the first steps to get started is to run: react-native run-android
or
On MacOS, I ran the following commands:
brew cask uninstall java
brew tap caskroom/versions
brew cask install java8 "or just brew cask install java to install latest version"
I solve this by downgrading my JDK to 8.
On Ubuntu, you should run these command lines in the terminal:
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt install oracle-java8-installer
sudo apt install oracle-java8-set-default
I usually get this error when I forget to build the project using Android Studio. A simple sync and upgrading Gradle will do the work.
In your PROJECT_PATH/android/gradle/wrapper/gradle-wrapper.properties
file, update your distributionUrl
to the following:
distributionUrl=https\://services.gradle.org/distributions/gradle-5.0-all.zip
See related gradle distributions documentation
---- December 2018 --- keep attention ---
React Native does not work with Java versions higher than 8, so you need to uninstall your 9.0.1
version. To do so, execute the following commands:
cd /Library/Java/JavaVirtualMachines/
ls -l
Identify the folder containing your Java Version, then remove it
sudo rm -rf jdk.x.x_xxx.jdk
After that you can download and install java 8 from oracle again. Refer to jdk8 download page