在android中使用android-support-v7-appcompat库运行PopupMenu时出现NoClassDefFoundError

时间:2014-06-27 10:23:05

标签: java android android-layout android-support-library

我正在尝试在我的Android应用程序中实现一个弹出菜单,这将从Android 2.2支持。所以我用android-support-v7-appcompat支持库来做。但不幸的是我得到了java.lang.NoClassDefFoundError异常。无法解决问题,任何人都可以帮助我吗?提前谢谢!

logcat显示,

06-27 15:40:30.160: E/AndroidRuntime(26985): FATAL EXCEPTION: main
06-27 15:40:30.160: E/AndroidRuntime(26985): java.lang.NoClassDefFoundError:  android.support.v7.internal.view.menu.MenuBuilder
06-27 15:40:30.160: E/AndroidRuntime(26985):    at android.support.v7.widget.PopupMenu.<init>(PopupMenu.java:66)
06-27 15:40:30.160: E/AndroidRuntime(26985):    at com.example.basic.MainActivity$4.onClick(MainActivity.java:401)
06-27 15:40:30.160: E/AndroidRuntime(26985):    at android.view.View.performClick(View.java:4421)
06-27 15:40:30.160: E/AndroidRuntime(26985):    at android.view.View$PerformClick.run(View.java:17903)
06-27 15:40:30.160: E/AndroidRuntime(26985):    at android.os.Handler.handleCallback(Handler.java:730)
06-27 15:40:30.160: E/AndroidRuntime(26985):    at android.os.Handler.dispatchMessage(Handler.java:92)
06-27 15:40:30.160: E/AndroidRuntime(26985):    at android.os.Looper.loop(Looper.java:213)
06-27 15:40:30.160: E/AndroidRuntime(26985):    at android.app.ActivityThread.main(ActivityThread.java:5225)
06-27 15:40:30.160: E/AndroidRuntime(26985):    at java.lang.reflect.Method.invokeNative(Native Method)
06-27 15:40:30.160: E/AndroidRuntime(26985):    at java.lang.reflect.Method.invoke(Method.java:525)
06-27 15:40:30.160: E/AndroidRuntime(26985):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:741)
06-27 15:40:30.160: E/AndroidRuntime(26985):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:557)
06-27 15:40:30.160: E/AndroidRuntime(26985):    at dalvik.system.NativeStart.main(Native Method)

1 个答案:

答案 0 :(得分:0)

签出项目 - &gt;属性 - &gt; Java构建路径/订单和导出。使用android.support.v7.internal.view.menu.MenuBuilder检查库和依赖项