Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
msx80 opened this issue Feb 27, 2024 · 0 comments
Open

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

msx80 opened this issue Feb 27, 2024 · 0 comments

Comments

@msx80
Copy link

msx80 commented Feb 27, 2024

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>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant