Tuesday, June 4, 2013

Make Android Studio work with AndroVM (VirtualBox)

After playing around for a little while with Android on a real device, I thought I'd post on how I got my AndroidVM to work with the new Android Studio.

  1. In VirtualBox Settings for the Device, enable Port Forwarding, using 5555 as the Host Port and 5555 as the Guest Port.
    Virtual Box Port Forwarding Setup
  2. Open a Console/Command Prompt and go to your Android Studio installation and run adb connect 127.0.0.1
    running ADB to connect to Virtual Box
  3. Now setup your project in Android Studio and Run It when it Pops the user interface, select the Emulator Null.
    Select the Device to Connect To
  4. You should now see in the output the following information
    Waiting for device.
    Target device: emulator-5554
    Uploading file
        local path: C:\Users\paul\AndroidStudioProjects\VMConnectProject\VMConnect\build\apk\VMConnect-debug-unaligned.apk
        remote path: /data/local/tmp/com.example.vmconnect
    Installing com.example.vmconnect
    DEVICE SHELL COMMAND: pm install -r "/data/local/tmp/com.example.vmconnect"
    pkg: /data/local/tmp/com.example.vmconnect
    Success

    Launching application: com.example.vmconnect/com.example.vmconnect.MainActivity.
    DEVICE SHELL COMMAND: am start -n "com.example.vmconnect/com.example.vmconnect.MainActivity" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER
    Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=com.example.vmconnect/.MainActivity }

    Android Studio Connection Output
  5. You should now be able to debug and Test your application in the Andoid VM on VirtualBox.


    2 comments:

    Giorgio Laconi said...

    Thank you very much.
    It's working perfectly and immediately.
    Just one thing, we have to lunch the virtual machine before launching the instructions from the command prompt.

    Grazie, ha funzionato tutto subito.

    Unknown said...

    Thanks, this help.

    That video to:
    https://www.youtube.com/watch?v=a2GPLSGdPh0