crash with NoSuchMethodError after proguard with method references

后端 未结 4 1107
难免孤独
难免孤独 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:41

    Most of the time, the website/github of your library provides the necessary proguard rules like retrolamda:

    -dontwarn java.lang.invoke.*
    -dontwarn **$$Lambda$*
    

    Proguarding is a trail-error story. Check your logging to see which library, class or component causes a problem and add them carefully to the rules :).

    Your error NoSuchMethod specifically:

    Your code is probably calling something like myClass.getMethod, trying to find some method dynamically. Since ProGuard can't always detect this automatically, you have to keep the missing method in using the appropriate -keep option:

    -keepclassmembers class mypackage.MyClass { void myMethod(); }

提交回复
热议问题