What is the simplest way to mix Java+Scala in an Android project using Gradle?

前端 未结 2 1690
-上瘾入骨i
-上瘾入骨i 2021-01-20 09:55

What is the simplest way to mix Java+Scala in an Android project using Gradle ?

Is it using https://github.com/saturday06/gradle-android-scala-plugin ?

I am

2条回答
  •  傲寒
    傲寒 (楼主)
    2021-01-20 10:36

    Use Android studio 3.3.2 and create Android project.

    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"
        ...
    
    }
    

提交回复
热议问题