5

On an Android app I have on the PlayStore I receive a lot reports via Crittercism of the following crash:

0   java.lang.ClassCastException: android.support.v7.internal.view.menu.ActionMenuItemView cannot be cast to android.support.v7.internal.view.menu.m$a
1       at android.support.v7.internal.view.menu.b.createItemView(BaseMenuPresenter.java:161)
2       at android.support.v7.internal.view.menu.b.getItemView(BaseMenuPresenter.java:180)
3       at android.support.v7.widget.ActionMenuPresenter.getItemView(ActionMenuPresenter.java:170)
4       at android.support.v7.widget.ActionMenuPresenter.flagActionItems(ActionMenuPresenter.java:429)
5       at android.support.v7.internal.view.menu.f.k(MenuBuilder.java:1129)
6       at android.support.v7.internal.view.menu.b.updateMenuView(BaseMenuPresenter.java:91)
7       at android.support.v7.widget.ActionMenuPresenter.updateMenuView(ActionMenuPresenter.java:207)
8       at android.support.v7.internal.view.menu.f.e(MenuBuilder.java:279)
9       at android.support.v7.internal.view.menu.f.c(MenuBuilder.java:1021)
10      at android.support.v7.internal.view.menu.f.i(MenuBuilder.java:1044)
11      at android.support.v7.internal.app.ToolbarActionBar.populateOptionsMenu(ToolbarActionBar.java:463)
12      at android.support.v7.internal.app.ToolbarActionBar$1.run(ToolbarActionBar.java:68)
13      at android.view.Choreographer$CallbackRecord.run(Choreographer.java:777)
14      at android.view.Choreographer.doCallbacks(Choreographer.java:590)
15      at android.view.Choreographer.doFrame(Choreographer.java:559)
16      at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:763)
17      at android.os.Handler.handleCallback(Handler.java:739)
18      at android.os.Handler.dispatchMessage(Handler.java:95)
19      at android.os.Looper.loop(Looper.java:145)
20      at android.app.ActivityThread.main(ActivityThread.java:5834)
21      at java.lang.reflect.Method.invoke(Native Method)
22      at java.lang.reflect.Method.invoke(Method.java:372)
23      at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1388)
24      at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1183)

This crash only occurs on the Samsung Galaxy S5 (SMG900F) with Android Version 5.0.

As you can see there is not a single method call from within my app in this stacktrace and I'm really out of ideas on what the problem could be. Tried reproducing it with an S5 with Android 5.0 but couldn't so the problem probably only happens on certain firmware builds.

Any ideas on what this is?

EDIT: This is my proguard-rules.pro, because the problem seems to be related to ProGuard:

-keepattributes **
-keep class !android.support.v7.internal.view.menu.**,** {*;}
-dontpreverify
-dontoptimize
-dontshrink
-dontwarn **
fweigl
  • 21,278
  • 20
  • 114
  • 205
  • Is your production obfuscated using ProGuard? `android.support.v7.internal.view.menu.m` indicates me that it could and that you could have wrong/missing rules for android.support.v7 library. – shkschneider Jun 11 '15 at 13:20
  • Ah yeah, it actually does. Totally forgot about that, I have another question relating to that as well: http://stackoverflow.com/questions/30575424/proguard-not-working-as-expected-after-android-studio-update – fweigl Jun 11 '15 at 13:27
  • Those two problems do seem to be related to each other, yet I can't make any sense out of them. – fweigl Jun 11 '15 at 13:35
  • You mean you got the same crash stacktrace? Does not the support-v7 ProGuard rules solves this particular issue? – shkschneider Jun 11 '15 at 13:38
  • No, the stacktraces are slightly different, but both relate to the ActionBar Menu. The bug that got 'fixed' by the Proguard Rule is this one: http://stackoverflow.com/questions/24809580/noclassdeffounderror-android-support-v7-internal-view-menu-menubuilder – fweigl Jun 11 '15 at 13:44
  • 1
    I'm aware of that bug. But please post your ProGuard file and current stacktrace output. Seems like the obfuscation is not working as expected. – shkschneider Jun 11 '15 at 13:53

0 Answers0