patloew / RxLocation

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

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Cannot initialize RxLocation

dragoon opened this issue · comments

I got the following error while trying to initialize RxLocation with the application context:

java.lang.NoSuchMethodError: No static method metafactory(Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodType;)Ljava/lang/invoke/CallSite; in class Ljava/lang/invoke/LambdaMetafactory; or its super classes (declaration of 'java.lang.invoke.LambdaMetafactory' appears in /apex/com.android.runtime/javalib/core-oj.jar)

Any advice on what might be the issue?
Thanks.

This looks like it's a problem with Java 8 features, see this section of the readme:

From v1.0.4 on, RxLocation only works with Android gradle plugin 3.0.0 or higher, since it uses Java 8 language features.
And don't forget to set the source code compatibility to Java 8:

android {
  compileOptions {
    sourceCompatibility JavaVersion.VERSION_1_8
    targetCompatibility JavaVersion.VERSION_1_8
  }
}