ade*_*dek 15 android retrolambda android-studio-3.0
在我的项目中,我使用的是受欢迎的图书馆retrolambda.我刚刚下载了新的Android Studio 3.0 Canary 1.
我已经更新了我的项目以使用Gradle等新版本.一切都很好.
Android Studio 3中的新功能是为了支持某些Java8功能而构建的.新的AS3建议删除retrolambda并使用这些功能.
我删除了retrolambda,Gradle构建成功但是应用程序崩溃了这个错误(在有lambda的地方)
E/UncaughtException: java.lang.NoSuchMethodError: No static method lambda$replace$2
Run Code Online (Sandbox Code Playgroud)
我在我的项目中使用RxJava2.我不确定这与它有关,但在我看来,Java8的内置功能看起来不起作用.也许我需要在"某个地方"设置一些东西?
我的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'
}
Run Code Online (Sandbox Code Playgroud)
应用模块
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'
Run Code Online (Sandbox Code Playgroud)
这可能是由https://issuetracker.google.com/issues/62456849中跟踪的 Gradle Java 8 语言功能脱糖中的错误引起的
desugar如果类文件中的合成方法的名称以lambda$(附加所有者类名)开头,则似乎会盲目地重命名类文件中的合成方法,无论字节码中是否已存在对该方法的引用(并且该引用也不会被重命名)。
当代码路径在运行时遇到此类引用时,明显的结果是 a NoSuchMethodError,因为具有该名称的方法不再存在。
| 归档时间: |
|
| 查看次数: |
3556 次 |
| 最近记录: |