Android中的模拟器问题

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/1740834/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-20 03:34:02  来源:igfitidea点击:

Emulator problem in Android

androideclipseandroid-emulatoradtavd

提问by AMANDEEP SINGH

When I launch the emulator I face many problems (Errors):-

当我启动模拟器时,我遇到了很多问题(错误):-

HttpConnectionApp]emulator-5554 disconnected!
Cancelling 'net.paxcel.http.HttpConnectionApp activity launch'!

Emulator]emulator: ERROR: the user data image is used by another emulator.
aborting            

Each time I have to re-run it but all in vain.

每次我都必须重新运行它,但都是徒劳的。

How can I improve this so that I can re-run the application on same AVD?

如何改进这一点,以便我可以在同一个 AVD 上重新运行应用程序?

回答by Travis

I had the same issue after my computer locked up and I had to power cycle it.

在我的计算机锁定后我遇到了同样的问题,我不得不重新启动它。

Wiping the user data didn't fix my problem, I had to delete the following folders manually

擦除用户数据并没有解决我的问题,我不得不手动删除以下文件夹

C:\Users\%UserName%\.android\avd\AVD2.1.avd\cache.img.lock
C:\Users\%UserName%\.android\avd\AVD2.1.avd\userdata-qemu.img.lock

回答by eold

A quick-fix that obviously works is to restart the adb server each time this error occurs:

一个明显有效的快速修复方法是每次发生此错误时重新启动 adb 服务器:

adb kill-server && adb start-server

Then, you simply run the application again (without restarting AVD) and that's it.

然后,您只需再次运行该应用程序(无需重新启动 AVD)即可。

回答by Coc B.

Run configurationsTargetWipe user data→ Run.

Run configurationsTargetWipe user data→ 运行。

It fixed the problem in my case.

它解决了我的问题。

回答by Murat

Here is the answer that helped me: link text

这是帮助我的答案: 链接文本

Another solution for me is start the avd manager and start once emulator from there. After that everything turns to normal.

对我来说另一个解决方案是启动 avd 管理器并从那里启动一次模拟器。之后一切都恢复正常。

回答by Dimitar Dimitrov

AFAIK, this happens when an emulator is started, but the Android Debug Bridge couldn't establish connection to it.

AFAIK,当模拟器启动时会发生这种情况,但 Android 调试桥无法与其建立连接。

If you have just started the emulator with your application, watch if you get Waiting for HOME to launch...or something similar in your Console.

如果你刚刚用你的应用程序启动了模拟器,看看Waiting for HOME to launch...你的控制台中是否有类似的东西。

If you don't get that message, but the emulator has been started, chances are, you'll get into the ERROR: the user data image is used by another emulatorsituation again.

如果您没有收到该消息,但模拟器已启动,您很可能会ERROR: the user data image is used by another emulator再次陷入这种情况。

回答by Rupin

Under Run Configurations--> Target --> Add Command Line Options add this

Run Configurations--> 目标 --> 添加命令行选项下添加这个

adb kill-server && adb start-server

every time running your App will kill-restart the adb server.

每次运行你的应用程序都会杀死重启 adb 服务器。

回答by Mia

Delete the existing emulators and then make a new one.

删除现有的模拟器,然后创建一个新的模拟器。

This worked for me, when I had this problem and couldn't find the folders to delete.

这对我有用,当我遇到这个问题并且找不到要删除的文件夹时。

回答by Brendan Conboy

emulator: ERROR: the user data image is used by another emulator. aborting

模拟器:错误:用户数据图像被另一个模拟器使用。中止

Tried restarting the computer as I had done a lot of messing around earlier but no joy same error.

尝试重新启动计算机,因为我之前做了很多乱七八糟的事情,但没有同样的错误。

Went to shut down ADB so as I'm on XP I run > cmd then paste in > cd C:\Program Files\Android\android-sdk\platform-tools (the location of the location for the ADB on XP)

去关闭ADB,以便我在XP上运行> cmd然后粘贴> cd C:\Program Files\Android\android-sdk\platform-tools(XP上ADB的位置位置)

Tried

试过

adb kill-server && adb start-server

adb kill-server && adb start-server

Then moved the directories cache.img.lock and userdata-qemu.img.lock in the C:\Documents and Settings\.android\avd\ to a New folder (instead of deleting)

然后将 C:\Documents and Settings\.android\avd\ 中的目录 cache.img.lock 和 userdata-qemu.img.lock 移动到新文件夹(而不是删除)

This worked fine.

这工作得很好。

回答by shmoo

Thanks for this! Just to add for some people who develop in Windows XP.

谢谢你!只是为一些在 Windows XP 中开发的人添加。

The path to the avd directory can be C:\Documents and Settings\.android\avd

avd目录的路径可以是C:\Documents and Settings\.android\avd

Thanks again for the answer! :)

再次感谢您的回答!:)

回答by Cody Frazer

This can also happen if you're using a network share as your home folder, because some network file sharing systems may lock the image files.

如果您使用网络共享作为主文件夹,也会发生这种情况,因为某些网络文件共享系统可能会锁定图像文件。