Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"cannot find symbol method metafactory" using Lambda

I'm using java 8 and lambda expressions. When I use lambda expressions with OnClickListeners everything is fine, but when I use that in this animate method:

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

I´m getting this error:

"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"
}

Can you tell me why I'm getting that error? Thank you

like image 666
Fabio Venturi Pastor Avatar asked Jan 24 '18 16:01

Fabio Venturi Pastor


1 Answers

In $ANDROID_SDK/build-tools/27.0.3/, missing the file : core-lambda-stubs.jar. You just need reinstall the build tool.

like image 75
successfox Avatar answered Nov 17 '22 06:11

successfox