jvoegele/gradle-android-plugin — Issue #48: Android Scala code not packaging properly
Author: dentharg
Created: 2012-02-19 21:00:11+00:00
State: open

I've created a simple project containing single activity in src/main/scala/MainActivity.scala containing nothing but onCreate() that loads a layout.

Based on documentation I've created `build.gradle`:

apply plugin: 'scala'

/// For Android plugin
buildscript {
repositories {
mavenCentral()
}

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

apply plugin: 'android'

repositories {
maven {
url = "http://scala-tools.org/repo-releases/"
}
}

dependencies {
scalaTools 'org.scala-lang:scala-library:2.9.1'
scalaTools 'org.scala-lang:scala-compiler:2.9.1'
compile 'org.scala-lang:scala-library:2.9.1'
}

sourceSets {
main {
scala {
srcDir 'src'
}
}
}

version = "0.1"

androidSignAndAlign {
keyStore = "~/.android/debug.keystore"
keyAlias = "androiddebugkey"
keyStorePassword = "android"
keyAliasPassword = "android"
}

processResources {
expand (project.properties)
}

task configureDebug << {
jar.classifier = "debug"
proguard.enabled = false
}

Executing `gradle configureDebug assemble` gives:

gradle configureDebug assemble
fileTree(Closure) is a deprecated method. Use fileTree((Object){ baseDir }) to have the closure used as the file tree base directory
:configureDebug
:androidProcessResources UP-TO-DATE
:compileJava UP-TO-DATE
:compileScala UP-TO-DATE
:processResources UP-TO-DATE
:classes UP-TO-DATE
:jar UP-TO-DATE
:proguard SKIPPED
:androidPackage
[ant:apply]
[ant:apply] trouble writing output: No expanded opcode for 6a195661 App.scala:60@0001: invoke-direct v0:NffffLscala/App$$anonfun$main$1;, scala.runtime.AbstractFunction1.:()V

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':androidPackage'.
> apply returned: 2

`gradle -v`

Gradle 1.0-milestone-8

Gradle build time: poniedziałek, 13 luty 2012 23:53:32 UTC
Groovy: 1.8.4
Ant: Apache Ant(TM) version 1.8.2 compiled on December 20 2010
Ivy: 2.2.0
JVM: 1.6.0_26 (Sun Microsystems Inc. 20.1-b02)
OS: Linux 3.0.0-16-generic amd64