【问题标题】:Android application force to terminateAndroid应用强制终止
【发布时间】:2012-12-18 21:12:39
【问题描述】:

我编写了简单的代码,但我不知道为什么我的模拟器总是显示这个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>

【问题讨论】:

  • 您对 Logcat 有什么期望。??必需的日志.....!!!!发布它
  • 你能把logcat错误放在分享中吗
  • 你能发布你的主布局xml文件吗??
  • @Sam-In-TechValens ,@raju ,@Shoshi,@Subburaj 我附上了 logcat 的超链接 ...请参考
  • 您可以使用字符 > 将错误部分(红色部分)复制到 stackoverflow 进行格式化。如果您要附上屏幕截图,请展开消息的列。我已经回答了您在该 logcat 和您的问题中提供的信息。

标签: android android-emulator


【解决方案1】:

请更改包名“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”

【讨论】:

  • 在非大写字母中声明包名称是一个好习惯,但它不可能对异常负责。
【解决方案2】:

我还没有尝试过,但请用这个编辑过的文件替换您的 清单文件

<?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>

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2011-04-20
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-04-24
    • 1970-01-01
    相关资源
    最近更新 更多