好的,伙计们,我决定尝试这个开发人员的东西,在大约十二个教程之后,最终得到了以下 Hello World 类型的程序:
package com.example.helloandroid;
import android.app.Activity;
import android.os.Bundle;
import android.widget.TextView;
public class HelloAndroid extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
TextView tv = new TextView(this);
tv.setText("Hello, Android");
setContentView(tv);}
}
很简单,所以我去编译它,我得到了这个
[2011-03-14 00:11:25 - HelloAndroid] Android Launch!
[2011-03-14 00:11:25 - HelloAndroid] adb is running normally.
[2011-03-14 00:11:25 - HelloAndroid] Performing com.example.helloandroid.HelloAndroid activity launch
[2011-03-14 00:11:25 - HelloAndroid] Automatic Target Mode: launching new emulator with compatible AVD 'my_avd'
[2011-03-14 00:11:25 - HelloAndroid] Launching a new emulator with Virtual Device 'my_avd'
[2011-03-14 00:11:30 - HelloAndroid] New emulator found: emulator-5554
[2011-03-14 00:11:30 - HelloAndroid] Waiting for HOME ('android.process.acore') to be launched...
或者如果我已经启动了模拟器,我会得到这个
[2011-03-14 08:23:09 - HelloAndroid] Android Launch!
[2011-03-14 08:23:09 - HelloAndroid] adb is running normally.
[2011-03-14 08:23:09 - HelloAndroid] Performing com.example.helloandroid.HelloAndroid activity launch
[2011-03-14 08:23:09 - HelloAndroid] Automatic Target Mode: using existing emulator 'emulator-5554' running compatible AVD 'my_avd'
[2011-03-14 08:23:09 - HelloAndroid] WARNING: Application does not specify an API level requirement!
[2011-03-14 08:23:09 - HelloAndroid] Device API version is 7 (Android 2.1-update1)
[2011-03-14 08:23:09 - HelloAndroid] Uploading HelloAndroid.apk onto device 'emulator-5554'
[2011-03-14 08:23:09 - HelloAndroid] Installing HelloAndroid.apk...
[2011-03-14 08:23:26 - HelloAndroid] Success!
[2011-03-14 08:23:27 - HelloAndroid] Starting activity com.example.helloandroid.HelloAndroid on device emulator-5554
然后模拟器每次都会出现这个空白屏幕,上面有文字“android”。它在那里坐了大约 3 分钟,直到它进入另一个空白的黑色屏幕,除了它的动画之外还有“android”。我环顾四周,似乎找不到任何有同样问题的人。就像模拟器甚至无法识别我正在做的任何事情一样。这是空白虚无的漂亮屏幕截图:
那么,你知道我哪里做错了吗?
最佳答案
尝试等待模拟器加载所有内容,然后再启动您的应用。
关于java - Android 模拟器没有响应程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5299260/