I have a Guice enabled application working fine, but when I optimize it (i.e., shrink size) with Proguard, I get the following error message (I catch it with an uncaught exception handler):
java.lang.ClassFormatError: LVTT entry for 'that' in class file
com/google/inject/internal/util/$ImmutableList$RegularImmutableList
does not match any LVT entry
This prevents the application from operating properly. I do not obfuscate the code.
Does anyone know what is happening? Is there a solution/workaround?
Thanks.
Sometimes ProGuard will rip out more things than it should when shrinking. ProGuard will remove any references to classes/members that it believes are not used in your application unless you explicitly tell it to preserve those classes/members.
You can preserve classes/members using ProGuard’s keep options. The example usage page has a few examples of keep options.
I see this happen sometimes when my applications reference an interface implementation which doesn’t appear to be referenced when you’re just looking at the code. I just add a new keep option every time I find that something is missing. Perhaps someone else has a better suggestion for how to track these things down?