android 3.0 java8_使用Android Studio 3.0 Java 8内置功能替换Retrolambda

在我的项目中,我使用流行的库retrolambda。

我刚刚下载了新的Android Studio 3.0 Canary 1。

我已经更新了我的项目,以使用新版本的Gradle等。一切都很好。

Android Studio 3中的新功能是为了支持某些Java8功能而构建的。

新的AS3建议删除retrolambda并使用这些功能。

BH6Iq.png

我已经删除retrolambda,Gradle构建成功,但应用程序崩溃与此错误(在有lambda的地方)

E/UncaughtException: java.lang.NoSuchMethodError: No static method lambda$replace$2我在我的项目中使用RxJava2。我不确定这与它有关系,但看起来像我的情况下,Java8的内置功能无法正常工作。也许我需要设置一些“某处”?

我的项目设置8ef3940b0bf6d8ff18d9c6d2268054e2.png

我的Gradle文件

根项目

dependencies {

classpath 'com.android.tools.build:gradle:3.0.0-alpha1'

classpath 'com.google.gms:google-services:3.0.0'

//classpath 'me.tatarka:gradle-retrolambda:3.6.1'

}App模块

buildscript {

repositories {

jcenter()

}

dependencies {

classpath 'com.jakewharton.hugo:hugo-plugin:1.2.1'

classpath 'com.jakewharton:butterknife-gradle-plugin:8.5.1'

}

}

repositories {

mavenCentral()

maven { url "https://jitpack.io" }

}

apply plugin: 'com.android.application'

apply plugin: 'com.jakewharton.hugo'

...

compile 'com.android.support:multidex:1.0.1'

compile 'com.google.firebase:firebase-analytics:9.8.+'

compile 'com.google.firebase:firebase-crash:9.8.+'

compile 'com.google.android.gms:play-services-maps:9.8.+'

compile 'com.google.android.gms:play-services-analytics:9.8.+'

compile 'com.google.android.gms:play-services-auth:9.8.+'

compile 'com.github.PhilJay:MPAndroidChart:v3.0.1'

//Support Library

(...)

compile 'com.squareup.retrofit2:retrofit:2.2.0'

compile 'com.squareup.retrofit2:converter-gson:2.2.0'

compile 'com.google.maps.android:android-maps-utils:0.4'

/* RXJAVA2 */

compile 'io.reactivex.rxjava2:rxjava:2.0.6'

compile 'io.reactivex.rxjava2:rxandroid:2.0.1'

compile 'com.squareup.retrofit2:adapter-rxjava2:2.2.0'

compile 'com.github.VictorAlbertos:ReactiveCache:1.1.0-2.x'

compile 'com.github.VictorAlbertos.Jolyglot:gson:0.0.3'

android {

compileSdkVersion 25

buildToolsVersion '25.0.2'

defaultConfig {

applicationId "my_app_id"

minSdkVersion 15

targetSdkVersion 25

multiDexEnabled true

vectorDrawables.useSupportLibrary = true

testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"

}

(...)

dexOptions {

javaMaxHeapSize "4g"

}

lintOptions {

abortOnError false

}

}

buildTypes {

debug {

minifyEnabled false

shrinkResources false

}

debugpro {

minifyEnabled true

shrinkResources false

proguardFile file('proguard-project.txt')

proguardFile file('proguard-google-api-client.txt')

//noinspection GroovyAssignabilityCheck

signingConfig signingConfigs.debug

}

release {

minifyEnabled true

shrinkResources false

proguardFile file('proguard-project.txt')

proguardFile file('proguard-google-api-client.txt')

}

releaseci {

minifyEnabled true

shrinkResources false

proguardFile file('proguard-project.txt')

proguardFile file('proguard-google-api-client.txt')

//noinspection GroovyAssignabilityCheck

signingConfig signingConfigs.releaseci

}

(...)

compileOptions {

sourceCompatibility JavaVersion.VERSION_1_8

targetCompatibility JavaVersion.VERSION_1_8

}

}

apply plugin: 'com.google.gms.google-services'

apply plugin: 'com.jakewharton.butterknife'

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值