我正在试图找出为什么React Native突然无法在我的2014年Macbook上运行。它在八月初工作。尝试从命令行运行react-native run-android
时出现以下错误。当我在Android Studio 3.0中打开它时,该应用程序运行正常,没有错误。我有什么想法可以解决这个问题?
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
答案 0 :(得分:3)
当我在React-Native Setup Guide字面上“安装最新的JDK”时,通过查找最新的JDK(9)并安装它,发生了这种情况。我uninstalled JDK 9并安装了在React-Native设置指南中链接的JDK 8版本,它为我解决了这个问题。
答案 1 :(得分:0)
我在安装Java 9时遇到了这个问题。
您可specify the JDK version来解决此问题。