2017-09-24 105 views
1

我第一次在我的MacBook中創建反應本機android應用程序。完成所有安裝過程後,我在終端中收到此錯誤消息。反應本機構建失敗,出現異常

Manans-MacBook-Air:MyNewProject mananpatel$ react-native run-android 
Scanning 577 folders for symlinks in /Applications/xxxxx/xxxxx/xxxxx/MyNewProject/node_modules (10ms) 
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/mananpatel/.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: 10.926 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 

我正在尋找最近3小時的解決方案,但無法找到遺漏的東西,所以如果知道請指導我成功運行應用程序。

+0

[非法反射存取操作(可能的重複https://stackoverflow.com/questions/46006686/illegal-reflective-訪問操作) – taniard

回答

0

分別爲:

$ export ANDROID_HOME=$HOME/Library/Android/sdk 
$ export PATH=$PATH:$ANDROID_HOME/tools 
$ export PATH=$PATH:$ANDROID_HOME/platform-tools 

$ cd app 
$ npm i 
$ cd android 
$ ./gradlew clean 
$ cd .. 
$ react-natibe run-android 

前3行:添加路徑。 其他行。運行操作

+1

歡迎來到SO。請添加一些上下文/解釋,因爲代碼只回答不符合我們的標準。請參閱[如何回答](http://stackoverflow.com/help/how-to-answer)。 – Zulan

+0

okey我正在更新 –

+0

在終端中執行./gradlew clean命令後,我仍然遇到'''配置項目'app'出現問題。 >未能通知項目評估偵聽器。 > javax/xml/bind/annotation/XmlSchema'''這個錯誤。 –

0

您安裝了哪個Java SDK版本?如果它是1.9,請嘗試卸載並安裝JDK 1.8

1

如其他答案中所述,您需要降級到1.8。

如果您需要降級您可以按照這個答案here 經覈實該issue comment

相關問題