不幸的是app已停止错误eclipse?

时间:2014-03-12 12:41:33

标签: android eclipse logcat

我已经在eclipse中创建了一个应用程序,它工作正常,然后突然它不断给我错误消息'不幸的是应用程序停止了'任何人都可以从我的日志报告中解释我的问题所在,因为我是新手,并且真的不明白日志猫是什么意思?

03-12 12:31:03.465: D/AndroidRuntime(4997): Shutting down VM
03-12 12:31:03.465: W/dalvikvm(4997): threadid=1: thread exiting with uncaught exception (group=0x416a8930)
03-12 12:31:03.465: E/AndroidRuntime(4997): FATAL EXCEPTION: main
03-12 12:31:03.465: E/AndroidRuntime(4997): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.softwaresearchapp/com.example.softwaresearchapp.MainActivity}: android.content.ActivityNotFoundException: Unable to find explicit activity class {com.example.softwaresearchapp/com.example.softwaresearchapp.SoftwareSearchActivity}; have you declared this activity in your AndroidManifest.xml?
03-12 12:31:03.465: E/AndroidRuntime(4997):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2180)
03-12 12:31:03.465: E/AndroidRuntime(4997):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230)
03-12 12:31:03.465: E/AndroidRuntime(4997):     at android.app.ActivityThread.access$600(ActivityThread.java:141)
03-12 12:31:03.465: E/AndroidRuntime(4997):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234)
03-12 12:31:03.465: E/AndroidRuntime(4997):     at android.os.Handler.dispatchMessage(Handler.java:99)
03-12 12:31:03.465: E/AndroidRuntime(4997):     at android.os.Looper.loop(Looper.java:137)
03-12 12:31:03.465: E/AndroidRuntime(4997):     at android.app.ActivityThread.main(ActivityThread.java:5039)
03-12 12:31:03.465: E/AndroidRuntime(4997):     at java.lang.reflect.Method.invokeNative(Native Method)
03-12 12:31:03.465: E/AndroidRuntime(4997):     at java.lang.reflect.Method.invoke(Method.java:511)
03-12 12:31:03.465: E/AndroidRuntime(4997):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
03-12 12:31:03.465: E/AndroidRuntime(4997):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
03-12 12:31:03.465: E/AndroidRuntime(4997):     at dalvik.system.NativeStart.main(Native Method)
03-12 12:31:03.465: E/AndroidRuntime(4997): Caused by: android.content.ActivityNotFoundException: Unable to find explicit activity class {com.example.softwaresearchapp/com.example.softwaresearchapp.SoftwareSearchActivity}; have you declared this activity in your AndroidManifest.xml?
03-12 12:31:03.465: E/AndroidRuntime(4997):     at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1618)
03-12 12:31:03.465: E/AndroidRuntime(4997):     at android.app.ActivityThread.resolveActivityInfo(ActivityThread.java:1993)
03-12 12:31:03.465: E/AndroidRuntime(4997):     at android.app.LocalActivityManager.startActivity(LocalActivityManager.java:285)
03-12 12:31:03.465: E/AndroidRuntime(4997):     at android.widget.TabHost$IntentContentStrategy.getContentView(TabHost.java:749)
03-12 12:31:03.465: E/AndroidRuntime(4997):     at android.widget.TabHost.setCurrentTab(TabHost.java:413)
03-12 12:31:03.465: E/AndroidRuntime(4997):     at android.widget.TabHost.addTab(TabHost.java:240)
03-12 12:31:03.465: E/AndroidRuntime(4997):     at com.example.softwaresearchapp.MainActivity.onCreate(MainActivity.java:27)
03-12 12:31:03.465: E/AndroidRuntime(4997):     at android.app.Activity.performCreate(Activity.java:5104)
03-12 12:31:03.465: E/AndroidRuntime(4997):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1080)
03-12 12:31:03.465: E/AndroidRuntime(4997):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2144)
03-12 12:31:03.465: E/AndroidRuntime(4997):     ... 11 more
03-12 12:31:22.666: I/Process(4997): Sending signal. PID: 4997 SIG: 9`

3 个答案:

答案 0 :(得分:3)

你的logcat清楚地说了

 Caused by: android.content.ActivityNotFoundException: Unable to find explicit activity class {com.example.softwaresearchapp/com.example.softwaresearchapp.SoftwareSearchActivity}; have you declared this activity in your AndroidManifest.xml?

SoftwareSearchActivity添加到manifest.xml

     <activity
        android:name="com.example.softwaresearchapp.SoftwareSearchActivity"
        android:configChanges="keyboardHidden|orientation"
        android:label="SoftwareSearch"
       />

答案 1 :(得分:1)

看看这一行:

3-12 12:31:03.465: E/AndroidRuntime(4997): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.softwaresearchapp/com.example.softwaresearchapp.MainActivity}: android.content.ActivityNotFoundException: Unable to find explicit activity class {com.example.softwaresearchapp/com.example.softwaresearchapp.SoftwareSearchActivity}; have you declared this activity in your AndroidManifest.xml?

具体来说:Unable to find explicit activity class {com.example.softwaresearchapp/com.example.softwaresearchapp.SoftwareSearchActivity}; have you declared this activity in your AndroidManifest.xml?

嗯,好吗?

必须在清单文件中声明应用中的每个活动。我想你想提供的最小信息是namelabel,例如。

<activity
        android:name=".SoftwareSearchActivity"
        android:label="@string/title_activity_software_search"
 />

答案 2 :(得分:0)

您将获得ActivityNotFoundException。请检查清单文件中com.example.softwaresearchapp.SoftwareSearchActivity的活动条目。