小菜请教个问题,eoeandroid上没解决

XueSeCaiHong 2012-09-22 07:31:54
刚刚接手安卓,环境搭建完了之后,按照书上新建的helloword程序,但是在运行的时候,虚拟机光能调用,不显示“helloworld”。下面错误提示是 。在网上找了好多答案,包括删除R.java文件,重启程序,删除buildpath的库文件。。。都解决不了问题。请高手们帮忙回答一下吧。
程序如下:
package helloword.a;

import android.app.Activity;
import android.os.Bundle;
import android.widget.TextView;


public class HellowordActivity extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
TextView tv = new TextView(this);
tv.setText("Hello World");
setContentView(tv);
}
}


Console显示:
[2012-09-21 18:52:08 - helloword] ------------------------------
[2012-09-21 18:52:08 - helloword] Android Launch!
[2012-09-21 18:52:08 - helloword] adb is running normally.
[2012-09-21 18:52:08 - helloword] Performing helloword.a.HellowordActivity activity launch
[2012-09-21 18:52:08 - helloword] Automatic Target Mode: Preferred AVD '2.3.1' is not available. Launching new emulator.
[2012-09-21 18:52:08 - helloword] Launching a new emulator with Virtual Device '2.3.1'
[2012-09-21 18:52:10 - helloword] New emulator found: emulator-5554
[2012-09-21 18:52:10 - helloword] Waiting for HOME ('android.process.acore') to be launched...
[2012-09-21 18:52:53 - helloword] HOME is up on device 'emulator-5554'
[2012-09-21 18:52:53 - helloword] Uploading helloword.apk onto device 'emulator-5554'
[2012-09-21 18:52:53 - helloword] Installing helloword.apk...
[2012-09-21 18:53:26 - helloword] Installation failed due to invalid APK file!
[2012-09-21 18:53:26 - helloword] Please check logcat output for more details.
[2012-09-21 18:53:26 - helloword] Launch canceled!

因为没有基础,希望回答的能详细点。谢谢
...全文
212 6 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
小强1002 2012-09-24
  • 打赏
  • 举报
回复
看下应该是没问题的,运行了下也是对的
但是楼主:
"
setContentView(R.layout.main);
TextView tv = new TextView(this);
tv.setText("Hello World");
setContentView(tv);
"
这个写法是没错,建议不要这么搞 养成好习惯么
XueSeCaiHong 2012-09-24
  • 打赏
  • 举报
回复
没有解决问题啊
dong3560 2012-09-24
  • 打赏
  • 举报
回复
根本安装不上。。。
b87936260 2012-09-24
  • 打赏
  • 举报
回复
manifest中minsdk太高了把
ameyume 2012-09-22
  • 打赏
  • 举报
回复
先把TextView放在main.xml中,看看能不能显示hello world。
mimitracely 2012-09-22
  • 打赏
  • 举报
回复
[2012-09-21 18:53:26 - helloword] Installation failed due to invalid APK file!


根本安装不了,你重新建一个模拟器试试?
看看是什么报错,贴上来,

80,472

社区成员

发帖
与我相关
我的任务
社区描述
移动平台 Android
androidandroid-studioandroidx 技术论坛(原bbs)
社区管理员
  • Android
  • yechaoa
  • 失落夏天
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