Closed thidasapankaja closed 6 years ago
I have same problem
Environment: OS: Windows 10 Node: 7.10.1 Yarn: Not Found npm: 4.2.0 Watchman: Not Found Xcode: N/A Android Studio: Not Found
Packages: (wanted => installed) react: 16.2.0 => 16.2.0 react-native: 0.52.0 => 0.52.0
Try https://github.com/facebook/react-native/issues/16536 to edit the gradle-wrapper.properties
@TClark000 Thanks, I followed it and it worked.
Then another error occurred and fixed it by searching through Stackoverflow answers.
Now this error occurs.
Scanning folders for symlinks in /home/pankaja/Documents/Projects/react-native/AwesomeProject/node_modules (6ms)
JS server already running.
Building and installing the app on the device (cd android && ./gradlew installDebug)...
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.
* Get more help at https://help.gradle.org
BUILD FAILED in 0s
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
Couldn't find a way to fix this.
just in case you need a quick fix, you can uninstall JDK 9 and install JDK 8 instead
@pankaja92 Could you please check you environment variables such as JAVA_HOME. (cmd: java -version) Also it would be nice to update gradle to 4.4+ version.
As @kate-kholyavkina suggested I removed and installed JDK 8. But now I'm getting another error.
@fragaLY I just removed and installed JDK 8 and now when I run java -version
this is what I get.
java version "1.8.0_161"
Java(TM) SE Runtime Environment (build 1.8.0_161-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.161-b12, mixed mode)
And now when I run react-native run-android
in my project folder, I'm getting this error.
File /home/pankaja/.android/repositories.cfg could not be loaded.
Checking the license for package Android SDK Build-Tools 23.0.1 in /home/pankaja/Android/Sdk/licenses
Warning: License for package Android SDK Build-Tools 23.0.1 not accepted.
Checking the license for package Android SDK Platform 23 in /home/pankaja/Android/Sdk/licenses
Warning: License for package Android SDK Platform 23 not accepted.
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring project ':app'.
> You have not accepted the license agreements of the following SDK components:
[Android SDK Platform 23, Android SDK Build-Tools 23.0.1].
Before building your project, you need to accept the license agreements and complete the installation of the missing components using the Android Studio SDK Manager.
Alternatively, to learn how to transfer the license agreements from one workstation to another, go to http://d.android.com/r/studio-ui/export-licenses.html
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
* Get more help at https://help.gradle.org
BUILD FAILED in 54s
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
Fixed the main error by installing JDK 8 instead
As @kate-kholyavkina suggested uninstall JDK 9 and install JDK 8 instead solved my issue.
Hi
Following this guides helped me build the app in jdk9
https://github.com/gradle-guides/building-java-9-modules
HTH Regards Saikat
Hey, I had the same issue. I went to the gradle. properties file and changed the version in the 'distributionUrl' field to the latest version.
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip
I had same issue, on Mac.
First thing I did was change distributionUrl
to latest gradle, that created other issues, but following gradle upgrade guid, i solved them and landed on having xmlSchema issue described here.
I didn't want to take the risk of uninstalling jdk 9 and I found following SO question which describes how to manage multiple java version on Mac:
https://stackoverflow.com/questions/26252591/mac-os-x-and-multiple-java-versions
Using jenv
, i set local java to java8 and everything worked as it should.
@kate-kholyavkina's solution worked fine!
HI I have uninstalled with:
sudo rm -fr /Library/Internet\ Plug-Ins/JavaAppletPlugin.plugin
sudo rm -fr /Library/PreferencesPanes/JavaControlPanel.prefPane
sudo rm -fr ~/Library/Application\ Support/Java
and installed JDK8 but still getting the same error. How come? Thanks!
Done, add also: sudo rm -fr /Library/Java/JavaVirtualMachines/jdk-9.0.4.jdk/
Running with Java 8 works for me too -- additionally don't forget to set JAVA_HOME in your .bashrc
to the value returned by /usr/libexec/java_home -v
I ask 4 other React Native dev. They all said they have downgraded their Java version to 8. For purpose of using react-native run-android. -Use Java 8. -Set ANDROID_HOME according to https://facebook.github.io/react-native/docs/getting-started.html -Set JAVA_HOME according to http://www.sajeconsultants.com/how-to-set-java_home-on-mac-os-x/
downgrade to java8 and set JAVAHOME in .bash* works
just for some up the quick way (removing jdk9), run these commands:
sudo apt-get purge openjdk-9-jre-headless sudo apt-get purge openjdk-9-jdk
If any one came across this problem. you don't have to downgrade java version Just import the android folder into Android studio it will ask you to update gradle click update and when it finish everything is working fine It worked for many for so many projects
not sure what u mean by 'import the android folder into Android studio'
@kevinzhangftw Open Android Studio and click on ( Import project ) and select android folder in your react-native app
By using this way I built my react-native project using Java 10 too
Thank you Blacktoviche! Great advice and it worked!
@Blacktoviche But then, we need to upgrade all projects first to actually begin editing the codes...
Not to begin editing code; just to be able to run it on an emulator. It's an inconvenience, but not a huge one. And I doubt this is seen as the solution moving forward; likely a solution right now, and will be resolved in updates.
This is resolved by switching to lower Java SDK. As soon as I switch to 1.8 from 1.9 in Intellij and point my redirect my "PATH=%JAVA_HOME%\bin" in terminal, everything starts working!
switching from java 9 to 8 resolved my issue
Is this a bug report?
Yes
Have you read the Contributing Guidelines?
Yes
Environment
Environment: OS: Linux 4.13 Node: 9.4.0 Yarn: Not Found npm: 4.6.1 Watchman: Not Found Xcode: N/A Android Studio: 3.0 AI-171.4443003
Packages: (wanted => installed) react: 16.2.0 => 16.2.0 react-native: 0.52.0 => 0.52.0
Steps to Reproduce
adb devices
AwesomeProject
usingreact-native init AwesomeProject
command.react-native run-android
Expected Behavior
Start the AwesomeProject in connected Android Device.
Actual Behavior
Didn't start the app on my mobile. Error on console appeared.
Screenshot
Reproducible Demo