【问题标题】:Not getting output on emulator window在模拟器窗口上没有得到输出
【发布时间】:2010-12-30 17:28:15
【问题描述】:

我是一名初学者,正在尝试使用 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);
        }
}

【问题讨论】:

  • 无需粘贴 DMMS。还有……你能说得更具体点吗?你想看什么?你看到了什么呢?尝试执行应用程序时,eclipse 是否会给您带来错误?您是否正确创建了 android 模拟器?

标签: android android-emulator emulation ddms


【解决方案1】:

我遇到了这个“问题”,模拟器需要很长时间才能启动。放置 10 分钟,文字就会出现!

【讨论】:

  • 亲爱的克里斯蒂安,我期待“你好,Android”出现在屏幕上。但是什么都没有。有一个带有android编写的默认屏幕。同样在窗口窗格上写着 5554:my_sdk(虚拟设备的名称)。而我期待helloandroid。我遵循了确切的 hello world 程序。我看到带有键盘的模拟器窗口。出现错误“错误版本:独立”。但在 ddms.bat 上添加 ping emulator 0012 后,此错误消失。在这两种情况下我都无法获得输出。
猜你喜欢
  • 2022-07-29
  • 1970-01-01
  • 1970-01-01
  • 2017-08-22
  • 2016-01-02
  • 2012-08-21
  • 2018-02-04
  • 2018-06-09
  • 2010-10-28
相关资源
最近更新 更多