[英]Android + Scala + Intellij 13
Android is great platform. Android是很棒的平台。 Scala is great language.
Scala是很棒的语言。 Intellij Idea is great IDE.
Intellij Idea是一款出色的IDE。
How all of them can work together? 他们如何一起工作?
Note: It's a self answer. 注意:这是一个自我回答。 But if you have more info, please share it here.
但如果您有更多信息,请在此处分享。
Yes they can. 是的他们可以。
Prerequisites: Scala SDK installed. 先决条件:已安装Scala SDK。 Scala Intellij plugin installed.
已安装Scala Intellij插件。 Android Intellij plugins enabled.
已启用Android Intellij插件。
No SBT and third party plugins needed. 不需要SBT和第三方插件。 No Gradle.
没有Gradle。 Gradle support is not yet compatible with Scala plugin.
Gradle支持尚未与Scala插件兼容。 Inform me if it is.
如果是,请通知我。
I use successfuly Scala 2.11.7 + Android Studio + Gradle with this plugin gradle-android-scala-plugin and current config: 我成功使用Scala 2.11.7 + Android Studio + Gradle与此插件gradle-android-scala-plugin和当前配置:
build.gradle 的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 应用程序/的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 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 *;
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.