What’s wrong with running the React-Native app?

Asked

Viewed 531 times

-1

Hi, I’m trying to run my React app Turn on via command

sudo React-Native run-android

But always returns me the following error message:

FAILURE: Build failed with an exception.

* What went wrong:
Could not determine java version from '11'.

I’ve tried to do everything

1- I tested my java version

java -version

openjdk version "11" 2018-09-25
OpenJDK Runtime Environment (build 11+24-Ubuntu-118.04)
OpenJDK 64-Bit Server VM (build 11+24-Ubuntu-118.04, mixed mode, sharing)

2- I included JAVA_HOME, both in /etc/enviroment and ~/. bashrc

echo $JAVA_HOME

/usr/lib/jvm/java-11-openjdk-amd64

I really don’t know what else to do, because apparently the whole environment is prepared to work properly.

  • Only appears this error ? Or you only took a part ? If possible edit the question and enter the full log. Apparently this error is related to Gradle.

  • 1

    Your Android studio is working? If yes try to view these variables https://facebook.github.io/react-native/docs/getting-started#3-configure-the-android-home-Environment-variable

  • Hello, yes... Only this error appears, the complete log are some tips that did not help me kkk

1 answer

0

Good! so you can upgrade Gradle to see if it’s compatible with Openjdk 11

But I recommend using oracle jdk 8 :

1 - Remove your open JDK 11 (if based on debian: apt purgue --remove openjdk*

2 - download Oracle JDK from SUN : https://www.oracle.com/technetwork/pt/java/javase/downloads/jdk8-downloads-2133151.html

3 - Unzip with : tar -zxvf

4 - Add to your PATH: vim ~/. bashrc export JAVA_HOME="/local/do/JDK/jdk1.8.0_181" export CLASSPATH="$JAVA_HOME/lib":$CLASSPATH export PATH="$JAVA_HOME/bin":$PATH export MANPATH="$JAVA_HOME/man":$MANPATH

And after editing : source ~/. bashrc

5 - Some cases of java error, see java -version Just follow this tip : https://www.vivaolinux.com.br/topico/Java/O-java-apresenta-um-erro-Preciso-de-ajuda

After that the java will be in version 8 , and recommended for use .

Browser other questions tagged

You are not signed in. Login or sign up in order to post.