crash with NoSuchMethodError after proguard with method references

后端 未结 4 1144
难免孤独
难免孤独 2021-01-18 01:21

the source code before compile&proguard :

public class IntentSession extends BaseIntentSession {
    @Override
    public void onResume() {
        super         


        
4条回答
  •  甜味超标
    2021-01-18 01:55

    Working through these bugs that -keep doesn't fix is a REAL pain and the only way I've ever made headway on them is by following this strategy:

    1. Figure out at what phase of the proguard cycle the bug is being introduced (shrinking, optimizing or obfuscating)
    2. Add/remove exceptions for that step, working your way from the broadest scope of exclusion to the narrowest until the problem resurfaces

    E.G.

    Verify that this is an optimization issue or not

    1. Add -dontoptimize instead of the -optimizations string rebuild and test
    2. If the crash is mitigated, work backwards through the classes of optimization exclusions at the highest level !method/*, !code/*, !class/*, !field/* until you determine which exclusion makes the issue go away
    3. Determine what the minimum exclusion is in that class of exclusion (assuming it was !method/*, go from it to !method/marking/* and then if that works too try !method/marking/final. If that works, then you've found the minimum exclusion)

    This could very well be a bug in the Proguard rules of one of the libs you're using or in the version of Proguard you're using itself (I've seen both) so try to update both as well.

提交回复
热议问题