Replies: 2 comments 1 reply
-
Just following up here as well, I was looking into this from the R8 side to get a repro https://issuetracker.google.com/398887842 The error that you get when you are not using R8 (minifyEnabled: false -> you are using D8) is actually very actionable:
You should always validate that your build actually works without R8 before trying to figure out the problem with an R8 compiled app |
Beta Was this translation helpful? Give feedback.
-
You do not need to annotate functions which have implementations such as your The problem is that the Kotlin compiler is still compiling your interface in a mode that supports Java 6 (for historical reasons) despite producing Java 8 bytecode. This means that the implementation of a function on an interface has to be hoisted to a sibling class, and the original function looks like it has no body. If you add the Retrofit does not process interface methods which have default implementations. So once you enable this compilation strategy, the problems go away. You can compare the output of the two strategies here: https://kotlin.godbolt.org/z/5n1Ko5hzv. Hopefully you can see that the normal behavior on the top results in Retrofit thinking that your |
Beta Was this translation helpful? Give feedback.
-
Lately I ran into a problem with retrofit + r8_full_mode combination, although I am using the proguard rules file offered by retrofit:
https://github.com/square/retrofit/blob/trunk/retrofit/src/main/resources/META-INF/proguard/retrofit2.pro
There is one class still caused a run time exception, here's the pseudocode:
In runtime, here's the exception that I got (with r8 full mode turned on), there is no problem if I disable r8 full mode
This problem goes away if I change service A into the following by adding retrofit annotations:
So my question is: should we always annotate the service class's methods and if this is a hard requirement, if so is there any guidance of how to enforce it in dev? (lint rule, doc, etc?)
Beta Was this translation helpful? Give feedback.
All reactions