I am having a difficulty with first time react-native run-android. The Error looks like this following

前端 未结 3 1075

FAILURE: Build failed with an exception.

What went wrong: A problem occurred

configuring project \':app\'.

3条回答
  •  感动是毒
    2021-02-14 04:21

    FIX:

    1. Make sure that java is installed on your system. Or install using linux command:

      $sudo apt-get install openjdk-8-jdk

    2. Set JAVA_HOME environment variable. For linux

      JAVA_HOME="/usr/lib/jvm/java-1.8.0-openjdk-amd64"

      to /etc/environment file new line.

    3. Make sure Android/Sdk is included in your home directory.(i.e. Assuming you have installed android-studio).
    4. Export ANDROID_HOME in ~/.bashrc file.

      export ANDROID_HOME="$HOME/Android/Sdk" export PATH="$PATH:$ANDROID_HOME/tools" export PATH="$PATH:$ANDROID_HOME/platform-tools" source /etc/environment

    Last tip: if you get watchman error everytime you close(ctrl+c) and open the JS server. run the following command.

    echo 999999 | sudo tee -a /proc/sys/fs/inotify/max_user_watches && echo 999999 | sudo tee -a /proc/sys/fs/inotify/max_queued_events && echo 999999 | sudo tee -a /proc/sys/fs/inotify/max_user_instances && watchman shutdown-server

提交回复
热议问题