首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >Android + Scala + Intellij 13

Android + Scala + Intellij 13
EN

Stack Overflow用户
提问于 2014-05-16 21:37:28
回答 2查看 4.7K关注 0票数 18

Android是一个很棒的平台。Scala是一门很棒的语言。Intellij Idea是一个很棒的IDE。

他们怎么能一起工作呢?

注意:这是一个自我回答。但是如果你有更多的信息,请在这里分享。

EN

回答 2

Stack Overflow用户

发布于 2015-07-03 18:54:04

我使用Scala 2.11.7 + Android Studio + Gradle成功使用了这个插件gradle-android-scala-plugin和当前配置:

build.gradle

代码语言:javascript
复制
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

代码语言:javascript
复制
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

代码语言:javascript
复制
-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 *;
}
票数 7
EN

Stack Overflow用户

发布于 2014-05-19 17:56:22

有关此问题的更多意见,请参阅this discussion

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/23696560

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档