dashman
dashman

Reputation: 3018

Nativescript - build error with NS 6 for Android

I'm building for Android on the Mac and I downloaded JDK 11 because of the gradle requirement.

I've got JDK 8 and that's the default - I'd like to specify JDK 11 for Gradle.

In app/App_Resources/Android - I created a new file gradle.properties

org.gradle.java.home=/Library/Java/JavaVirtualMachines/jdk-11.0.14.jdk/Contents/Home

I cleaned the platform and did a new build.

I'm getting the following error for a plugin

Build file '/Users/mini/Projects/ccs-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.

Reading some docs - I think maybe I need to set a file in the plugins Android folder???

Upvotes: 0

Views: 385

Answers (1)

Canmert
Canmert

Reputation: 106

If you have multiple versions of the JDK in your system, you can add the below line to your .zshenv file to specify the version as v11:

export JAVA_HOME=$(/usr/libexec/java_home -v"11")

then close & reopen the terminal or simply run source ~/.zshenv

Gradle should use the desired version now.

Upvotes: 1

Related Questions