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 virtual method #30

Open
wjs9715 opened this issue May 23, 2017 · 8 comments
Open

java.lang.NoSuchMethodError: No virtual method #30

wjs9715 opened this issue May 23, 2017 · 8 comments

Comments

@wjs9715
Copy link

wjs9715 commented May 23, 2017

Hello, now I am using reductor for the android project.

For the Store, I had no problem subscribing and canceling the subscription with the retrolambda, but when I use the java 8 lambda expression, I get a following error when I try to cancel the subscription.

java.lang.NoSuchMethodError: No virtual method com_yheriatovych_reductor_Store$$Lambda$2_lambda$subscribe$0(Lcom/yheriatovych/reductor/StateChangeListener;)V in class Lcom/yheriatovych/reductor/Store; or its super classes (declaration of 'com.yheriatovych.reductor.Store' appears in /data/app/com.queuehop.deserteagle-1/base.apk) at com.yheriatovych.reductor.Store$$Lambda$2.cancel(Unknown Source)
Is reductor not compatible with the java's lamda statement?

@SaeedMasoumi
Copy link

@Yarikx Same issue

@Yarikx
Copy link
Owner

Yarikx commented May 28, 2017

Wow, that's surprising. It's actually compiled with retrolambda into a single jar, but if it creates such problems I might just undo all the lambdas in the code.

@wjs9715 @SaeedMasoumi Is it happening only in proguarded builds?

@sandsaber
Copy link

sandsaber commented May 30, 2017

Java.lang.NoSuchMethodError: No static method lambda$create$0(Lcom/yheriatovych/reductor/Dispatcher;
Lio/reactivex/subjects/PublishSubject;Ljava/lang/Object;)V in class Lcom/yheriatovych/reductor/observable/rxjava2/EpicMiddleware; 
or its super classes (declaration of 'com.yheriatovych.reductor.observable.rxjava2.EpicMiddleware' appears in 
                                                     at com.yheriatovych.reductor.observable.rxjava2.EpicMiddleware$$Lambda$4.dispatch(Unknown Source)

Using Android Studio 3.0 with java 8, debug build

@sandsaber
Copy link

Adding latest retrolambda 'me.tatarka:gradle-retrolambda:3.6.1' solve the problem, but... AS giving nice error:

Warning:One of the plugins you are using supports Java 8 language features. To try the support built into the Android plugin, remove the following from your build.gradle:
    apply plugin: 'me.tatarka.retrolambda'
To learn more, go to https://d.android.com/r/tools/java-8-support-message.html

@SaeedMasoumi
Copy link

SaeedMasoumi commented May 31, 2017

@wjs9715 No it happened in both proguarded and non-proguarded builds

@SaeedMasoumi
Copy link

@Yarikx Any update?

@Yarikx
Copy link
Owner

Yarikx commented Jun 9, 2017

Ok, I found how to reproduce it. It indeed happens for some lambdas ONLY with new Android Java 8 desugaring.
Seems like Google desugar also process libraries and change some methods (even though the library has Java 6 bytecode).

Looks more like a bug in Google tool (as it's still alpha version), I'll investigate it a bit more for now. In the worst case, I'll just unwrap all the lambdas, but I hope I'll find a better way.

As a workaround, you can still disable new Java 8 desugaring and enable retrolambda instead.

@stefan-zobel
Copy link

FWIW, this is a bug in the Gradle Java 8 language feature desugaring that is tracked in https://issuetracker.google.com/issues/62456849

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

5 participants