不幸的是(app _ name)已停止

时间:2014-02-11 14:35:00

标签: android

我开发了一个从第一个活动到第二个活动的导航应用程序。当我运行我的应用程序时,它显示“不幸的是应用已停止”。我发布了我的代码和日志cat errors.help我请。从errors.plsss中恢复

主要活动:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:paddingBottom="@dimen/activity_vertical_margin"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    tools:context=".MainActivity" >
    <TextView
        android:id="@+id/textView1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:textAppearance="?android:attr/textAppearanceLarge" />

    <Button
        android:id="@+id/button1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:layout_alignParentTop="true"
        android:layout_marginTop="90dp"
        android:text="REGISTER" />

    <Button
        android:id="@+id/button2"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignBaseline="@+id/button1"
        android:layout_alignBottom="@+id/button1"
        android:layout_marginLeft="54dp"
        android:layout_toRightOf="@+id/button1"
        android:text="LOGIN" />

</RelativeLayout>

注册表活动:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="wrap_content"
    android:layout_height="match_parent"
    android:paddingBottom="@dimen/activity_vertical_margin"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    tools:context=".RegActivity" 
    android:background="#ffff0000">

    <TextView
        android:id="@+id/textView1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:layout_below="@+id/textView2"
        android:layout_marginTop="23dp"
        android:text="USER NAME"
        android:textAppearance="?android:attr/textAppearanceMedium" />

    <TextView
        android:id="@+id/textView2"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentTop="true"
        android:layout_centerHorizontal="true"
        android:layout_marginTop="32dp"
        android:text="REGISTRATION FORM"
        android:textAppearance="?android:attr/textAppearanceLarge" />

    <EditText
        android:id="@+id/editText2"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignBaseline="@+id/textView3"
        android:layout_alignBottom="@+id/textView3"
        android:layout_alignRight="@+id/editText1"
        android:ems="10"
        android:inputType="textPassword" />

    <EditText
        android:id="@+id/editText1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_above="@+id/textView3"
        android:layout_alignParentRight="true"
        android:ems="10"
        android:inputType="textPersonName" />

    <EditText
        android:id="@+id/editText3"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignBaseline="@+id/textView4"
        android:layout_alignBottom="@+id/textView4"
        android:layout_alignParentRight="true"
        android:ems="10"
        android:inputType="textEmailAddress" />

    <Button
        android:id="@+id/button4"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignRight="@+id/textView2"
        android:layout_below="@+id/editText4"
        android:text="CANCEL" />

    <TextView
        android:id="@+id/textView3"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignLeft="@+id/textView1"
        android:layout_below="@+id/textView1"
        android:text="PASSWORD"
        android:textAppearance="?android:attr/textAppearanceMedium" />

    <TextView
        android:id="@+id/textView4"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignLeft="@+id/textView3"
        android:layout_below="@+id/editText2"
        android:text="E-MAIL ID"
        android:textAppearance="?android:attr/textAppearanceMedium" />

    <EditText
        android:id="@+id/editText4"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentRight="true"
        android:layout_alignTop="@+id/textView5"
        android:ems="10"
        android:inputType="textPostalAddress" >

        <requestFocus />
    </EditText>

    <TextView
        android:id="@+id/textView5"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignLeft="@+id/textView4"
        android:layout_below="@+id/editText3"
        android:text="ADDRESS"
        android:textAppearance="?android:attr/textAppearanceMedium" />

    <Button
        android:id="@+id/button3"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:layout_centerVertical="true"
        android:text="SUBMIT" />

</RelativeLayout>

清单:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.pizza"
    android:versionCode="1"
    android:versionName="1.0" >

    <uses-sdk
        android:minSdkVersion="8"
        android:targetSdkVersion="18" />

    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        <activity
            android:name="com.example.pizza.MainActivity"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <activity android:name=".RegAcitvity"/>

    </application>

</manifest>

logcat的:

