Explicit expression in android library module not working

I had an Android module for Android that was using jdk 8 and enabled Jack options. Then I convert it to Android library module. And then I need to remove Jack Options from the gradle build. And now the Lambda expression throws the below error when I try to create an AAR file.

Error:(59, 25) error: cannot find symbol method metafactory(Lookup,String,MethodType,MethodType,MethodHandle,MethodType)

      

The code indicating this error is

Runnable r= () -> {
      appManager.startApp(definition,identifier);
};

      

My Build Gradle is

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

      

What is the cause of this problem?

+4


source to share


2 answers


You forgot to apply the retro lambda plugin.

Add this line to your build.gradle file:



apply plugin: 'me.tatarka.retrolambda'

      

+1


source


On my machine, I was missing a file $ANDROID_SDK/build-tools/28.0.3/core-lambda-stubs.jar

, so I had to reinstall version 28.0.3 of the build tools using the Android Studio SDK manager.



(I had to check "Show Package Details" to see a complete list of build tool versions)

0


source







All Articles