我正在尝试在macbook上为android版本运行react-native应用程序。所以我已经按照所有步骤在这里设置了机器上的环境:
https://facebook.github.io/react-native/docs/getting-started.html
我已成功安装Android Studio,Android SDK, JDK, Node, NPM, Watchman, Homebrew
当我尝试使用命令
运行应用程序时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
答案 0 :(得分:1)
是的,据@Sam Hanley说,这是java版本更新的问题。因此,由于担心版本更新/降级,我们可以通过以下过程继续解决此问题;
PROJECT_PATH /机器人/ gradle这个/包装/ gradle-wrapper.properties
distributionUrl=https\://services.gradle.org/distributions/gradle-4.3-rc-2-all.zip
导出JAVA_HOME =“/ Applications / Android Studio.app/Contents/jre/jdk/Contents/Home“
(PS:macOS解决方案)
希望这有帮助!
答案 1 :(得分:0)
通过执行以下操作,我能够解决这个问题:
False
path_to_your_project/android/gradlew
更改为DEFAULT_JVM_OPTS=""