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

NoClassDefFoundError for Lamba expressions: java.lang.NoClassDefFoundError: com.example.sanuja.foodrunner.util.SharedPrefsUtil$$Lambda$1 #265

Closed samma89 closed 7 years ago

samma89 commented 7 years ago

Hi guys, I am having this issue when running the app on Huawei devices. Please help me to figure it out. Thanks. Android version - 6.0 OS - EMUI

I/art: Rejecting re-init on previously-failed class java.lang.Class<com.example.sanuja.foodrunner.util.SharedPrefsUtil$$Lambda$1> 11-15 12:45:45.812 15469-15469/com.example.sanuja.foodrunner E/UncaughtException: java.lang.NoClassDefFoundError: com.example.sanuja.foodrunner.util.SharedPrefsUtil$$Lambda$1 at com.example.sanuja.foodrunner.util.SharedPrefsUtil.setMapAsStringPreferences(SharedPrefsUtil.java:58) at com.example.sanuja.foodrunner.MainActivity.lambda$onCreate$0(MainActivity.java:67) at com.example.sanuja.foodrunner.MainActivity$$Lambda$1.onAuthStateChanged(Unknown Source) at com.google.firebase.auth.zzg.run(Unknown Source) at android.os.Handler.handleCallback(Handler.java:743) at android.os.Handler.dispatchMessage(Handler.java:95) at android.os.Looper.loop(Looper.java:150) at android.app.ActivityThread.main(ActivityThread.java:5665) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:799) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:689)

samma89 commented 7 years ago

I figured it out. That is because I've used HashMap's forEach() method which is only works in java 8. it works perfectly when it removed.