Explore Courses Blog Tutorials Interview Questions
0 votes
in Java by (3.9k points)

There is an issue with the Android appcompat v7 library on Samsung devices running Android 4.2. I keep getting crashes with the following stack trace in my Developer Console:



    at com.[my-package-name].CustomActivity$5.onClick(

    at android.view.View.performClick(

    at android.view.View$

    at android.os.Handler.handleCallback(

    at android.os.Handler.dispatchMessage(

    at android.os.Looper.loop(


    at java.lang.reflect.Method.invokeNative(Native Method)

    at java.lang.reflect.Method.invoke(



    at dalvik.system.NativeStart.main(Native Method)

This is line 215 of

PopupMenu popup = new PopupMenu(CustomActivity.this, mImageViewMenu);

The crashes come from an array of devices, but always Samsung, and always Android 4.2.

A quick web search leads me to believe that many people have the same issue, some of the steps I have tried to solve the issue are:

  • Check the Android project properties, make sure the appcompat library is added properly.
  • Check the Java Build Path Order and Export project properties, make sure Android Dependencies and Android Private Libraries is checked.
  • Confirm the class is included in the library (
  • Confirm is located in gen directory for
  • Confirm the AppCompat theme is included in the Manifest.xml activity.
  • Clean and rebuild project.

Despite these steps, and despite it working on all other devices and Android versions the crash reports still come through.

1 Answer

0 votes
by (46k points)

As #150 from google groups said

Because careful with -keep class !**. There are a number of classes in there which are referenced from the appcompat's resources.

The better solution is add the following lines instead:

-keep class !*MenuBuilder*,** { *; }

-keep interface** { *; }

Related questions

0 votes
1 answer
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer
asked Nov 25, 2019 in Java by Anvi (10.2k points)

Browse Categories