pcu
pcu

Reputation: 2735

Android Scala and Gradle

I am new to Gradle. Is there some example how to configure properly gradle-android-plugin for scala classes.

this is what I have now.

buildscript {
repositories {  mavenCentral()  }

dependencies {  classpath 'org.gradle.api.plugins:gradle-android-plugin:1.2.1'  }
}

apply plugin: 'android'
apply plugin: 'eclipse'
apply plugin: 'scala'

sourceCompatibility = 1.6
version = "1.0.0"

repositories { mavenCentral() }

dependencies {  
    compile files('/home/pcu/workspace/workspace-android/emoo/libs/android-support-v4.jar') 
    compile 'org.scala-lang:scala-library:2.9.1'
    scalaTools 'org.scala-lang:scala-compiler:2.9.1'
    scalaTools 'org.scala-lang:scala-library:2.9.1'
}


task configureDebug << {  jar.classifier = "debug"  }


task configureRelease << {  proguard.enabled = true  }

but compilation fails. Scala class is not compiled.

Upvotes: 4

Views: 1441

Answers (1)

Ostkontentitan
Ostkontentitan

Reputation: 7010

It is actually much simpler with the right plugin:

https://github.com/saturday06/gradle-android-scala-plugin

This worked perfectly fine for me.

You need only about 3 more lines in your gradle configuration and potentially proguard to reduce the apk size.

The setup is well documented on the github page. Everything beyond steps 1-3 is optional.

Upvotes: 1

Related Questions