android - 非法反射访问操作

标签 android gradle react-native java-9

我试图弄清楚为什么 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

最佳答案

当我在 React-Native Setup Guide 上选择“安装最新的 JDK”时,就发生了这种情况。从字面上看,就是找到最新的 JDK (9) 并安装它。我uninstalled JDK 9并安装了 React-Native 设置指南上链接的 JDK 8 版本,这为我解决了问题。

关于android - 非法反射访问操作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46006686/

相关文章:

android - 在 Marshmallow 中使用 AudioTrack 播放音频流

安卓 :- Custom ExpandableListView : cannot expand group item to display child item in CustomListView

javascript - 使用 reCAPTCHA 响应 Native

spring - Gradle 1.0 +Spring + AspectJ 构建问题

javascript - 当状态数据发生变化时,如何更改平面列表中文本的颜色

android - React Native 应用程序不是为 Android 构建的 - SyntaxError :\u can only be followed by a Unicode character sequence

android - 使用 Android APP 添加斜体和链接到 SMS

java - 如何在android中对JSONArray进行排序

spring-boot - 尝试模块化 Gradle SpringBoot 项目但在尝试构建时得到 "Error: cannot find symbol"?

java - gradle运行任务的文档?