Ionic Could not determine java version


#1

I Get this error message when i run the app on device

You have been opted out of telemetry. To change this, run: cordova telemetry on.
[18:09:21]  lint finished in 14.96 s
ANDROID_HOME=/opt/android-sdk
JAVA_HOME=/usr/lib/jvm/default-java
Subproject Path: CordovaLib

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.

* Get more help at https://help.gradle.org
(node:9363) UnhandledPromiseRejectionWarning: Error: /home/hamdanihamza/Documents/ionic/Wydad/platforms/android/gradlew: Command failed with exit code 1 Error output:
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.

* Get more help at https://help.gradle.org
    at ChildProcess.whenDone (/home/hamdanihamza/Documents/ionic/Wydad/platforms/android/cordova/node_modules/cordova-common/src/superspawn.js:169:23)
    at emitTwo (events.js:126:13)
    at ChildProcess.emit (events.js:214:7)
    at maybeClose (internal/child_process.js:925:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)
(node:9363) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:9363) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

#2

Open your project in Android Studio it should prompt you to update your Gradle version.


#3

I’m using Ionic i don’t have android studio installed, i tried updating Gradle but the error persists.


#4

Looks like there is a mismatch between your Gradle version and your java version.

See: https://github.com/gradle/gradle/issues/3849