'Nativescript Android build fails suddenly (NS6)
My Nativescript 6 Android build suddenly is failing - I didn't update any modules except for the NS CLI 8.2.3 - but the tns-android is 6.5.x
FAILURE: Build failed with an exception.
* Where:
Build file '/Users/mini/Projects/app-mobile/platforms/tempPlugin/nativescript_webview_ext/build.gradle' line: 6
* What went wrong:
A problem occurred evaluating root project 'nativescript_webview_ext'.
> Failed to apply plugin 'com.android.internal.library'.
> Android Gradle plugin requires Java 11 to run. You are currently using Java 1.8.
You can try some of the following options:
- changing the IDE settings.
- changing the JAVA_HOME environment variable.
- changing `org.gradle.java.home` in `gradle.properties`.
* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 684ms
Failed to build plugin @nota/nativescript-webview-ext :
Error: Command ./gradlew failed with exit code 1
Again this was working before the CLI update.
I'm using Java 1.8 - seems to be a big jump to Java 11.
Solution 1:[1]
Failed to apply plugin 'com.android.internal.library'.
Android Gradle plugin requires Java 11 to run. You are currently using Java 1.8.
You can try some of the following options:
- changing the IDE settings.
- changing the JAVA_HOME environment variable.
- changing `org.gradle.java.home` in `gradle.properties`.
As it can be read from the error message, gradle is expecting jdk 11 and you have jdk 8 configured. Install jdk 11 on the system and set JAVA_HOME environment variable to point to it.
This is probably happening because nativescript 8.2.3 seems to be using gradle 7 and it expects jdk 11. You can specify gradle version in a somewhat hacky way likewise: How can I downgrade the Gradle in NativeScript?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | leogps |
