我有一个
Android应用程序模块,它使用了jdk 8并启用了Jack Options.然后我将其转换为Android库模块.然后我必须从build gradle中删除Jack Options.现在,当我尝试构建AAR文件时,Lambda表达式给出了以下错误.
Error:(59, 25) error: cannot find symbol method metafactory(Lookup,String,MethodType,MethodType,MethodHandle,MethodType)
给出此错误的代码是,
Runnable r= () -> {
appManager.startApp(definition,identifier);
};
我的Build Gradle是
Apply plugin: 'com.android.library'
android {
compileSdkVersion 26
buildToolsVersion "26.0.0"
defaultConfig {
minSdkVersion 18
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:26.+'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
testCompile 'junit:junit:4.12'
}
这个问题的原因是什么?
最佳答案 你忘了应用复古的lambda插件.
将此行添加到build.gradle文件中:
apply plugin: 'me.tatarka.retrolambda'