Skip to content
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

NoSuchFieldException on release.apk #180

Closed
sewerk opened this issue Jun 23, 2017 · 2 comments
Closed

NoSuchFieldException on release.apk #180

sewerk opened this issue Jun 23, 2017 · 2 comments

Comments

@sewerk
Copy link

sewerk commented Jun 23, 2017

  • I have verified the issue exists on the latest version
  • I am able to reproduce it

Version used:
1.9.1
Stack trace:
Caused by: java.lang.NoSuchFieldException: No field mMenuView in class Landroid/support/v7/widget/Toolbar; (declaration of 'android.support.v7.widget.Toolbar' appears in /data/app/com.example-1/base.apk)
at java.lang.Class.getDeclaredField(Native Method)
at com.b.a.b.a(ReflectUtil.java:27)
at com.b.a.f.c(ToolbarTapTarget.java:147)

Android version:
Nexus 5X 7.1.2

After building release apk, with proguard enabled, the private fields from support lib widgets are missing and call for ToolbarTapTarget.findOverflowView() cause crash.

I've updated the proguard rules by adding following lines:

-keep class android.support.v7.widget.Toolbar { *** mMenuView; }
-keep class android.support.v7.widget.ActionMenuView { *** mPresenter; }
-keep class android.support.v7.widget.ActionMenuPresenter { *** mOverflowButton; }

and it is working fine now. You might want to consider adding them to documentation.

@xiphirx
Copy link
Collaborator

xiphirx commented Jul 16, 2017

Thanks for the report/info! I have linked it in the README in fe667ed

@xiphirx xiphirx closed this as completed Jul 16, 2017
@jrvermeer
Copy link

If using androidx those proguard rules change to:

-keep class androidx.appcompat.widget.Toolbar { *** mMenuView; }
-keep class androidx.appcompat.widget.ActionMenuView { *** mPresenter; }
-keep class androidx.appcompat.widget.ActionMenuPresenter { *** mOverflowButton; }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants