Virtual box Android emulator and Eclipse - android

I start to use this VirtualBox machine as Android emulator in my development:
http://www.buildroid.org/blog/?page_id=121
I install and execute my application in this emulator but when I try to connect to Eclipse using adb connect [my ip address] I found problems.
When I connect my virtual machine with Eclipse using host only network for eth1 my virtual device lost its internet connection. My device access internet only when eth01 network configuration is NAT but with this configuration I can't connect with Eclipse using adb connect.
Any idea about it?

Finally my Virtual Box emulator work and communicate with Eclipse. When I found the correct network configuration all work perfectly.
My correct network configuration is:
Et01: NAT
Et02: Internal network.
In adb -connect I've use the Et01 Ip to connect it with Eclipse.
I hope be usefull!!

Related

Unable to do wireless debugging (ADB) in android

I have a situation where I need to store some data on USB. There are some errors that occur when I try to attach USB to my android device. I tried to debug my app through ADB. Here is what I have done up till now.
I have downloaded the AndroidWiFiADB plugin.
I have connected my mobile by giving commands through the terminal.
E:>adb connect 192.168.0.13:5555
connected to 192.168.0.13:5555
and it shows that my device is connected in the terminal.
E:>adb devices
List of devices attached
0123456789ABCDEF device
192.168.0.13:5555 device
But when I press the AndroidWiFiADB icon I get the following message.
"Unable to connect to device 'Signature_Touch'. Make sure that your computer
and your device is connected to the same WiFi network."
I have enabled all the possible options of wifi available in developers' options.
Follow these below steps:
Connect your phone to PC/Laptop with USB.
Open terminal, go to your AndroidSDK/platform-tools local path and type adb devices. That will list down all connected devices.
Type: adb tcpip 5555
Type: adb connect <your-ip-address>:5555
Type: adb devices. That will show your device that is connected wireless with your IP Address and Port.
Then, you can enjoy Wireless debugging.
Note: You need to have same network on your PC/Laptop and on your phone.
Before connecting through WiFi you need to connect the device using USB to authorize the PC in the device (Such thing can't be done through wifi).
Then using the terminal, ping the device's IP. Pinging must be successful.
Then restart ADB and connect to your device.
Update
Since Android 11, you can use Android studio BumbleBee to use built-in "Adb over wifi" feature
You can use ADB Wifi Connect to debug the android application via wifi. You can also find it from android studio plugins.
You have to be in the same network to use wifi debugging.
May be help you.
Your Computer and Your Device should be connected to the same network. So that your device can be able to make a bridge connection with your computer.

Is it possible to run the Android emulator on other system connected via LAN?

I want to test/debug my Android application on an Android emulator running on a remote system which is connected via LAN.
Is this possible?
adb kill-server
adb connect <IP>:5555
ip address should be the actual IP of your virtual machine running..

Android Studio connect ADB via Ethernet

Is there a way to connect the ADB via Ethernet from within the Android Studio IDE? The device I have to use has no USB slave ports.
This feature has been added recently.
Install some Android-x86 on your Xen/KVM/Virtualbox VM and enable debug there.
Ensure you've got shared bridge connection or virtual network device that can reached from outside of VM and can resolve some network address from your favourite WiFi router.
So resolve some address via root terminal with dhcpcd.
There is no ifconfig there. Only ip addr show and ip link show.
Connect with adb to 192.168.x.x with adb connect 192.168.x.x or whatever
Go to Run => Edit Configurations => General => Target device
and choose Show chooser dialog
So when you press run - choose your device and have fun.

Android x86 on VirtualBox: Android Connected But Not Online

I am trying to configure a Android x86 running machine using Oracle VirtualBox so that it works with Eclipse. I am having some trouble in making my virtual machine "online". I connected the phone to adb by typing the following in the Android Terminal Emulator:
ifconfig eth0 192.168.40.1 netmask 255.255.255.0
route add default gw 192.168.40.1 dev eth0
Afterwards, I switched to cmd and typed
adb connect localhost
But when I try to run my test code using Eclipse on the virtual Android, it does not appear in the Android Device Chooser Menu. Furthermore, when I typed adb devices in cmd, this was the response:
List of devices attached
localhost:5555 offline
The other thing that worries me is that each time after I shut down the VM, I have to type the ifconfig and route add commands again in the terminal when I restart, in order to connect to the device.
What can I do to make the device online?
EDIT:
In case it matters, the VM is configured to communicate over a NAT Network. This is what my Port Forwarding Rules look like:
Protocol: TCP
Host IP: *
Host Port: 5555
Guest IP: *
Guest Port: 5555
EDIT2
Related Question: Error: device offline
EDIT3: Potential Solution: Android device chooser - My device seems offline
This is much easier than all of that, to enable adb over tcpip in the Android VM Terminal Emulator type:
adb tcpip 5555
Then to connect via adb from a command line on your Eclipse machine:
adb connect 192.168.40.1:5555
The VM should now be available via adb devices as well as via the device view in Eclipse.
When I've started to develop some Android application, I have to deal with the same problem, so looking for something, on the VirtualBox guide I've read that the NAT does not require any configuration on the host network and guest system and for this reason, it is the default networking mode in VirtualBox. A virtual machine with NAT enabled acts much like a real computer that connects to the Internet through a router. The "router", in this case, is the VirtualBox networking engine, which maps trac from and to the virtual machine
transparently. In VirtualBox this router is placed between each virtual machine and the host. This separation maximizes security since by default virtual machines cannot talk to each other. The disadvantage of NAT mode is that, much like a private network behind a router, the virtual machine is invisible and unreachable from the outside internet. The network frames sent out by the guest operating system are received by VirtualBox's NAT engine, which extracts the TCP/IP data and resends it using the host operating system. To an application on the host, or to another computer on the same network as the host, it looks like the data was sent by the VirtualBox application on the host, using an IP address belonging to the host. VirtualBox listens for replies to the packages sent, and repacks and resends them to the guest machine on its private network.
The virtual machine receives its network address and configuration on the private network from a DHCP server integrated into VirtualBox. The IP address thus assigned to the virtual machine is usually on a completely different network than the host. As the virtual machine is connected to a private network internal to Virtual-Box and invisible to the host, network services on the guest are not accessible to the host machine or to other computers on the same network. However, like a physical router, VirtualBox can make selected services available to the world outside the guest through port forwarding. This means that VirtualBox listens to certain ports on the host and resends all packets which arrive there to the guest, on the same or a different port.
So, executing cmd, go to the folder where the VirtualBox is installed and where the VBManage.exe is and type this in order to apply the TPC port forwarding:
VBoxManage modifyvm "NameOfYourAndroidVM" --natpf1 adb,tcp,*,5555,*,5555
Now you can connect to your virtual machine through adb with:
adb connect localhost
Just configure the vm to use the pridge network mode and have a dhcp server enabled on the network.
I reckon most people have already tried this, but in my case the issue was fixed simply by connecting to VirtualBox's built-in wifi access point called "VirtWifi" (which gives the virtual machine internet access). All my virtual machine network changes are default besides the 5555 Port Forwarding rule. I am virtualizing Android v9.0 (Pie).

android emulation on virtual box in eclipse

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.
I have 2 Questions:
Is it possible to get access with DDMS in eclipse like the real device to the virtual box version?
How can i install in .apk package on the virtual box android?
I hope somoeone can help me.
Thanks!
Press Alt+F1, type netcfg write down the IP address and press Alt+F7.
Run adb connect <virtual_machine_ip> in terminal on your host machine.
You should then see the device in ADT and be able to run your applications on it.
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:
cd to your VirtualBox folder on Windows: (C:/Program Files/Oracle/VirtualBox)
set up a port forwarding rule via command line like so: VBoxManage modifyvm <name_of_your_android_vm> --natpf1 adb,tcp,*,5555,*,5555
Run your vm
Connect to your VM by typing adb connect localhost:5555
Launch your application in Eclipse and you will see localhost:5555 as an available AVD

Categories

Resources