今天,将Andorid的开发环境从台式机迁移到笔记本上,结果启动笔记本上新建的工程时,发现AVD中原来开发的应用运行正常,
而新建的工程出现emulator-5554 disconnected! Cancelling问题。
错误的log
[2012-03-14 10:03:14 - helloWord] ------------------------------
[2012-03-14 10:03:14 - helloWord] Android Launch!
[2012-03-14 10:03:14 - helloWord] adb is running normally.
[2012-03-14 10:03:14 - helloWord] Performing test.android.HelloWordActivity activity launch
[2012-03-14 10:03:14 - helloWord] Automatic Target Mode: Preferred AVD 'hello' is not available. Launching new emulator.
[2012-03-14 10:03:14 - helloWord] Launching a new emulator with Virtual Device 'hello'
[2012-03-14 10:03:48 - Emulator] emulator: WARNING: Unable to create sensors port: Unknown error
[2012-03-14 10:03:48 - helloWord] New emulator found: emulator-5554
[2012-03-14 10:03:49 - helloWord] Waiting for HOME ('android.process.acore') to be launched...
[2012-03-14 10:03:54 - helloWord] emulator-5554 disconnected! Cancelling 'test.android.HelloWordActivity activity launch'!
应该是迁移过程中虚拟的SD卡发生损坏,造成新应用无法写入虚拟SD卡造成,参照大家的解决方法,将AVD删除重新建立,
应用启动正常。
从而推论以后要迁移开发环境与SDK应该重新建立AVD确保应用写入正常。
还有一种说法是:手动关掉未启动的AVD或者手动关闭AVD时,虚拟机并未彻底关闭掉造成的。
可以手动建一个bat批处理处理一下即可。
代码如下:
@echo off
[盘符]
cd [sdk的tools所在路径]
emulator -avd [虚拟机的名称]
[注]在 Debug As->Debug Configuration->Target下
选中Wipe User Data选项。