Android应用程序强制终止

时间:2013-01-04 12:13:34

标签: android android-emulator

我编写了简单的代码,但我不知道为什么我的模拟器总是向我展示error:"the application has stopped unexpectedly android please try again"。我试图摆脱它,但没有成功帮助我,谢谢。 http://www.imageurlhost.com/images/msvwuxotq5fcpg63q8br_Logcat.png

 package com.tusway.BasicTutorial;
    import android.app.Activity;
    import android.os.Bundle;
    public class myMenu extends Activity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
    // TODO Auto-generated method stub
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);
    }
    }

我的xml

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.tusway.BasicTutorial"
android:versionCode="1"
android:versionName="1.0">
<uses-sdk android:minSdkVersion="8" />

<application android:icon="@drawable/icon" android:label="@string/app_name">
<activity android:name=".MyMain"
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=".myMenu"
              android:label="@string/app_name">
        <intent-filter>
            <action android:name="com.tusway.BasicTutorial.CLEARSCREEN" />
            <category android:name="android.intent.category.DEFAULT" />
        </intent-filter>
    </activity>
</application>
</manifest>

2 个答案:

答案 0 :(得分:-1)

我没有尝试过,但请用此EDITED代替清单文件

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.tusway.BasicTutorial"
android:versionCode="1"
android:versionName="1.0">
<uses-sdk android:minSdkVersion="8" />
<application android:icon="@drawable/icon" android:label="@string/app_name">
<activity android:name=".MyMain"
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="com.tusway.BasicTutorial.CLEARSCREEN"
             />

</application>
</manifest>

答案 1 :(得分:-2)

请更改包名“com.tusway.BasicTutorial”

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

请将其更改为“com.tusway.basictutorial”