I have updated retrofit 2.3.0 and okhttp 3.8.0 and now while generating signed APK I am getting following error
Warning:retrofit2.OkHttpCall: can't find referenced class javax.annotation.concurrent.GuardedBy
Warning:there were 3 unresolved references to classes or interfaces.
Warning:Exception while processing task java.io.IOException: Please correct the above warnings first.
Error:Execution failed for task ':app:transformClassesAndResourcesWithProguardForRelease'.
Job failed, see logs for details
Following are the proguard rules which I am using for Retrofit and OKHTTP
# Platform calls Class.forName on types which do not exist on Android to determine platform.
-dontnote retrofit2.Platform
# Platform used when running on Java 8 VMs. Will not be used at runtime.
-dontwarn retrofit2.Platform$Java8
# Retain generic type information for use by reflection by converters and adapters.
-keepattributes Signature
# Retain declared checked exceptions for use by a Proxy instance.
-keepattributes Exceptions
-dontwarn org.xmlpull.v1.**
-dontwarn okhttp3.**
-keep class okhttp3.** { *; }
-dontwarn okio.**
-dontwarn javax.annotation.Nullable
-dontwarn javax.annotation.ParametersAreNonnullByDefault
I think you just need
-dontwarn javax.annotation.GuardedBy
or -dontwarn javax.annotation.**
Also please don't use -keep class okhttp3.** { *; }. There should be no need for that.
@JakeWharton Thanks it worked
@JakeWharton I am getting follwoing errors after I add -dontwarn javax.annotation.**
Error:The string "--" is not permitted within comments.
This issue is coming due to pro-guard enable in the release config of the app. So the solution is either remove pro-guard or put the indicated code snippet as in the link https://readyandroid.wordpress.com/errorexecution-failed-for-task-apptransformclassesandresourceswithproguardforrelease/
That link is a horrid recommendation. If you ever feel the urge to do that
you should just be disabling ProGuard. You're using it wrong.
On Wed, May 2, 2018 at 9:42 AM ReadyAndroid notifications@github.com
wrote:
This issue is coming due to pro-guard enable in the release config of the
app. So the solution is either remove pro-guard or put the indicated code
snippet as in the link
https://readyandroid.wordpress.com/errorexecution-failed-for-task-apptransformclassesandresourceswithproguardforrelease/—
You are receiving this because you were mentioned.Reply to this email directly, view it on GitHub
https://github.com/square/retrofit/issues/2335#issuecomment-385981663,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAEEEb6THuXOGEdEOiZdFG88ZkQbWdVzks5tube9gaJpZM4NcR8P
.
For me the fix was just adding this line in proguard file.
-ignorewarnings
Most helpful comment
or
-dontwarn javax.annotation.**