Skip to content

NoSuchFieldException on release.apk #180

@sewerk

Description

@sewerk
  • 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions