应用程序无法在Next Button之后启动

时间:2014-01-25 17:53:57

标签: android

我正在为Android制作应用程序。这是一个使者。我已经做到了,但问题是,当我点击第一个下一个按钮时,它会关闭并说“不幸的是,FirstApp已停止”。我在Eclipse IDE中制作它,但每当我点击它时,它都是相同的,我会在你说出我要上传的代码之后上传代码。 这是我在MainActivity.java中的代码:

public void openNewActivity(View view) {
    Intent intent = (new Intent(MainActivity.this, TermsConditionsStarting.class));
    startActivity(intent);
}

的logcat -

01-25 23:37:10.058: W/ActivityThread(29794): Application com.example.firstapp2014 can be debugged on port 8100...
01-25 23:37:10.158: I/Adreno-EGL(29794): <qeglDrvAPI_eglInitialize:320>: EGL 1.4 QUALCOMM Build: I0404c4692afb8623f95c43aeb6d5e13ed4b30ddbDate: 11/06/13
01-25 23:37:10.198: D/OpenGLRenderer(29794): Enabling debug mode 0
01-25 23:37:16.534: D/AndroidRuntime(29794): Shutting down VM
01-25 23:37:16.534: W/dalvikvm(29794): threadid=1: thread exiting with uncaught exception (group=0x415ecba8)
01-25 23:37:16.534: E/AndroidRuntime(29794): FATAL EXCEPTION: main
01-25 23:37:16.534: E/AndroidRuntime(29794): Process: com.example.firstapp2014, PID: 29794
01-25 23:37:16.534: E/AndroidRuntime(29794): java.lang.IllegalStateException: Could not execute method of the activity
01-25 23:37:16.534: E/AndroidRuntime(29794):    at android.view.View$1.onClick(View.java:3823)
01-25 23:37:16.534: E/AndroidRuntime(29794):    at android.view.View.performClick(View.java:4438)
01-25 23:37:16.534: E/AndroidRuntime(29794):    at android.view.View$PerformClick.run(View.java:18422)
01-25 23:37:16.534: E/AndroidRuntime(29794):    at android.os.Handler.handleCallback(Handler.java:733)
01-25 23:37:16.534: E/AndroidRuntime(29794):    at android.os.Handler.dispatchMessage(Handler.java:95)
01-25 23:37:16.534: E/AndroidRuntime(29794):    at android.os.Looper.loop(Looper.java:136)
01-25 23:37:16.534: E/AndroidRuntime(29794):    at android.app.ActivityThread.main(ActivityThread.java:5017)
01-25 23:37:16.534: E/AndroidRuntime(29794):    at java.lang.reflect.Method.invokeNative(Native Method)
01-25 23:37:16.534: E/AndroidRuntime(29794):    at java.lang.reflect.Method.invoke(Method.java:515)
01-25 23:37:16.534: E/AndroidRuntime(29794):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
01-25 23:37:16.534: E/AndroidRuntime(29794):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
01-25 23:37:16.534: E/AndroidRuntime(29794):    at dalvik.system.NativeStart.main(Native Method)
01-25 23:37:16.534: E/AndroidRuntime(29794): Caused by: java.lang.reflect.InvocationTargetException
01-25 23:37:16.534: E/AndroidRuntime(29794):    at java.lang.reflect.Method.invokeNative(Native Method)
01-25 23:37:16.534: E/AndroidRuntime(29794):    at java.lang.reflect.Method.invoke(Method.java:515)
01-25 23:37:16.534: E/AndroidRuntime(29794):    at android.view.View$1.onClick(View.java:3818)
01-25 23:37:16.534: E/AndroidRuntime(29794):    ... 11 more
01-25 23:37:16.534: E/AndroidRuntime(29794): Caused by: android.content.ActivityNotFoundException: Unable to find explicit activity class {com.example.firstapp2014/com.example.firstapp2014.TermsConditionsStarting}; have you declared this activity in your AndroidManifest.xml?
01-25 23:37:16.534: E/AndroidRuntime(29794):    at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1628)
01-25 23:37:16.534: E/AndroidRuntime(29794):    at android.app.Instrumentation.execStartActivity(Instrumentation.java:1424)
01-25 23:37:16.534: E/AndroidRuntime(29794):    at android.app.Activity.startActivityForResult(Activity.java:3424)
01-25 23:37:16.534: E/AndroidRuntime(29794):    at android.app.Activity.startActivityForResult(Activity.java:3385)
01-25 23:37:16.534: E/AndroidRuntime(29794):    at android.app.Activity.startActivity(Activity.java:3627)
01-25 23:37:16.534: E/AndroidRuntime(29794):    at android.app.Activity.startActivity(Activity.java:3595)
01-25 23:37:16.534: E/AndroidRuntime(29794):    at com.example.firstapp2014.MainActivity.openNewActivity(MainActivity.java:26)
01-25 23:37:16.534: E/AndroidRuntime(29794):    ... 14 more
01-25 23:37:17.755: I/Process(29794): Sending signal. PID: 29794 SIG: 9
01-25 23:41:23.695: W/ActivityThread(30141): Application com.example.firstapp2014 can be debugged on port 8100...
01-25 23:41:23.805: I/Adreno-EGL(30141): <qeglDrvAPI_eglInitialize:320>: EGL 1.4 QUALCOMM Build: I0404c4692afb8623f95c43aeb6d5e13ed4b30ddbDate: 11/06/13
01-25 23:41:23.835: D/OpenGLRenderer(30141): Enabling debug mode 0
01-25 23:41:24.806: D/AndroidRuntime(30141): Shutting down VM
01-25 23:41:24.806: W/dalvikvm(30141): threadid=1: thread exiting with uncaught exception (group=0x415ecba8)
01-25 23:41:24.806: E/AndroidRuntime(30141): FATAL EXCEPTION: main
01-25 23:41:24.806: E/AndroidRuntime(30141): Process: com.example.firstapp2014, PID: 30141
01-25 23:41:24.806: E/AndroidRuntime(30141): java.lang.IllegalStateException: Could not execute method of the activity
01-25 23:41:24.806: E/AndroidRuntime(30141):    at android.view.View$1.onClick(View.java:3823)
01-25 23:41:24.806: E/AndroidRuntime(30141):    at android.view.View.performClick(View.java:4438)
01-25 23:41:24.806: E/AndroidRuntime(30141):    at android.view.View$PerformClick.run(View.java:18422)
01-25 23:41:24.806: E/AndroidRuntime(30141):    at android.os.Handler.handleCallback(Handler.java:733)
01-25 23:41:24.806: E/AndroidRuntime(30141):    at android.os.Handler.dispatchMessage(Handler.java:95)
01-25 23:41:24.806: E/AndroidRuntime(30141):    at android.os.Looper.loop(Looper.java:136)
01-25 23:41:24.806: E/AndroidRuntime(30141):    at android.app.ActivityThread.main(ActivityThread.java:5017)
01-25 23:41:24.806: E/AndroidRuntime(30141):    at java.lang.reflect.Method.invokeNative(Native Method)
01-25 23:41:24.806: E/AndroidRuntime(30141):    at java.lang.reflect.Method.invoke(Method.java:515)
01-25 23:41:24.806: E/AndroidRuntime(30141):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
01-25 23:41:24.806: E/AndroidRuntime(30141):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
01-25 23:41:24.806: E/AndroidRuntime(30141):    at dalvik.system.NativeStart.main(Native Method)
01-25 23:41:24.806: E/AndroidRuntime(30141): Caused by: java.lang.reflect.InvocationTargetException
01-25 23:41:24.806: E/AndroidRuntime(30141):    at java.lang.reflect.Method.invokeNative(Native Method)
01-25 23:41:24.806: E/AndroidRuntime(30141):    at java.lang.reflect.Method.invoke(Method.java:515)
01-25 23:41:24.806: E/AndroidRuntime(30141):    at android.view.View$1.onClick(View.java:3818)
01-25 23:41:24.806: E/AndroidRuntime(30141):    ... 11 more
01-25 23:41:24.806: E/AndroidRuntime(30141): Caused by: android.content.ActivityNotFoundException: Unable to find explicit activity class {com.example.firstapp2014/com.example.firstapp2014.TermsConditionsStarting}; have you declared this activity in your AndroidManifest.xml?
01-25 23:41:24.806: E/AndroidRuntime(30141):    at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1628)
01-25 23:41:24.806: E/AndroidRuntime(30141):    at android.app.Instrumentation.execStartActivity(Instrumentation.java:1424)
01-25 23:41:24.806: E/AndroidRuntime(30141):    at android.app.Activity.startActivityForResult(Activity.java:3424)
01-25 23:41:24.806: E/AndroidRuntime(30141):    at android.app.Activity.startActivityForResult(Activity.java:3385)
01-25 23:41:24.806: E/AndroidRuntime(30141):    at android.app.Activity.startActivity(Activity.java:3627)
01-25 23:41:24.806: E/AndroidRuntime(30141):    at android.app.Activity.startActivity(Activity.java:3595)
01-25 23:41:24.806: E/AndroidRuntime(30141):    at com.example.firstapp2014.MainActivity.openNewActivity(MainActivity.java:26)
01-25 23:41:24.806: E/AndroidRuntime(30141):    ... 14 more

1 个答案:

答案 0 :(得分:3)

在清单文件中声明TermsConditionsStarting活动

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