我是第一次在我的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 :(得分:1)
您需要按照其他答案中的说明降级到1.8。
如果您需要降级您可以按照此回答here 经issue comment
验证答案 1 :(得分: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行:添加路径。 其他线路。运行操作
答案 2 :(得分:0)
您安装了哪个Java SDK版本?如果是1.9,请尝试卸载并安装JDK 1.8。