Skip to content

java.lang.NoSuchMethodError: No static method metafactory #813

@msx80

Description

@msx80

hi there, i have the following error:

java.lang.NoSuchMethodError: No static method metafactory(Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodType;)Ljava/lang/invoke/CallSite; in class Ljava/lang/invoke/LambdaMetafactory; or its super classes (declaration of 'java.lang.invoke.LambdaMetafactory' appears in /apex/com.android.runtime/javalib/core-oj.jar)

The error originates from my source at a point where i use a lambda expression. I understand it's some kind of failed desugaring or similar?

Checking around, i've seen this solution that basically just tells to enable java 1.8 like this:

android {
    ...
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
}

I've added the following to my pom to try to mimic the directive:

  <properties>
    <maven.compiler.target>1.8</maven.compiler.target>
    <maven.compiler.source>1.8</maven.compiler.source>	
  </properties>

But it still doesn't work. (btw i'm understanding that 1.8 is the default?)

Do you have any suggestion on what i'm doing wrong or how to fix ?

My plugin config is like this:

      <plugin>
        <groupId>com.simpligility.maven.plugins</groupId>
        <artifactId>android-maven-plugin</artifactId>
        <configuration>
          <sdk>
            <platform>26</platform>
          </sdk>
            <dex>
               <dexArguments>--min-sdk-version=26</dexArguments>
            </dex>		  
        </configuration>
      </plugin>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions