2

I'm trying to figure out why React Native suddenly will not work on my 2014 era Macbook. It was working earlier in August. I get the following error when trying to run react-native run-android from the command line. The app runs when I open it in Android Studio 3.0 just fine, no errors. Any ideas what I can look at to resolve this?

Scanning 563 folders for symlinks in /Users/username/ReactNative/Wtf/node_modules (5ms)
JS server already running.
Building and installing the app on the device (cd android && ./gradlew installDebug)...
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.gradle.internal.reflect.JavaMethod (file:/Users/username/.gradle/wrapper/dists/gradle-2.14.1-all/8bnwg5hd3w55iofp58khbp6yv/gradle-2.14.1/lib/gradle-base-services-2.14.1.jar) to method java.lang.ClassLoader.getPackages()
WARNING: Please consider reporting this to the maintainers of org.gradle.internal.reflect.JavaMethod
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring project ':app'.
> Failed to notify project evaluation listener.
   > javax/xml/bind/annotation/XmlSchema

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Total time: 4.706 secs
Could not install the app on the device, read the error above for details.
Make sure you have an Android emulator running or a device connected and have
set up your Android development environment:
https://facebook.github.io/react-native/docs/android-setup.html
Alan Bateman
  • 5,283
  • 1
  • 20
  • 25
ajthyng
  • 1,245
  • 1
  • 12
  • 18
  • 1
    You are using JDK 9 so one starting point is to check that the version of Gradle that you are using supports JDK 9. Another observation is that the "What went wrong" lists a class in the java.xml.bind (JAXB) module. That module is not resolved by default in JDK 9 so you either need to add JAXB as a dependency or workaround it temporarily with `--add-modules java.xml.bind`. – Alan Bateman Sep 11 '17 at 09:53

2 Answers2

3

This happened to me when I took 'install the latest JDK' on the React-Native Setup Guide literally, by going and finding the latest JDK (9) and installing it. I uninstalled JDK 9 and installed the version of JDK 8 that's linked to on the React-Native Setup Guide, which solved the problem for me.

taniard
  • 46
  • 4
0

I encountered this problem when I install Java 9。

You can specify the JDK version to fix this。

xiezefan
  • 601
  • 6
  • 5