Android : ClassCastException - android.support.v7.widget.Toolbar

on Sunday, April 19, 2015


after updated support libraries for material design I get this crash on some devices ( Samsung , Wiko )



java.lang.ClassCastException
com.wax.app.MainActivity.onOptionsItemSelected(MainActivity.java:310)
android.app.Activity.onMenuItemSelected(Activity.java:2612)
android.support.v4.app.FragmentActivity.onMenuItemSelected(FragmentActivity.java:350)
android.support.v7.app.ActionBarActivity.onMenuItemSelected(ActionBarActivity.java:152)
android.support.v7.app.ActionBarActivityDelegate$1.onMenuItemSelected(ActionBarActivityDelegate.java:75)
android.support.v7.widget.WindowCallbackWrapper.onMenuItemSelected(WindowCallbackWrapper.java:44)
android.support.v7.internal.app.ToolbarActionBar$2.onMenuItemClick(ToolbarActionBar.java:76)
android.support.v7.widget.Toolbar$1.onMenuItemClick(Toolbar.java:164)
android.support.v7.widget.ActionMenuView$MenuBuilderCallback.onMenuItemSelected(ActionMenuView.java:738)
android.support.v7.internal.view.menu.MenuBuilder.dispatchMenuItemSelected(MenuBuilder.java:802)
android.support.v7.internal.view.menu.MenuItemImpl.invoke(MenuItemImpl.java:153)
android.support.v7.internal.view.menu.MenuBuilder.performItemAction(MenuBuilder.java:949)
android.support.v7.internal.view.menu.MenuBuilder.performItemAction(MenuBuilder.java:939)
android.support.v7.widget.ActionMenuView.invokeItem(ActionMenuView.java:596)
android.support.v7.internal.view.menu.ActionMenuItemView.onClick(ActionMenuItemView.java:145)
android.view.View.performClick(View.java:4439)
android.view.View$PerformClick.run(View.java:18395)
android.os.Handler.handleCallback(Handler.java:725)
android.os.Handler.dispatchMessage(Handler.java:92)
android.os.Looper.loop(Looper.java:176)
android.app.ActivityThread.main(ActivityThread.java:5319)
java.lang.reflect.Method.invokeNative(Native Method)
java.lang.reflect.Method.invoke(Method.java:511)
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1102)
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:869)
dalvik.system.NativeStart.main(Native Method)


java


I just added this to Progruard



-keep class !android.support.v7.internal.view.menu.**,android.support.v7.** {*;}


What can I do? Thanks :)


0 comments:

Post a Comment