evant / gradle-retrolambda

A gradle plugin for getting java lambda support in java 6, 7 and android
Apache License 2.0
5.3k stars 447 forks source link

NoSuchMethodError? #281

Open SillyRabbite opened 5 years ago

SillyRabbite commented 5 years ago

i was trying add an flutter module(which request host app java1.8 compile compileOptions { sourceCompatibility 1.8 targetCompatibility 1.8 }) to an existing app(which has to stay in java 1.7 because of butternife and someother pluginin) so i apply plugin me.tatarka:gradle-retrolambda:3.6.1 to the host app. it will compile correct. but in runtime app crash because NoSuchMethodError like:

07-11 11:57:52.630 6726 6726 E AndroidRuntime: java.lang.NoSuchMethodError: No direct method lambda$initAccountView$2(Landroid/view/View;)V in class Lcom/meituan/epasspo rt/core/controller/extra/DefaultPagerAdapter; or its super classes (declaration of 'com.meituan.epassport.core.controller.extra.DefaultPagerAdapter' appears in /data/app/c om.sankuai.meituan.meituanwaimaibusiness-WyCD2GxSv5brl1ZkqBQvmw==/base.apk!classes3.dex)

i try more find the crash caused by a library use me.tatarka:gradle-retrolambda:2.3.4. plugin to compile lamda in java 1.7 so what happened here? why different versions of me.tatarka:gradle-retrolambda(3.6.1 in app, 2.3.4 in library) cause crashs? and how could i avoid this runtime crashs(it is dangerous bacause i have no idea how many libraries of my host app use plugin me.tatarka:gradle-retrolambda)?

SillyRabbite commented 5 years ago

by the way if i upgrade my library's me.tatarka:gradle-retrolambda verison to the host appversion(from 2.3.4 to 3.6.1) the crashed will fixed. but i still need a more solid solution and the reasons. any suggestion or hints will be grateful, thanks!