Customized Search in Android RuntimeException can't set breakpoints
I am trying to implement my own Search using searchable, and as soon as press return after entering a query into my custom search field, I get a RuntimeException:
Thread [<1> main] (Suspended (exception RuntimeException))
ActivityThread.performLaunchActivity(ActivityThread$ActivityRecord, Intent) line: 2585
ActivityThread.handleLaunchActivity(ActivityThread$ActivityRecord, Intent) line: 2679
ActivityThread.access$2300(ActivityThread, ActivityThread$ActivityRecord, Intent) line: 125
ActivityThread$H.handleMessage(Message) line: 2033
ActivityThread$H(Handler).dispatchMessage(Message) line: 99
Looper.loop() line: 123
ActivityThread.main(String[]) line: 4627
Method.invokeNative(Object, Object[], Class, Class[], Class, int, boolean) line: not available [native method]
Method.invoke(Object, Object...) line: 521
ZygoteInit$MethodAndArgsCaller.run() line: 868
ZygoteInit.main(String[]) line: 626
NativeStart.main(String[]) line: not available [native method]
Here is what the logCat reported:
07-25 18:56:12.688: DEBUG/SearchDialog(313): launching Intent { act=android.intent.action.SEARCH flg=0x10000000 cmp=com.bookcessed.booksearch/.SearchActivity (has extras) }
07-25 18:56:12.708: INFO/SearchDialog(313): Starting (as ourselves) #Intent;action=android.intent.action.SEARCH;launchFlags=0x10000000;component=com.bookcessed.booksearch/.SearchActivity;S.query=Adventure;S.user_query=Adventure;end
07-25 18:56:12.728: INFO/ActivityManager(59): Starting activity: Intent { act=android.intent.action.SEARCH flg=0x10000000 cmp=com.bookcessed.booksearch/.SearchActivity (has extras) }
07-25 18:56:13.058: DEBUG/dalvikvm(313): newInstance failed: no <init>()
07-25 18:56:22.765: WARN/ActivityManager(59): Launch timeout has expired, giving up wake lock!
07-25 18:56:22.845: WARN/ActivityManager(59): Activity idle timeout for HistoryRecord{43fc2f60 com.bookcessed.booksearch/.SearchActivity}
(More):
07-25 19:06:24.698: ERROR/AndroidRuntime(313): FATAL EXCEPTION: main
07-25 19:06:24.698: ERROR/AndroidRuntime(313): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.bookcessed.booksearch/com.bookcessed.booksearch.SearchActivity}: java.lang.InstantiationException: com.bookcessed.booksearch.SearchActivity
07-25 19:06:24.698: ERROR/AndroidRuntime(313): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2585)
07-25 19:06:24.698: ERROR/AndroidRuntime(313): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
07-25 19:06:24.698: ERROR/AndroidRuntime(313): at android.app.ActivityThread.access$2300(ActivityThread.java:125)
07-25 19:06:24.698: ERROR/AndroidRuntime(313): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
07-25 19:06:24.698: ERROR/AndroidRuntime(313): at android.os.Handler.dispatchMessage(Handler.java:99)
07-25 19:06:24.698: ERROR/AndroidRuntime(313): at android.os.Looper.loop(Looper.java:123)
07-25 19:06:24.698: ERROR/AndroidRuntime(313): at android.app.ActivityThread.main(ActivityThread.java:4627)
07-25 19:06:24.698: ERROR/AndroidRuntime(313): at java.lang.reflect.Method.invokeNative(Native Method)
07-25 19:06:24.698: ERROR/AndroidRuntime(313): at java.lang.reflect.Method.invoke(Method.java:521)
07-25 19:06:24.698: ERROR/AndroidRuntime(313): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
07-25 19:06:24.698: ERROR/AndroidRuntime(313): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
07-25 19:06:24.698: ERROR/AndroidRuntime(313): at dalvik.system.NativeStart.main(Native Method)
07-25 19:06:24.698: ERROR/AndroidRuntime(313): Caused by: java.lang.InstantiationException: com.bookcessed.booksearch.SearchActivity
07-25 19:06:24.698: ERROR/AndroidRuntime(313): at java.lang.Class.newInstanceImpl(Native Method)
07-25 19:06:24.698: ERRO开发者_StackOverflowR/AndroidRuntime(313): at java.lang.Class.newInstance(Class.java:1429)
07-25 19:06:24.698: ERROR/AndroidRuntime(313): at android.app.Instrumentation.newActivity(Instrumentation.java:1021)
07-25 19:06:24.698: ERROR/AndroidRuntime(313): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2577)
07-25 19:06:24.698: ERROR/AndroidRuntime(313): ... 11 more
I have been trying to figure it out for hours. Here is my AndroidXML:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
android:versionCode="1"
android:versionName="1.0" package="com.bookcessed.booksearch">
<application android:icon="@drawable/icon" android:label="@string/app_name" android:debuggable="true">
<activity android:name="TestActivity">
<intent-filter><category android:name="android.intent.category.LAUNCHER" /><action android:name="android.intent.action.MAIN"></action>
</intent-filter>
<meta-data android:name="android.app.default_searchable"
android:value=".SearchActivity" />
</activity>
<activity android:name=".SearchActivity"
android:launchMode="singleTop" >
<intent-filter>
<action android:name="android.intent.action.SEARCH" />
</intent-filter>
<meta-data android:name="android.app.searchable"
android:resource="@xml/searchable"/>
</activity>
<activity android:name=".bookListView"><intent-filter><action android:name="com.bookcessed.booksearch.action.LIST_BOOKS"></action>
</intent-filter>
</activity>
</application>
<uses-sdk android:minSdkVersion="4" />
<uses-permission android:name="android.permission.INTERNET"></uses-permission>
</manifest>
07-25 18:56:13.058: DEBUG/dalvikvm(313): newInstance failed: no <init>()
Need to have a constructor that takes no parameters! Tada.
精彩评论