2017-11-25 191 views
1

我试图运行android版本的macbook上的react-native应用程序。因此,我已按照设置机器上的环境的所有步骤从这里:无法运行在mac上的android的第一次react-native应用程序

https://facebook.github.io/react-native/docs/getting-started.html

而且我已经成功地安装Android Studio,Android SDK, JDK, Node, NPM, Watchman, Homebrew

  • 的javac -version:9
  • 节点-v:v8.9.1
  • NPM -v:5.5.1
  • 守望版本:4.9.0

当我试图用命令运行应用程序

react-native run-android 

我得到这个错误:

Starting JS server... 
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/aman/.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: 9.925 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 

enter image description here

回答

2

根据到this GitHub issue,这个问题与JDK版本有关。确保你使用的是v8,而不是v9,那么错误不应该发生。

+0

那么我怎样才能将JDK的版本从v8更改为v9 –

+0

谢谢@sam它的工作..当我将JDK v9降级到v8时。不知道为什么它不能在JDK v9上运行,尽管它是在React Native文档页面上编写的**如果需要,下载并安装JDK 8或更新版本。** –

相关问题