我是 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 类未编译。
最佳答案
使用正确的插件实际上要简单得多:
https://github.com/saturday06/gradle-android-scala-plugin
这对我来说效果很好。
您只需要在您的 gradle 配置中增加大约 3 行,并可能使用 proguard 来减小 apk 的大小。
设置在 github 页面上有详细记录。步骤 1-3 之外的所有内容都是可选的。
关于安卓 Scala 和 Gradle,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13147443/