-
Notifications
You must be signed in to change notification settings - Fork 394
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
java.lang.VerifyError: Bad type on operand stack in putfield #17
Comments
We would need more information, ideally a reproducible sample. In your configuration I see that you use optimization in combination with -dontshrink. Can you check if the same problem appears when you remove -dontshrink? |
@netomi - thanks for the answer. Adding I was worried that you would need a reproduction. Let me see what I can do about that in the next days. Unfortunately we have a big app so that might be difficult. I'll let you know how it goes. |
We would need something, at least the class file of the class that fails verification. If -dontshrink is too difficult, could you at least try disabling some optimizations that might result in structural changes: -optimizations !class/merging/,!method/inlining/,** |
With this configuration - If you want the class file, please give me an email to send it to and tell me whether you want the version before or after ProGuard and, if after, what configuration to use. |
Thanks for the test, that would be an indication that disabling shrinking is really the culprit. Fyi: when classes are being merged, the class that is merged into another one is not immediately being removed, this is done in the subsequent shrinking step. Now when you disable shrinking the class is not removed, but it might be out of sync. We will take a look into such cases and remove such merged classes in any case. Is disabling class merging for now an acceptable solution? |
If you mean whether that configuration I pasted above is a solution - absolutely, even Thank you for the support! |
We have a clue, but without any more input its impossible to confirm. In any way, using optimization with -dontshrink is not advised. Disabling class merging will avoid most of the problems. That would also explain why it suddenly started to appear: which classes are being merged depends on many factors, even slight changes in the respective code can lead to different results. We will try to ensure that merged classes are properly cleaned up even with dontshrink enabled, but the priority of this is not very high. |
The low priority is totally fine - not a problem at all. Just a question - after you fix it some day, will it be safe to use |
It depends your use-case. From your configuration that you posted above, I assume that you have enabled obfuscation. Now when you access classes dynamically you will have to add a keep rule as otherwise they are renamed and you will not be able to access them via reflection. Most of the time, if your app / library works with obfuscation enabled, you will get shrinking for free as all necessary keep rules are already in place. I am not aware of many users that use -dontshrink, in fact thats the biggest benefit of ProGuard for most users, especially for Android applications. |
You're right, mostly. For example, when I tried running our app without |
Yes, I understand, what you describe makes sense. Such cases are an exception of course, but they should be very limited, if you can add explicit rule for such classes and can enable dontshrink you will gain a lot of benefit from using ProGuard. |
A couple of more cases that come to my mind:
Especially in the second case Now that I think about it, can't I just do |
@1: I dont know how JAX-RS endpoints are declared. Via annotations or config files? Does Proguard replace them properly? @2: you need to define the public API of your library that will also not be obfuscated, so dontshrink does not help you here imho. Basically you define the public API of your library and everything that is accessed dynamically, the remaining things will only be kept if they are actually accessed statically. Remaining things are removed. Thats is how most of our customers apply ProGuard / DexGuard on their library. |
OK, in order to not prolong this conversation too much, could you just tell me what you think of my last paragraph from the previous message (out of curiosity): Now that I think about it, can't I just do Thank you again for your time! |
no that does not help. You basically allow optimization of these classes, but prevent shrinking of them, so ending up with the same problem as using -dontshrink globally. |
I see. Thanks! Let's keep this issue open until you've fixed it if you're OK with that. |
ProGuard version 6.2.2 but this has been happening for a while now with older versions too.
This is when optimizations are on. With
dontoptimize
this error is gone. This is the full error:Here is my configuration options:
Not sure how I can help with this. What information do you need from me?
The text was updated successfully, but these errors were encountered: