Android是一个很棒的平台。Scala是一门很棒的语言。Intellij Idea是一个很棒的IDE。
他们怎么能一起工作呢?
注意:这是一个自我回答。但是如果你有更多的信息,请在这里分享。
发布于 2015-07-03 18:54:04
我使用Scala 2.11.7 + Android Studio + Gradle成功使用了这个插件gradle-android-scala-plugin和当前配置:
build.gradle
buildscript {
repositories {
jcenter()
mavenCentral()
maven {
url "http://saturday06.github.io/gradle-android-scala-plugin/repository/snapshot"
}
}
dependencies {
classpath 'com.android.tools.build:gradle:1.0.1'
classpath 'jp.leafytree.gradle:gradle-android-scala-plugin:1.3.2'
classpath "org.scala-lang:scala-library:2.11.7"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
app/build.gradle
apply plugin: 'com.android.application'
apply plugin: "jp.leafytree.android-scala"
android {
compileSdkVersion 22
buildToolsVersion "19.1.0"
defaultConfig {
applicationId "com.example.adray.myapplication"
minSdkVersion 15
targetSdkVersion 19
versionCode 1
versionName "1.0"
}
lintOptions {
abortOnError false
}
sourceSets {
main {
scala {
srcDir "src/main/scala" // default: "src/main/scala"
}
}
androidTest {
scala {
srcDir "src/androidTest/scala" // default: "src/androidTest/scala"
}
}
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
debug {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.github.satyan:sugar:1.3'
compile 'org.scala-lang:scala-library:2.11.7'
compile 'com.google.android.gms:play-services:7.5.0'
compile 'com.android.support:appcompat-v7:22.2.0'
}
repositories {
mavenCentral()
jcenter()
}
proguard-rules.pro
-dontoptimize
-dontobfuscate
-dontpreverify
-dontwarn scala.**
-dontwarn android.support.v4.app.**
-dontwarn android.support.v4.view.**
-dontwarn android.support.v4.widget.**
-ignorewarnings
# temporary workaround; see Scala issue SI-5397
-keep class scala.collection.SeqLike {
public protected *;
}
发布于 2014-05-19 17:56:22
有关此问题的更多意见,请参阅this discussion。
https://stackoverflow.com/questions/23696560
复制相似问题