Android studioでretrolambdaを使用する前の構成
3135 ワード
1.まずAndroid studioのjdkは1.8である必要がある.プロジェクトのbuild.gradleには
以下はこの全体のファイル内容ファイル名です:build.gradle(Project:RxJavaTest)
ファイル名:build.gradle
完了したら同期に成功しました.公式の説明:https://github.com/evant/gradle-retrolambda
mavenCentral()
とclasspath 'me.tatarka:gradle-retrolambda:3.5.0'
を追加する必要がある.Moudleのbuild.gradleで追加する必要がありますapply plugin: 'me.tatarka.retrolambda'
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
以下はこの全体のファイル内容ファイル名です:build.gradle(Project:RxJavaTest)
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.1.3'
classpath 'me.tatarka:gradle-retrolambda:3.5.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
ファイル名:build.gradle
apply plugin: 'com.android.application'
apply plugin: 'me.tatarka.retrolambda'
android {
compileSdkVersion 24
buildToolsVersion "24.0.3"
defaultConfig {
applicationId "com.hicore.rxjavatest"
minSdkVersion 18
targetSdkVersion 24
versionCode 1
versionName "1.0"
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:24.2.1'
compile 'io.reactivex:rxjava:1.0.14'
compile 'io.reactivex:rxandroid:1.0.1'
}
完了したら同期に成功しました.公式の説明:https://github.com/evant/gradle-retrolambda