Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Test android app on Virtual Box from Android studio

I have a very specific problem. I am trying to create an Android app for educational purposes, together with a friend of mine. The problem is, my processor does not support VT-x, which is essential for using an AVD, and my Android phone is considerably old so it can't really take much.

Therefore, the one solution I have in mind is using VirtualBox to create a 32-bit Android Virtual Machine and test my app there.

The problem is that, unlike an actual Android device and an AVD, a VirtualBox Android VM does not have, for what my knowledge is, an obvious way of being connected with Android Studio for testing each new app build.

So, what I am asking for is exactly that: a way to immediately test the app I have written in Android Studio in my Android Virtual Machine I have created on VirtualBox, including any workarounds that effectively allow me to immediately test the app on the VM, other than finding a way to make adb work with it.

like image 928
Noob Doob Avatar asked Jan 31 '15 13:01

Noob Doob


People also ask

Can Android Studio run on VirtualBox?

based on virtualbox , can be integrated into android studio with ease . needs an AMD-V proc if not a VT-x . If the processor does not support these, the emulator still works, but your emulated device will only be able to use one CPU.

How do you test Android apps?

Users need to follow these simple steps to test an android app on a real device: Sign up on BrowserStack App-Live for a free trial. Upload your App through Playstore or directly upload your APK file from your system. Choose the desired Android real device and get started!

Can Android emulator run on virtual machine?

Android Emulator allows you to run emulations of Android devices on Windows, macOS or Linux machines. The Android Emulator runs the Android operating system in a virtual machine called an Android Virtual Device (AVD). The AVD contains the full Android software stack, and it runs as if it were on a physical device.

Can I run Android apps on VirtualBox?

Launch the VMTo start installing Android, just select the VM and then click start. You may be asked to “Select a start-up disk”, if so, select the Android ISO. The next screen will show boot options, to install Android to the VM you need to scroll down and select the “Installation” option.


2 Answers

I see I'm a bit late on this one but I figured it out. I am using Windows 8, running Android x86 (4.4 r1) on VirtualBox.

1. Set up a Host-Only adapter so that the VM has access to your network; You can set this up only when the Android image is off. Basically just go into your settings, click on Network, and select Host-Only Adapter in the drop-down labeled Attached to. For Adapter Type select PCnet-FAST III. Check the box next to Cable Connected if it isn't already.

2. Set up an NAT Adapter by selecting a different Adapter tab and for Attached to select NAT. For Adapter Type select PCnet-FAST III again. Check the box next to Cable Connected if it isn't already.

3. Enable Developer Mode by starting up the Android image, then going to Settings > About phone/tablet > Build Number. Click on Build Number 7 times. You should see a pop up that tells you how many more times you need to click to get into Developer mode. Credit to RMP PianoTuning's answer below

4. Get the virtual Android's IP address by going into Settings > About phone/tablet > Status > and then scrolling down until you find your local IP Address. Remember this number, you'll need it for the next step.

5. Start up Android Studio and go into the console; it should be one of the options in the bottom-left corner. Type in adb connect (IP address from step 4). Take a deep breath and hit enter. If it says

connected to (IP address)

you are ready to rock! When you run the app within Android Studio, your virtual Android should appear as Innotek GmbH VirtualBox, or something like the same. Select that puppy and enjoy your new, easy-to-test-on emulator. Its even Bluetooth Compatible! (but thats a whole 'nother story... google it)

like image 167
omikes Avatar answered Oct 19 '22 02:10

omikes


Now a virtualbox isn't an answer to your need.

here are some alternatives,

Genymotion http://www.genymotion.com/ which is an easy to use android emulator , i suggest you look into it. based on virtualbox , can be integrated into android studio with ease . needs an AMD-V proc if not a VT-x . If the processor does not support these, the emulator still works, but your emulated device will only be able to use one CPU.

The other option is adb over wifi, which will let you use your phone without doing the dropbox step http://forum.xda-developers.com/showthread.php?t=1685736. For this to work you will need root though.

like image 35
TheAnimatrix Avatar answered Oct 19 '22 02:10

TheAnimatrix