[Android] Enable Kotlin support

Geoffrey Métais git at videolan.org
Mon Dec 11 16:42:19 CET 2017


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Mon Nov  6 16:55:55 2017 +0100| [1059b9c5aba9e6e623439f83202728a4a92aa3a6] | committer: Geoffrey Métais

Enable Kotlin support

> https://code.videolan.org/videolan/vlc-android/commit/1059b9c5aba9e6e623439f83202728a4a92aa3a6
---

 build.gradle             |  6 +++++-
 vlc-android/build.gradle | 14 ++++++++++++++
 2 files changed, 19 insertions(+), 1 deletion(-)

diff --git a/build.gradle b/build.gradle
index 77119c26a..f47fee01c 100644
--- a/build.gradle
+++ b/build.gradle
@@ -1,14 +1,18 @@
 // Top-level build file where you can add configuration options common to all sub-projects/modules.
 buildscript {
+    ext.android_plugin_version = '3.0.1'
+    ext.kotlin_version = '1.2.0'
+    ext.kotlinx_version = '0.20'
     repositories {
         flatDir dirs: "gradle/plugins"
         google()
         jcenter()
     }
     dependencies {
-        classpath 'com.android.tools.build:gradle:3.0.1'
+        classpath "com.android.tools.build:gradle:$android_plugin_version"
         classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.7.3'
         classpath 'com.github.dcendents:android-maven-gradle-plugin:1.5'
+        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
     }
 }
 
diff --git a/vlc-android/build.gradle b/vlc-android/build.gradle
index fbca5679e..feb81c3f0 100644
--- a/vlc-android/build.gradle
+++ b/vlc-android/build.gradle
@@ -1,4 +1,6 @@
 apply plugin: 'com.android.application'
+apply plugin: 'kotlin-android'
+apply plugin: 'kotlin-kapt'
 
 android {
     packagingOptions {
@@ -199,6 +201,7 @@ dependencies {
     implementation project(':medialibrary')
     implementation project(':api')
     implementation project(':axmlrpc')
+    // AppCompat
     implementation "com.android.support:recyclerview-v7:$rootProject.ext.appCompatVersion"
     implementation "com.android.support:design:$rootProject.ext.appCompatVersion"
     implementation "com.android.support:support-annotations:$rootProject.ext.appCompatVersion"
@@ -207,6 +210,17 @@ dependencies {
     implementation "com.android.support:preference-leanback-v17:$rootProject.ext.appCompatVersion"
     implementation "com.android.support.constraint:constraint-layout:$rootProject.ext.constraintLayoutVersion"
     testImplementation 'junit:junit:4.12'
+    // Kotlin
+    implementation "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
+    kapt "com.android.databinding:compiler:$rootProject.ext.android_plugin_version"
+    implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:$rootProject.ext.kotlinx_version"
+    implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$rootProject.ext.kotlinx_version"
+}
+
+kotlin {
+    experimental {
+        coroutines "enable"
+    }
 }
 
 static def buildTime() {



More information about the Android mailing list