4

我是 Gradle 的新手。是否有一些示例如何为 scala 类正确配置 gradle-android-plugin。

这就是我现在所拥有的。

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  }

但编译失败。Scala 类未编译。

4

1 回答 1

1

使用正确的插件实际上要简单得多:

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

这对我来说非常好。

您只需要在 gradle 配置中再增加大约 3 行代码,并且可能需要 proguard 来减少 apk 大小。

该设置在 github 页面上有详细记录。步骤 1-3 之外的所有内容都是可选的。

于 2015-04-10T09:10:45.933 回答