android - 'Hello Android' 教程问题

标签 android eclipse

我是 Eclipse 和 Android 的新手,但对 Java 比较熟悉。话虽如此,我尝试使用最新的 Eclipse (Galieo) 和 2.1 Android SDK 遵循开发者网站上的“Hello Android”教程,我在运行 Snow Leopard (OS X 10.6) 的 Macintosh 上。我有一个默认的虚拟设备(尽管我的目标实际上是针对像我自己的 HTC Incredible 这样的手机,它配备了金鱼草处理器,当然还有智能手机中的所有最新装备)。

在我转到 RUN>RUN 然后选择“Android 应用程序”之前,一切似乎都很顺利。我的电脑转动了一会儿,然后我看到两个错误。我在下面粘贴了 Eclipse 的输出:

[2010-05-04 01:53:46 - HelloAndroid] ------------------------------
[2010-05-04 01:53:46 - HelloAndroid] Android Launch!
[2010-05-04 01:53:46 - HelloAndroid] adb is running normally.
[2010-05-04 01:53:46 - HelloAndroid] Performing com.example.helloandroid.HelloAndroid activity launch
[2010-05-04 01:53:46 - HelloAndroid] Automatic Target Mode: launching new emulator with compatible AVD 'myAVD'
[2010-05-04 01:53:46 - HelloAndroid] Launching a new emulator with Virtual Device 'myAVD'
[2010-05-04 01:53:58 - HelloAndroid] New emulator found: emulator-5554
[2010-05-04 01:53:58 - HelloAndroid] Waiting for HOME ('android.process.acore') to be launched...
[2010-05-04 01:53:59 - Emulator] 2010-05-04 01:53:59.501 emulator[10398:903] Warning once: This application, or a library it uses, is using NSQuickDrawView, which has been deprecated. Apps should cease use of QuickDraw and move to Quartz.
[2010-05-04 01:54:23 - HelloAndroid] emulator-5554 disconnected! Cancelling 'com.example.helloandroid.HelloAndroid activity launch'!

我从来没有在模拟器中看到文本,并且模拟器崩溃并显示有关意外退出的消息。

崩溃报告指出:

Process:         emulator [10472]
Path:            /Applications/android-sdk-mac_86/tools/emulator
Identifier:      emulator
Version:         ??? (???)
Code Type:       X86 (Native)
Parent Process:  eclipse [10468]

Date/Time:       2010-05-04 02:25:41.153 -0500
OS Version:      Mac OS X 10.6.3 (10D573)
Report Version:  6

Interval Since Last Report:          2558914 sec
Crashes Since Last Report:           4
Per-App Crashes Since Last Report:   2
Anonymous UUID:                      C5F178C1-5290-4CA9-AD6E-E9C4F5582754

Exception Type:  EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_INVALID_ADDRESS at 0x000000001fd2f000
Crashed Thread:  3

注意:从命令行运行模拟器:

iainnitro-Mac:tools iainnitro$ ./emulator -avd myAVD

2010-05-04 02:49:23.011 emulator[10556:903] Warning once: This application, or a library it
uses, is using NSQuickDrawView, which has been deprecated. Apps should cease use of QuickDraw 
and move to Quartz.
Segmentation fault
iainnitro-Mac:tools iainnitro$

产生段错误(如上文所述,来自终端输出)。因此,模拟器在显示任何内容之前就会自行消亡。

我已尝试重新启动 ADB 进程。

实际代码是逐行从教程中提取的,我还没有接触到 XML 部分。

我不确定我的环境设置有什么问题,或者只是与 Snow Leopard 不兼容?我非常感谢任何帮助解决这个问题,因为我对在此平台上进行开发非常感兴趣。

谢谢,

迈克 N 劳伦斯,堪萨斯州

最佳答案

没有直接经验,但这似乎是一个反复出现的问题:

This thread建议:

You haven't let the emulator boot all the way up. Start it then wait until you see a desktop, just like on a real phone.

This one提到(我怀疑第 1 点不是你关心的问题):

  1. Get more RAM. I was running on 256 MB (which I believe is below minimum requirements), just upgraded today to 1024 MB (long time coming), application now starts fine. Although I still do see some error messages in the emulator, they don't seem to actually do anything.

  2. Install from command line. This is a bit laborius, but you can launch an emulator from the command line (assuming <android sdk path>\tools is added to your PATH variable) just type emulator, then browse to the location of your_app_here.apk, and execute

adb install your_app_here.apk

If you launch the emulator from Eclipse, execute adb kill-service and then adb start-service first (or kill-server / start-server. not sure the exact commands). Then your app will be installed on the emulator.


还有 ( a bit old but might still be relevant )

Maybe the emulator is running so slow, and the adb server, or another component like "DDMS" is a little "desperate" because seems it's waiting to the emulator to iniatialize the some HOME aplication.
But the emulator is running slow, the console in Eclipse send a message: emulator-5554 disconnected! Cancelling 'com.android.hello.HelloAndroid' launch!; and the emulator continues running normally and boot it's system, but don't run application that I build.

So for that problem I run program, and when the emulator is opened, I go back to eclipse in DDMS Perspective and in the Device tab y press a button "restart adb server" before the console shows me the message of "emulator-5554 disconnected!".
I do it several times until the emulator finally boot the OS.
After booted the OS on the emulator, eclipse don't send that disconnect error, and "sends" the app that I've built, also the console shows messages about this.
Then finally appears on the mobile "Hello, Android".

关于android - 'Hello Android' 教程问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2763395/

相关文章:

尝试在 Eclipse 中运行时 LWJGL 中出现 java.lang.NoClassDefFoundError

android - 在android中合并图像

android - 如何在 Android 的 Scrollview 中添加更多项目?

java - 如何添加 Eclipse Gradle 任务选项卡?

eclipse - 我怎样才能摆脱警告 m2eclipse "goals inplace, exploded, manifest are ignored by m2e"

java - Eclipse&Maven - 导入org.hibernate.boot.无法解析

java - 我第一次使用 Eclipse 时遇到以下错误

android - phonegap 自动发送 GPS 位置到 Mysql 服务器。即使应用程序未打开

android - 我如何处理 android 应用程序中的网络连接不良?

android - Vitamio 媒体播放器授权