我是一名初学者,正在尝试使用 developer.android.com 运行 Hello world 应用程序。我正在使用 eclipse helios、Android 2.3、最新的 jdk 和 sdk。使用window xp,所以有32位版本。我无法在弹出的模拟器窗口上获得输出。窗格或主屏幕上没有输出。我正在使用默认的 ddms.bat 并且没有进行任何更改。任何人都可以建议做什么。
附上我的 ddms.bat 和 java 代码
维沙尔
ddms.bat
setlocal
rem Set up prog to be the path of this script, including following symlinks,
rem and set up progdir to be the fully-qualified pathname of its directory.
set prog=%~f0
rem Change current directory and drive to where the script is, to avoid
rem issues with directories containing whitespaces.
cd /d %~dp0
rem Check we have a valid Java.exe in the path.
set java_exe=
call lib\find_java.bat
if not defined java_exe goto :EOF
set jarfile=ddms.jar
set frameworkdir=
if exist %frameworkdir%%jarfile% goto JarFileOk
set frameworkdir=lib\
if exist %frameworkdir%%jarfile% goto JarFileOk
set frameworkdir=..\framework\
:JarFileOk
if debug NEQ "%1" goto NoDebug
set java_debug=-agentlib:jdwp=transport=dt_socket,server=y,address=8050,suspend=y
shift 1
:NoDebug
set jarpath=%frameworkdir%%jarfile%
if not defined ANDROID_SWT goto QueryArch
set swt_path=%ANDROID_SWT%
goto SwtDone
:QueryArch
for /f %%a in ('%java_exe% -jar %frameworkdir%archquery.jar') do set swt_path=%frameworkdir%%%a
:SwtDone
if exist %swt_path% goto SetPath
echo SWT folder '%swt_path%' does not exist.
echo Please set ANDROID_SWT to point to the folder containing swt.jar for your platform.
exit /B
:SetPath
set javaextdirs=%swt_path%;%frameworkdir%
call %java_exe% %java_debug% -Dcom.android.ddms.bindir= -classpath "%jarpath%;%swt_path%\swt.jar" com.android.ddms.Main %*
Java 代码
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);
}
}