我试图调试它,但无法弄清楚它为什么不起作用。
这是 logcat 输出:
05-25 17:28:39.251: E/AndroidRuntime(1008): FATAL EXCEPTION: main
05-25 17:28:39.251: E/AndroidRuntime(1008): java.lang.NoClassDefFoundError: com.actionbarsherlock.widget.SuggestionsAdapter
05-25 17:28:39.251: E/AndroidRuntime(1008): at com.actionbarsherlock.widget.SearchView.updateSearchAutoComplete(SearchView.java:1132)
05-25 17:28:39.251: E/AndroidRuntime(1008): at com.actionbarsherlock.widget.SearchView.setSearchableInfo(SearchView.java:370)
05-25 17:28:39.251: E/AndroidRuntime(1008): at com.liamwli.spotify.spotifycommunity.MainActivity.onCreateOptionsMenu(MainActivity.java:153)
05-25 17:28:39.251: E/AndroidRuntime(1008): at com.actionbarsherlock.app.SherlockActivity.onCreatePanelMenu(SherlockActivity.java:184)
05-25 17:28:39.251: E/AndroidRuntime(1008): at com.actionbarsherlock.ActionBarSherlock.callbackCreateOptionsMenu(ActionBarSherlock.java:559)
05-25 17:28:39.251: E/AndroidRuntime(1008): at com.actionbarsherlock.internal.ActionBarSherlockNative.dispatchCreateOptionsMenu(ActionBarSherlockNative.java:65)
05-25 17:28:39.251: E/AndroidRuntime(1008): at com.actionbarsherlock.app.SherlockActivity.onCreateOptionsMenu(SherlockActivity.java:149)
05-25 17:28:39.251: E/AndroidRuntime(1008): at android.app.Activity.onCreatePanelMenu(Activity.java:2498)
05-25 17:28:39.251: E/AndroidRuntime(1008): at com.android.internal.policy.impl.PhoneWindow.preparePanel(PhoneWindow.java:407)
05-25 17:28:39.251: E/AndroidRuntime(1008): at com.android.internal.policy.impl.PhoneWindow.doInvalidatePanelMenu(PhoneWindow.java:769)
05-25 17:28:39.251: E/AndroidRuntime(1008): at com.android.internal.policy.impl.PhoneWindow$1.run(PhoneWindow.java:201)
05-25 17:28:39.251: E/AndroidRuntime(1008): at android.view.Choreographer$CallbackRecord.run(Choreographer.java:749)
05-25 17:28:39.251: E/AndroidRuntime(1008): at android.view.Choreographer.doCallbacks(Choreographer.java:562)
05-25 17:28:39.251: E/AndroidRuntime(1008): at android.view.Choreographer.doFrame(Choreographer.java:531)
05-25 17:28:39.251: E/AndroidRuntime(1008): at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:735)
05-25 17:28:39.251: E/AndroidRuntime(1008): at android.os.Handler.handleCallback(Handler.java:725)
05-25 17:28:39.251: E/AndroidRuntime(1008): at android.os.Handler.dispatchMessage(Handler.java:92)
05-25 17:28:39.251: E/AndroidRuntime(1008): at android.os.Looper.loop(Looper.java:137)
05-25 17:28:39.251: E/AndroidRuntime(1008): at android.app.ActivityThread.main(ActivityThread.java:5229)
05-25 17:28:39.251: E/AndroidRuntime(1008): at java.lang.reflect.Method.invokeNative(Native Method)
05-25 17:28:39.251: E/AndroidRuntime(1008): at java.lang.reflect.Method.invoke(Method.java:525)
05-25 17:28:39.251: E/AndroidRuntime(1008): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:799)
05-25 17:28:39.251: E/AndroidRuntime(1008): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:566)
05-25 17:28:39.251: E/AndroidRuntime(1008): at dalvik.system.NativeStart.main(Native Method)
我尝试禁用proguard,以防万一,但没有运气。
我班的第 153 行是:
searchView.setSearchableInfo(searchManager.getSearchableInfo(getComponentName()));
有人可以帮助解决这个问题吗?