2017-09-01 51 views
2

我試圖找出爲什麼陣營突然本地人不會在我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 
+1

您使用的是JDK 9這樣一個出發點是檢查搖籃的版本,您正在使用支持JDK 9.另一個觀察結果是「出錯了」在java.xml.bind(JAXB)模塊中列出了一個類。該模塊在JDK 9中未默認解析,因此您需要將JAXB作爲依賴項添加或暫時使用'--add-modules java.xml.bind'解決該問題。 –

回答

3

這發生在我身上,當我把「安裝最新的JDK」上React-Native Setup Guide從字面上看,通過進入並找到最新的JDK(9),並安裝它。 I uninstalled JDK 9,並安裝了React-Native安裝指南中鏈接到的JDK 8的版本,該版本解決了我的問題。