使用 Lambda“找不到符号方法元工厂”

2023-12-26

我在用着java 8 and lambda表达式。当我使用 lambda 表达式时OnClickListeners一切都很好,但是当我在这个中使用它时animate方法:

public void configureFragmentToolbar(String title, boolean displayHomeAsUpEnabled) {
   //..
    this.toolbar.animate().translationY(-50).setDuration(300).withEndAction(() -> { //ERROR
        toolbar.animate().translationY(0).setDuration(300);
    });
}

我收到此错误:

"error: cannot find symbol method metafactory(Lookup,String,MethodType,MethodType,MethodHandle,MethodType)"

gradle:

apply plugin: 'com.android.library'
apply plugin: 'com.neenbedankt.android-apt'
apply plugin: 'org.sonarqube'

def junitVersion = '4.12'
def mockitoVersion = '1.10.19'
def daggerVersion = '2.5'

android {
    compileSdkVersion 27
    buildToolsVersion "27.0.3"
    lintOptions {
        abortOnError false
    }
    defaultConfig {
        minSdkVersion 14
        targetSdkVersion 27
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }

    compileOptions {
        targetCompatibility 1.8
        sourceCompatibility 1.8
    }
}


dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile project(':commons')

    compile 'com.android.support:appcompat-v7:27.0.2'
    compile 'com.android.support.constraint:constraint-layout:1.0.2'
    compile 'com.android.support:design:27.0.2'
    testCompile "junit:junit:$junitVersion"
    testCompile "org.mockito:mockito-core:$mockitoVersion"

    apt "com.google.dagger:dagger-compiler:$daggerVersion"
}

你能告诉我为什么我会收到这个错误吗?谢谢


In $ANDROID_SDK/build-tools/27.0.3/, missing the file : core-lambda-stubs.jar。您只需要重新安装构建工具即可。

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

使用 Lambda“找不到符号方法元工厂” 的相关文章

随机推荐