koush / ion

Android Asynchronous Networking and Image Loading
Other
6.29k stars 1.03k forks source link

Ion crash after upgrading Android Studio 4.1.1 - Ion version 3.1.0 #942

Closed rcastrucci closed 4 years ago

rcastrucci commented 4 years ago

My app was working perfectly fine with ION but after upgrading the app to 4.1.1, it gives me the below fatal exception.

E/AndroidRuntime: FATAL EXCEPTION: main 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) at com.koushikdutta.async.future.SimpleFuture.setCallback(SimpleFuture.java:216) at com.koushikdutta.ion.IonRequestBuilder.resolveAndLoadRequest(IonRequestBuilder.java:389) at com.koushikdutta.ion.IonRequestBuilder.getLoaderEmitter(IonRequestBuilder.java:353) at com.koushikdutta.ion.IonRequestBuilder.getLoaderEmitter(IonRequestBuilder.java:317) at com.koushikdutta.ion.IonRequestBuilder.execute(IonRequestBuilder.java:686) at com.koushikdutta.ion.IonRequestBuilder.execute(IonRequestBuilder.java:641) at com.koushikdutta.ion.IonRequestBuilder.asJsonObject(IonRequestBuilder.java:692)

koush commented 4 years ago

Can you make sure you are targetting jvm 1.8

rcastrucci commented 4 years ago

@koush Thanks a lot for your reply! I did what you told me, downgrade Ion for 2.2.1 and now it is working properly! No bugs. Thanks a lot!

koush commented 4 years ago

Sorry, I was wrong. 3.x is the latest. Can you try the suggestion above?

rcastrucci commented 4 years ago

@koush you right! I guess I wasn't targeting jvm

added this lines on my build gradle and it is working properly! Using Ion version 3.1.0 now!

compileOptions {
    sourceCompatibility JavaVersion.VERSION_1_8
    targetCompatibility JavaVersion.VERSION_1_8
}