“Application stopped working” after enabling Proguard

后端 未结 1 979
深忆病人
深忆病人 2021-02-13 14:51

It was a working app, both on emulator and the device i am testing on.

But now, i enabled Proguard and Exported the signed app using Android-Tools

相关标签:
1条回答
  • 2021-02-13 15:30

    The stack trace shows that ActionBarSherlock is failing to find a constructor "a(Activity,int)" using reflection. Its documentation indeed specifies that each extension of ActionBarSherlock should have such a constructor. ProGuard doesn't (can't) know this and has removed the constructor, because it appears unused in the code. You therefore have to explicitly tell ProGuard to keep it:

    -keepclassmembers class * extends com.actionbarsherlock.ActionBarSherlock {
        <init>(android.app.Activity, int);
    }
    

    In general, if you get such stack traces related to reflection in your code or its libraries, you need to add corresponding configuration.

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