evant / gradle-retrolambda

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

ClassNotFoundException in Marshmallow and below #238

Closed rmtmckenzie closed 7 years ago

rmtmckenzie commented 7 years ago

Hi all,

I'm running into a fun issue on older(ish) android phones. Basically, I'm building a project that includes retrolambda. It compiles fine but when I run the app I'm running into this error after a few screens: java.lang.NoClassDefFoundError: .....interactors.RegistrationLoadingInteractor$$Lambda$1 caused by java.lang.ClassNotFoundException:....interactors.RegistrationLoadingInteractor$$Lambda$1

I'm fairly sure that isn't the first time anything generated by retrolambda is used, so I don't really know what's going on.

My primary development phone runs Nougat and it works fine there, but when I put it on phones running marshmallow or below I'm getting the error and a crash.

I've opened the apk and looked at the dex files and the class in question is definitely there.

I'm using me.tatarka:gradle-retrolambda:3.5.0, multiDexEnabled, with the suggested proguard rules, com.android.toold.build:gradle:2.2.3, buildToolsVersion 25.0.2. I'm applying the retrolambda plugin after com.android.application but before realm-android and com.google.gms.google-services if that makes any difference. I've also tried manually setting retrolambda to 2.5.1.

Unfortunately I can't release the source for this, but if anyone else has come across anything similar and has a fix I'd be very appreciative. If not then I could try to make a simple project to reproduce but I'm a little low on time at the moment...

Thanks!

rmtmckenzie commented 7 years ago

Just realized I opened this in gradle-retrolambda not retrolambda itself; I'll close it here and open there as that's probably a much more appropriate place for it.