• 博客园logo
  • 会员
  • 众包
  • 新闻
  • 博问
  • 闪存
  • 赞助商
  • HarmonyOS
  • Chat2DB
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录
james1207

博客园    首页    新随笔    联系   管理    订阅  订阅

Android程序安装后在模拟器上不显示,并且控制台显示The launch will only sync the application package on the device!

初学安卓,今天写了一个小例子,可是eclipse控制台却提示

No Launcher activity found!

The launch will only sync the application package on the device!

但是设备我已经启动了呀,后来慢慢发现,在配置文件AndroidManifest.xml中,有这两句话:

 

<application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        <activity
            android:name="com.lovemu.textview.MainActivity"
            android:label="@string/app_name" >
            <intent-filter>
                <!--标识Activity为一个程序的开始-->
                <action android:name="android.intent.action.MAIN" />
                <!--决定应用程序是否显示在程序列表里-->
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>


 

其中的<action android:name="android.intent.action.MAIN" />中的MAIN我以为是自己定义的布局管理器XML文件,被我改了,所以启动不了。

可是改过之后,还是出错,经排查,发现android:name="com.lovemu.textview.MainActivity"对应的类文件中,需要:

 

@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.linearlayout);
	}


其中的setContentView(R.layout.linearlayout);我没有加。

 

至此,程序能运行成功。

 

posted @ 2013-09-27 18:47  Class Xman  阅读(256)  评论(0)    收藏  举报
刷新页面返回顶部
博客园  ©  2004-2025
浙公网安备 33010602011771号 浙ICP备2021040463号-3