02-11 09:05:44.983: D/gralloc_goldfish(1062): Emulator without GPU emulation detected.
02-11 09:05:47.363: D/AndroidRuntime(1062): Shutting down VM
02-11 09:05:47.363: W/dalvikvm(1062): threadid=1: thread exiting with uncaught exception (group=0xb4ad2b90)
02-11 09:05:47.373: E/AndroidRuntime(1062): FATAL EXCEPTION: main
02-11 09:05:47.373: E/AndroidRuntime(1062): Process: com.example.pizza, PID: 1062
02-11 09:05:47.373: E/AndroidRuntime(1062): android.content.ActivityNotFoundException: Unable to find explicit activity class {com.example.pizza/com.example.pizza.RegActivity}; have you declared this activity in your AndroidManifest.xml?
02-11 09:05:47.373: E/AndroidRuntime(1062):     at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1628)
02-11 09:05:47.373: E/AndroidRuntime(1062):     at android.app.Instrumentation.execStartActivity(Instrumentation.java:1424)
02-11 09:05:47.373: E/AndroidRuntime(1062):     at android.app.Activity.startActivityForResult(Activity.java:3423)
02-11 09:05:47.373: E/AndroidRuntime(1062):     at android.app.Activity.startActivityForResult(Activity.java:3384)
02-11 09:05:47.373: E/AndroidRuntime(1062):     at android.app.Activity.startActivity(Activity.java:3626)
02-11 09:05:47.373: E/AndroidRuntime(1062):     at android.app.Activity.startActivity(Activity.java:3594)
02-11 09:05:47.373: E/AndroidRuntime(1062):     at com.example.pizza.MainActivity$1.onClick(MainActivity.java:33)
02-11 09:05:47.373: E/AndroidRuntime(1062):     at android.view.View.performClick(View.java:4424)
02-11 09:05:47.373: E/AndroidRuntime(1062):     at android.view.View$PerformClick.run(View.java:18383)
02-11 09:05:47.373: E/AndroidRuntime(1062):     at android.os.Handler.handleCallback(Handler.java:733)
02-11 09:05:47.373: E/AndroidRuntime(1062):     at android.os.Handler.dispatchMessage(Handler.java:95)
02-11 09:05:47.373: E/AndroidRuntime(1062):     at android.os.Looper.loop(Looper.java:137)
02-11 09:05:47.373: E/AndroidRuntime(1062):     at android.app.ActivityThread.main(ActivityThread.java:4998)
02-11 09:05:47.373: E/AndroidRuntime(1062):     at java.lang.reflect.Method.invokeNative(Native Method)
02-11 09:05:47.373: E/AndroidRuntime(1062):     at java.lang.reflect.Method.invoke(Method.java:515)
02-11 09:05:47.373: E/AndroidRuntime(1062):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:777)
02-11 09:05:47.373: E/AndroidRuntime(1062):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:593)
02-11 09:05:47.373: E/AndroidRuntime(1062):     at dalvik.system.NativeStart.main(Native Method)
02-11 09:05:53.063: I/Process(1062): Sending signal. PID: 1062 SIG: 9
02-11 09:05:57.913: D/gralloc_goldfish(1088): Emulator without GPU emulation detected.
02-11 09:06:50.013: D/AndroidRuntime(1088): Shutting down VM
02-11 09:06:50.013: W/dalvikvm(1088): threadid=1: thread exiting with uncaught exception (group=0xb4ad2b90)
02-11 09:06:50.093: E/AndroidRuntime(1088): FATAL EXCEPTION: main
02-11 09:06:50.093: E/AndroidRuntime(1088): Process: com.example.pizza, PID: 1088
02-11 09:06:50.093: E/AndroidRuntime(1088): android.content.ActivityNotFoundException: Unable to find explicit activity class {com.example.pizza/com.example.pizza.RegActivity}; have you declared this activity in your AndroidManifest.xml?
02-11 09:06:50.093: E/AndroidRuntime(1088):     at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1628)
02-11 09:06:50.093: E/AndroidRuntime(1088):     at android.app.Instrumentation.execStartActivity(Instrumentation.java:1424)
02-11 09:06:50.093: E/AndroidRuntime(1088):     at android.app.Activity.startActivityForResult(Activity.java:3423)
02-11 09:06:50.093: E/AndroidRuntime(1088):     at android.app.Activity.startActivityForResult(Activity.java:3384)
02-11 09:06:50.093: E/AndroidRuntime(1088):     at android.app.Activity.startActivity(Activity.java:3626)
02-11 09:06:50.093: E/AndroidRuntime(1088):     at android.app.Activity.startActivity(Activity.java:3594)
02-11 09:06:50.093: E/AndroidRuntime(1088):     at com.example.pizza.MainActivity$1.onClick(MainActivity.java:33)
02-11 09:06:50.093: E/AndroidRuntime(1088):     at android.view.View.performClick(View.java:4424)
02-11 09:06:50.093: E/AndroidRuntime(1088):     at android.view.View$PerformClick.run(View.java:18383)
02-11 09:06:50.093: E/AndroidRuntime(1088):     at android.os.Handler.handleCallback(Handler.java:733)
02-11 09:06:50.093: E/AndroidRuntime(1088):     at android.os.Handler.dispatchMessage(Handler.java:95)
02-11 09:06:50.093: E/AndroidRuntime(1088):     at android.os.Looper.loop(Looper.java:137)
02-11 09:06:50.093: E/AndroidRuntime(1088):     at android.app.ActivityThread.main(ActivityThread.java:4998)
02-11 09:06:50.093: E/AndroidRuntime(1088):     at java.lang.reflect.Method.invokeNative(Native Method)
02-11 09:06:50.093: E/AndroidRuntime(1088):     at java.lang.reflect.Method.invoke(Method.java:515)
02-11 09:06:50.093: E/AndroidRuntime(1088):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:777)
02-11 09:06:50.093: E/AndroidRuntime(1088):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:593)
02-11 09:06:50.093: E/AndroidRuntime(1088):     at dalvik.system.NativeStart.main(Native Method)
02-11 09:06:55.293: I/Process(1088): Sending signal. PID: 1088 SIG: 9
02-11 09:21:17.953: D/gralloc_goldfish(1117): Emulator without GPU emulation detected.
02-11 09:22:18.203: D/AndroidRuntime(1117): Shutting down VM
02-11 09:22:18.203: W/dalvikvm(1117): threadid=1: thread exiting with uncaught exception (group=0xb4ad2b90)
02-11 09:22:18.233: E/AndroidRuntime(1117): FATAL EXCEPTION: main
02-11 09:22:18.233: E/AndroidRuntime(1117): Process: com.example.pizza, PID: 1117
02-11 09:22:18.233: E/AndroidRuntime(1117): android.content.ActivityNotFoundException: Unable to find explicit activity class {com.example.pizza/com.example.pizza.RegActivity}; have you declared this activity in your AndroidManifest.xml?
02-11 09:22:18.233: E/AndroidRuntime(1117):     at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1628)
02-11 09:22:18.233: E/AndroidRuntime(1117):     at android.app.Instrumentation.execStartActivity(Instrumentation.java:1424)
02-11 09:22:18.233: E/AndroidRuntime(1117):     at android.app.Activity.startActivityForResult(Activity.java:3423)
02-11 09:22:18.233: E/AndroidRuntime(1117):     at android.app.Activity.startActivityForResult(Activity.java:3384)
02-11 09:22:18.233: E/AndroidRuntime(1117):     at android.app.Activity.startActivity(Activity.java:3626)
02-11 09:22:18.233: E/AndroidRuntime(1117):     at android.app.Activity.startActivity(Activity.java:3594)
02-11 09:22:18.233: E/AndroidRuntime(1117):     at com.example.pizza.MainActivity$1.onClick(MainActivity.java:33)
02-11 09:22:18.233: E/AndroidRuntime(1117):     at android.view.View.performClick(View.java:4424)
02-11 09:22:18.233: E/AndroidRuntime(1117):     at android.view.View$PerformClick.run(View.java:18383)
02-11 09:22:18.233: E/AndroidRuntime(1117):     at android.os.Handler.handleCallback(Handler.java:733)
02-11 09:22:18.233: E/AndroidRuntime(1117):     at android.os.Handler.dispatchMessage(Handler.java:95)
02-11 09:22:18.233: E/AndroidRuntime(1117):     at android.os.Looper.loop(Looper.java:137)
02-11 09:22:18.233: E/AndroidRuntime(1117):     at android.app.ActivityThread.main(ActivityThread.java:4998)
02-11 09:22:18.233: E/AndroidRuntime(1117):     at java.lang.reflect.Method.invokeNative(Native Method)
02-11 09:22:18.233: E/AndroidRuntime(1117):     at java.lang.reflect.Method.invoke(Method.java:515)
02-11 09:22:18.233: E/AndroidRuntime(1117):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:777)
02-11 09:22:18.233: E/AndroidRuntime(1117):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:593)
02-11 09:22:18.233: E/AndroidRuntime(1117):     at dalvik.system.NativeStart.main(Native Method)

2 个答案:

答案 0 :(得分:1)

RegActivityAndroidManifest.xml的拼写错误。

更改

<activity android:name=".RegAcitvity"/>

<activity android:name=".RegActivity"/> 

或您的Activity名称

答案 1 :(得分:1)

你有印刷错误的RegActivity。在AndroidManifest.xml中更改此行

<activity android:name=".RegAcitvity"/>

这一行

<activity android:name=".RegActivity"/>