patloew / RxLocation

🗺 [DEPRECATED] Reactive Location APIs Library for Android and RxJava 2

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

java.lang.NoSuchMethodError when migrating to Android O

alouanemed opened this issue · comments

I just updated to Android O and this error occured :

java.lang.NoSuchMethodError: No static method lambda$onGoogleApiClientReady$0(Lcom/patloew/rxlocation/SettingsCheckHandleSingleOnSubscribe;Lio/reactivex/SingleEmitter;Lcom/google/android/gms/location/LocationSettingsResult;)V in class Lcom/patloew/rxlocation/SettingsCheckHandleSingleOnSubscribe; or its super classes (declaration of 'com.patloew.rxlocation.SettingsCheckHandleSingleOnSubscribe' appears in /data/app/com.app.appx.debug-2/base.apk)
                                                                                          at com.patloew.rxlocation.SettingsCheckHandleSingleOnSubscribe$$Lambda$1.onResult(Unknown Source)
                                                                                          at com.google.android.gms.internal.zzaaf$zza.zzb(Unknown Source)
                                                                                          at com.google.android.gms.internal.zzaaf$zza.handleMessage(Unknown Source)
                                                                                          at android.os.Handler.dispatchMessage(Handler.java:102)
                                                                                          at android.os.Looper.loop(Looper.java:154)
                                                                                          at android.app.ActivityThread.main(ActivityThread.java:6121)
                                                                                          at java.lang.reflect.Method.invoke(Native Method)
                                                                                          at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:889)
                                                                                          at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:779)

I Am using rxlocation:1.0.3 and RxJava 2

i also have this problem..

It seems to be a problem with the new Android Gradle plugin 3.0.0 clashing with Retrolambda. Updating the plugin and removing Retrolambda from the library solves the problem.

Please use Android Studio 2.3.3 for testing with Android O. When Android Studio 3.0.0 stable is released, I'll update the library to remove Retrolambda, since the Android Gradle plugin then can consume Java 8 libraries.

Thank for the reply Patrick , I wonder if we can have 2 branches : stable and preview?
Thanks.

There are no plans to support preview versions of Android Studio. Usually, preview versions don't make problems though. The problem here are changes to the way Java 8 stuff is supported in Android Studio in the future.

This is probably caused by a bug in the Gradle Java 8 language feature desugaring that is tracked in https://issuetracker.google.com/issues/62456849

desugar seems to blindly rename the synthetic methods in a class file if their name starts with lambda$ (appending the owner class name) regardless of whether a reference to that method already exists in the bytecode (and that reference doesn't get renamed too!).

When the code path hits such a reference at runtime the obvious result is a NoSuchMethodError because a method with that name doesn't exist anymore.

is updated now to android studio 3 stable

Removed Retrolambda in v1.0.4.