square / retrofit

A type-safe HTTP client for Android and the JVM
https://square.github.io/retrofit/
Apache License 2.0
43.02k stars 7.3k forks source link

After enable R8 full mode getting ParameterizedType error #3751

Closed NG-Gaurav closed 8 months ago

NG-Gaurav commented 2 years ago

Accessing hidden method Ljava/security/spec/ECParameterSpec;->setCurveName(Ljava/lang/String;)V (greylist, reflection, allowed) 16:09:29.013 W java.lang.ClassCastException: java.lang.Class cannot be cast to java.lang.reflect.ParameterizedType 16:09:29.014 W at retrofit2.HttpServiceMethod.parseAnnotations(SourceFile:46) 16:09:29.014 W at retrofit2.ServiceMethod.parseAnnotations(SourceFile:39) 16:09:29.014 W at retrofit2.Retrofit.loadServiceMethod(SourceFile:202) 16:09:29.014 W at retrofit2.Retrofit$1.invoke(SourceFile:160) 16:09:29.014 W at java.lang.reflect.Proxy.invoke(Proxy.java:1006) 16:09:29.014 W at $Proxy6.generateAnonymousAuthTokenAsyn(Unknown Source)

MalikHamidJaved commented 1 year ago

Thank you everyone proguard rules were effective

behnawwm commented 11 months ago

I had an issue and I've applied all of the rules in addition to my custom CallAdapterFactory rules but it didn't work. The issue with my project was the deprecated Retrofit Coroutines Adapter which was deprecated. I removed it and it fixed my problem. Hope it helps!

Goooler commented 9 months ago

For ones who need this support, you can try out my fork, use io.github.goooler.retrofit2:retrofit:2.10.0, check https://github.com/Goooler/retrofit/releases/tag/2.10.0

DjuroRad commented 8 months ago

Just a small note: If you are developing a library/sdk, make sure to have the above-mentioned rules applied inside of consumer-rules.pro.

JakeWharton commented 8 months ago

Closing since the fix was merged. Will be included in the next release.

SIVA3161 commented 6 months ago

(https://github.com/square/retrofit/issues/3751#issuecomment-1192043644) Thanks @marcoscostaanddev ] , adding these rules into my proguard , helped me fixing this (https://github.com/square/retrofit/issues/3751#top).