Mr.Happy
Mr.Happy

Reputation: 517

React native build failed with an exception

I am creating react native android application in my MacBook for the first time. After completing all installation process I am getting this error message in my terminal.

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

I am searching solution for last 3 hours but not able to find what is missing so if know please guide me to run the application successfully.

Upvotes: 1

Views: 2018

Answers (3)

Orion Engleton
Orion Engleton

Reputation: 15

You need to downgrade to 1.8 as stated in the other answers.

If you need to downgrade You can follow this answer here As verified by this issue comment

Upvotes: 1

Christian Vorhemus
Christian Vorhemus

Reputation: 2683

Which Java SDK version do you have installed? If it's 1.9, try uninstalling it and install JDK 1.8.

Upvotes: 0

Batu
Batu

Reputation: 308

respectively:

$ 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

the first 3 lines: add path. other lines. Run operations

Upvotes: 0

Related Questions