How to fix NoClassDefFoundError in Android for android.widget.PopupMenu?

I am trying to create a popup menu and I keep getting java.lang.NoClassDefFoundError: android.widget.PopupMenu

public void showPopup(View v) { PopupMenu popup = new PopupMenu(this, v); MenuInflater inflater = popup.getMenuInflater(); inflater.inflate(R.menu.tweet_menu, popup.getMenu()); popup.show(); } 

I understand that this error means that the class was found in the classpath at compilation, but not at runtime, but it's hard for me to understand why, since it is part of the Android SDK. I am using the latest version of the SDK and I am developing / compiling in Netbeans.

Please, help!

+4
source share
1 answer

PopupMenu is available with Android API 11 . Therefore, to use you will need a device with at least Android 3.0 . Please contact Android developers

+6
source

Source: https://habr.com/ru/post/1400747/


All Articles