Yes
Yes
Environment:
OS: macOS Sierra 10.12.6
Node: 8.7.0
Yarn: 1.2.1
npm: 5.5.1
Watchman: 4.9.0
Xcode: Xcode 9.0.1 Build version 9A1004
Android Studio: 2.3 AI-162.4069837
Packages: (wanted => installed)
react: 16.0.0-beta.5 => 16.0.0-beta.5
react-native: 0.49.3 => 0.49.3
react-native run-android
Should build android files correctly
Errors with following details
FAILURE: Build failed with an exception.
* What went wrong:
Could not determine java version from '9.0.1'.
Solution seems to be described here: https://discuss.gradle.org/t/could-not-determine-java-version-from-9-0-1/24457 I tried it and got past the error, but had issues when opening project in my android studio, so am not sure if further steps are required.
Get the same problem
This work for me:
Edit the file /android/gradle/wrapper/gradle-wrapper.properties and update the last line with:
distributionUrl=https\://services.gradle.org/distributions/gradle-4.3-rc-2-all.zip
So i update the gradle version used for project dependencies.
Opening project in android studio fixes this by prompting to update gradle version.
What it works for me was to rollback to Java8
brew cask uninstall java
brew tap caskroom/versions
brew cask install java8
I don't think any of these workarounds are good.
In theory, updating to the latest gradle wrapper, and then upgrading gradle to only 3.3 and using the android plugin 2.3.0+ which might be compatible with RN might be a solution.
Same with version '10'. "Could not determine java version from '10'.
"
FAILURE: Build failed with an exception.
What went wrong:
Could not determine java version from '10.0.1'.
Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
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:
I follow lndgalante roll back to java8. That is!! it work for me
brew cask uninstall java
brew tap caskroom/versions
brew cask install java8
Same here...
For me, I change my java version to java 8. It's work.
This is Link @jorwan @ditsayakul
I had the error Could not determine java version from '10.0.2'.
I followed @alexanderkjeldaas 's advice and upgraded Gradle. This also made me update the minimum sdk version, but now react-native run-android
smoothly opens the app on the emulator.
I still see the warning WARNING: Configuration 'compile' is obsolete and has been replaced with 'implementation' and 'api'.
It will be removed at the end of 2018. For more information see: http://d.android.com/r/tools/update-dependency-configurations.html
, but at least the app runs for now
@Beamanator which gradle version are you using or how did you update your gradle? Am having the exact same error as yours. Downgrading to Android Studio 2.3 is not part of my "todo" list!
@ajharry69 I'm using the following versions:
Android Studio: 3.1.3 (you didn't ask, but I'm just letting you know)
Emulator: Nexus 5, API level 26
Gradle distributionUrl: https\://services.gradle.org/distributions/gradle-4.4-all.zip
-> Gradle Version: 4.4
Gradle refresh failed
Error:Could not resolve all dependencies for configuration ':app:debugAndroidTestRuntimeClasspath'.
Could not determine artifacts for com.android.support.test:runner:1.0.1
Could not get resource 'https://dl.google.com/dl/android/maven2/com/android/support/test/runner/1.0.1/runner-1.0.1.aar'.
Could not HEAD 'https://dl.google.com/dl/android/maven2/com/android/support/test/runner/1.0.1/runner-1.0.1.aar'.
dl.google.com
Closing this issue, because RN 0.56 uses gradle 4.x.
Well I am having this issue right now with RN 0.56
Could not determine java version from '10.0.2'.
although as you say that it should be gradle 4.x when I am trying to run ./gradlew assemblerelease it showed that it downloaded gradle 3.5
Same thing but for Java version 11.
$ react-native run-android
Scanning folders for symlinks in /Users/[redacted]/Code/[redacted]/node_modules (18ms)
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:
Could not determine java version from '11'.
Problem solved by changing the line in gradle-wrapper.properties
to distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-all.zip
which is the latest version as of right now. Still other problems but this solves this one.
I follow danielsellergren's latest comment installing:
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-all.zip
Got new error when running 'npm run android'
Most helpful comment
This work for me:
Edit the file /android/gradle/wrapper/gradle-wrapper.properties and update the last line with:
So i update the gradle version used for project dependencies.