From 2287e8379091bc4c492d33245f0e48e4bfc61b8a Mon Sep 17 00:00:00 2001 From: ypbnv Date: Thu, 16 Jan 2020 15:19:03 +0200 Subject: [PATCH] fix(android): fix support for Java 8 in Kotlin --- android/templates/build/app.build.gradle | 1 - android/templates/module/generated/build.gradle | 6 +++++- android/titanium/build.gradle | 1 - 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/android/templates/build/app.build.gradle b/android/templates/build/app.build.gradle index 1e6236ff467..43663f6ddd7 100644 --- a/android/templates/build/app.build.gradle +++ b/android/templates/build/app.build.gradle @@ -29,7 +29,6 @@ android { } <% } %> } - // TODO: Add Java 8 support in the future. compileOptions { sourceCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8 diff --git a/android/templates/module/generated/build.gradle b/android/templates/module/generated/build.gradle index f8557f7fa94..5bb9e06deca 100644 --- a/android/templates/module/generated/build.gradle +++ b/android/templates/module/generated/build.gradle @@ -120,7 +120,7 @@ android { } } } - // TODO: Add Java 8 support in the future. + compileOptions { sourceCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8 @@ -131,6 +131,10 @@ android { exclude '/lib/**/libc++_shared.so' exclude '/lib/**/libkroll-v8.so' } + // Sets the JVM target in order to allow usage of Java 8 features in Kotlin native modules. + kotlinOptions { + jvmTarget = '1.8' + } } tasks.withType(JavaCompile) { diff --git a/android/titanium/build.gradle b/android/titanium/build.gradle index 65510a8d2e8..1f1e68da4e5 100644 --- a/android/titanium/build.gradle +++ b/android/titanium/build.gradle @@ -103,7 +103,6 @@ android { ] } } - // TODO: Add Java 8 support in the future. compileOptions { sourceCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8