不幸的是MyApp已经停止了。我该怎么解决这个问题?

时间:2016-04-04 20:41:28

标签: android-studio

这是我的第二个问题,因为第一个问题是无法捕捉所有课程

我开始开发,而我遇到了这个问题,不幸的是____已经停止了。我该如何解决这个问题?

这是logcat:

04-04 16:36:25.270 1906-1906/? I/art: Late-enabling -Xcheck:jni
04-04 16:36:25.496 1906-1926/com.example.user01.myapplicationnew D/OpenGLRenderer: Render dirty regions requested: true
04-04 16:36:25.508 1906-1906/com.example.user01.myapplicationnew D/Atlas: Validating map...
04-04 16:36:25.537 1906-1926/com.example.user01.myapplicationnew D/libEGL: loaded /system/lib/egl/libEGL_emulation.so
04-04 16:36:25.538 1906-1926/com.example.user01.myapplicationnew D/libEGL: loaded /system/lib/egl/libGLESv1_CM_emulation.so
04-04 16:36:25.541 1906-1926/com.example.user01.myapplicationnew D/libEGL: loaded /system/lib/egl/libGLESv2_emulation.so
04-04 16:36:25.574 1906-1926/com.example.user01.myapplicationnew I/OpenGLRenderer: Initialized EGL, version 1.4
04-04 16:36:25.629 1906-1926/com.example.user01.myapplicationnew D/OpenGLRenderer: Enabling debug mode 0
04-04 16:36:25.665 1906-1926/com.example.user01.myapplicationnew W/EGL_emulation: eglSurfaceAttrib not implemented
04-04 16:36:25.665 1906-1926/com.example.user01.myapplicationnew W/OpenGLRenderer: Failed to set EGL_SWAP_BEHAVIOR on surface 0xe2b19200, error=EGL_SUCCESS
04-04 16:36:26.257 1906-1906/com.example.user01.myapplicationnew I/Choreographer: Skipped 34 frames!  The application may be doing too much work on its main thread.
04-04 16:36:30.056 1906-1906/com.example.user01.myapplicationnew D/AndroidRuntime: Shutting down VM
04-04 16:36:30.056 1906-1906/com.example.user01.myapplicationnew E/AndroidRuntime: FATAL EXCEPTION: main
                                                                                   Process: com.example.user01.myapplicationnew, PID: 1906
                                                                                   android.content.ActivityNotFoundException: Unable to find explicit activity class {com.example.user01.myapplicationnew/com.example.user01.myapplicationnew.LoginActivity}; have you declared this activity in your AndroidManifest.xml?
                                                                                       at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1761)
                                                                                       at android.app.Instrumentation.execStartActivity(Instrumentation.java:1485)
                                                                                       at android.app.Activity.startActivityForResult(Activity.java:3736)
                                                                                       at android.app.Activity.startActivityForResult(Activity.java:3697)
                                                                                       at android.support.v4.app.FragmentActivity.startActivityForResult(FragmentActivity.java:843)
                                                                                       at android.app.Activity.startActivity(Activity.java:4007)
                                                                                       at android.app.Activity.startActivity(Activity.java:3975)
                                                                                       at com.example.user01.myapplicationnew.MainActivity.onClick(MainActivity.java:51)
                                                                                       at android.view.View.performClick(View.java:4756)
                                                                                       at android.view.View$PerformClick.run(View.java:19749)
                                                                                       at android.os.Handler.handleCallback(Handler.java:739)
                                                                                       at android.os.Handler.dispatchMessage(Handler.java:95)
                                                                                       at android.os.Looper.loop(Looper.java:135)
                                                                                       at android.app.ActivityThread.main(ActivityThread.java:5221)
                                                                                       at java.lang.reflect.Method.invoke(Native Method)
                                                                                       at java.lang.reflect.Method.invoke(Method.java:372)
                                                                                       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899)
                                                                                       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)

这是我的manifest.xml

<?xml version="1.0" encoding="utf-8"?>

<application



android:allowBackup="true"
    android:icon="@mipmap/ic_launcher"
    android:label="@string/app_name"
    android:supportsRtl="true"
    android:theme="@style/Theme.AppCompat">
    <activity
        android:name=".MainActivity"
        android:label="@string/app_name"
        android:theme="@style/AppTheme.NoActionBar">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

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

1 个答案:

答案 0 :(得分:1)

logcat中的这一行告诉您问题所在:

ActivityNotFoundException: Unable to find explicit activity class {com.example.user01.myapplicationnew/com.example.user01.myapplicationnew.LoginActivity}; have you declared this activity in your AndroidManifest.xml?

您没有在清单中声明LoginActivity