[Android] Enable Kotlin support

Geoffrey Métais git at videolan.org
Mon Nov 6 16:56:34 CET 2017


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

Enable Kotlin support

> https://code.videolan.org/videolan/vlc-android/commit/0e142472b2930780ae4f0be4b9193684092479ce
---

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

diff --git a/build.gradle b/build.gradle
index 7d3e216da..f1e15b66e 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.0'
+    ext.kotlin_version = '1.1.51'
+    ext.kotlinx_version = '0.19.3'
     repositories {
         flatDir dirs: "gradle/plugins"
         google()
         jcenter()
     }
     dependencies {
-        classpath 'com.android.tools.build:gradle:3.0.0'
+        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..96de903dc 100644
--- a/vlc-android/build.gradle
+++ b/vlc-android/build.gradle
@@ -1,4 +1,5 @@
 apply plugin: 'com.android.application'
+apply plugin: 'kotlin-android'
 
 android {
     packagingOptions {
@@ -199,6 +200,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 +209,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