2017-09-24 108 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

相关问题