eclipse eclipse中虚拟框上的android仿真

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/6751911/
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-09-19 16:38:40  来源:igfitidea点击:

android emulation on virtual box in eclipse

androideclipsevirtualbox

提问by fluxim

I have android running on virtualbox, to use it as a second cell phone with an bluetooth usb stick, to connect it with a real device.

我在virtualbox上运行android,将其用作带有蓝牙USB棒的第二部手机,将其与真实设备连接。

I have 2 Questions:

我有两个问题:

  1. Is it possible to get access with DDMS in eclipse like the real device to the virtual box version?

  2. How can i install in .apk package on the virtual box android?

  1. 是否可以在 Eclipse 中使用 DDMS 像真实设备一样访问虚拟盒版本?

  2. 如何在虚拟机 android 上安装 .apk 包?

I hope somoeone can help me.

我希望有人能帮助我。

Thanks!

谢谢!

回答by citizen conn

  1. Press Alt+F1, type netcfgwrite down the IP address and press Alt+F7.
  2. Run adb connect <virtual_machine_ip>in terminal on your host machine.
  1. Alt+ F1,输入netcfg写下 IP 地址并按Alt+ F7
  2. adb connect <virtual_machine_ip>在主机上的终端中运行。

You should then see the device in ADT and be able to run your applications on it.

然后,您应该会在 ADT 中看到该设备并能够在其上运行您的应用程序。

Edit:This will work if you are set up to use bridged or host-only adapters: for NAT you must set up port forwarding first:

编辑:如果您设置为使用桥接或仅主机适配器,这将起作用:对于 NAT,您必须先设置端口转发:

  1. cd to your VirtualBox folder on Windows: (C:/Program Files/Oracle/VirtualBox)
  2. set up a port forwarding rule via command line like so: VBoxManage modifyvm <name_of_your_android_vm> --natpf1 adb,tcp,*,5555,*,5555
  3. Run your vm
  4. Connect to your VM by typing adb connect localhost:5555
  5. Launch your application in Eclipse and you will see localhost:5555 as an available AVD
  1. cd 到您在 Windows 上的 VirtualBox 文件夹:(C:/Program Files/Oracle/VirtualBox)
  2. 通过命令行设置端口转发规则,如下所示: VBoxManage modifyvm <name_of_your_android_vm> --natpf1 adb,tcp,*,5555,*,5555
  3. 运行你的虚拟机
  4. 通过键入连接到您的 VM adb connect localhost:5555
  5. 在 Eclipse 中启动您的应用程序,您将看到 localhost:5555 作为可用的 AVD