D.Benamara
D.Benamara

Reputation: 41

Scala with android studio

I have a project in Java with Android studio 3.2, and I want to add some Scala files. I have already read this Using Scala with Java in Android Studio and I have some questions about it.

From what I understand, when you want to have java and scala files, it's better to use the gradle scala plugin instead of the scala plugin. But because the topic is rather old, I was wondering if it's still true, or if I should use the scala plugin.

Thanks for the answers and any advice!

Upvotes: 2

Views: 560

Answers (1)

KosWarm
KosWarm

Reputation: 626

I create fork this plugin https://github.com/AllBus/gradle-android-scala-plugin This version of the plugin supports Android 28 and Gradle 5.3

write this code in build.gradle file

buildscript {
    repositories {
        google()
        jcenter()
        maven { url 'https://jitpack.io' }
    }
    dependencies {

        classpath 'com.android.tools.build:gradle:3.3.2'
        classpath 'com.github.AllBus:gradle-android-scala-plugin:3.3.2'
    }
}

and add app/build.gradle

apply plugin: "com.android.application"
apply plugin: "jp.leafytree.android-scala"

android {
    compileSdkVersion 28
    ...

}

dependencies {
    implementation "org.scala-lang:scala-library:2.11.12"
    ...

}

Upvotes: 1

Related Questions