Android Proguard - ClassNotFoundException

前端 未结 2 1604
轻奢々
轻奢々 2020-12-19 10:44

I enabled proguard for my android app. I can build the project successfully but it crashes on startup with classNotFoundException. It doesn\'t even find the launcher activit

相关标签:
2条回答
  • 2020-12-19 11:05

    You'll want to also make sure to add in the New Relic proguard exceptions found here: https://docs.newrelic.com/docs/mobile-monitoring/mobile-monitoring-installation/android/installing-android-apps-gradle-android-studio#proguard

    -keep class com.newrelic.** { *; }
    -dontwarn com.newrelic.**
    -keepattributes Exceptions, Signature, InnerClasses
    
    0 讨论(0)
  • 2020-12-19 11:18

    Remove the obfuscation rules related to activity and all also related to support libaries.Android studio by default has those templates.You could enable them by adding this rule in your gradle

    buildTypes {
            release {
                minifyEnabled false
                proguardFiles getDefaultProguardFile('proguard-android.txt')
            }
        }
    

    Also please edit the rule for Jackson processor

    -keep public class your.class.** {
      public void set*(***);
      public *** get*();
    }
    

    In this your class.** is the POJO(getter/setter) class that you have created for parsing your response

    0 讨论(0)
提交回复
热议问题