刚刚接手安卓,环境搭建完了之后,按照书上新建的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!
因为没有基础,希望回答的能详细点。谢谢
程序如下:
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!
因为没有基础,希望回答的能详细点。谢谢
解决方案 »
- ACTION_POINTER_UP 怎样知道是哪个触点释放?
- 控件长按拖动那种功能怎样实现
- android开发环境都弄了半天
- request time failed问题,求解啊
- 请问这种类型的选项卡如何实现?
- Do Androids Dream of Electric Sheep?
- launcher2启动后如何直接进到显示所有app的页面
- 谁做过三星判断Andorid双卡手机是哪个卡来电
- 用MQTT的代理RSMB来实现Android消息推送,怎么获取当前连接的客户端数量
- Android Native Applicaiton调试,启动AVD一直报nullpointer错误
- 求解关于Audioservice
- 谁有android视频播放器源代码,要能用的!哈
根本安装不了,你重新建一个模拟器试试?
看看是什么报错,贴上来,
但是楼主:
"
setContentView(R.layout.main);
TextView tv = new TextView(this);
tv.setText("Hello World");
setContentView(tv);
"
这个写法是没错,建议不要这么搞 养成好习惯么