,就是显示“unfortunately XXXhas stopped” 是什么情况!!
package com.example.activity;
import com.example.firstactivity.R;
import android.app.Activity;
import android.os.Bundle;
import android.util.Log;
import android.view.Window;
public class FristActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState){
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.first_layout);
Log.e("FristActivity", "onCreate excute");
}
}
AndroidManifest中 activity的name错误,应该是com.example.activity.FristActivity
这个是 .xml 的文件
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<Button
android:id="@+id/button_1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Button_1"/>
</LinearLayout>
manifest 文件
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.firstactivity"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="18"
android:targetSdkVersion="18" />
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name=".FristActivity"
android:label="This is FirstActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
</application>
</manifest>
你先clean一下试试
我 clean 了 还是不行
firstActivity的包名与manifest里面都不致,还想运行
没问题呀 不是 gen 目录 下的 com.example.firstactivity 这个 包么 ?还是我没理解你的意思 ? -。-||
真的是这样啊 谢谢你 ~ ps: 我是按照书上 写的,说是上面全名的缩写 ,但却没编译过,确实理解不了了