Hi! We're discussing a clarification of the content license; please look over to Current events if you're interested in editing.
Ubuntu VirtualBox Dev Environment
From Htc-linux
This page will walk you through installing VirtualBox on a Windows host machine, installing Ubuntu as a guest machine, and configuring the Android development environment.
[edit] Setting up an Android dev environment with Ubuntu & VirtualBox
- Download the prerequisites
- Download VirtualBox Note: Do not use the Open Source Edition (OSE) if you wish to connect your device to the virtual machine
- Download the Ubuntu Desktop 32-bit Edition ISO
- Install VirtualBox: Installing on Windows hosts
- Create a new virtual machine
- Click the New button in the VirtualBox main application window
- Create New Virtual Machine: Welcome to the New Virtual Machine Wizard!
- Click Next
- Create New virtual Machine: VM Name and OS Type
- Type the name you wish to use for this virtual machine. I used Android Ubuntu Development
- Select Linux from the Operating System drop down
- Select Ubuntu from the Version drop down
- Click Next
- Create New Virtual Machine: Memory
- Select the amount of memory you want to allocate to this virtual machine. I recommend at least 1024MB
- Click Next
- Create New Virtual Machine: Virtual Hard Disk
- Ensure Boot Hard Disk is checked
- Select Create new hard disk
- Click Next
- Create New Virtual Disk: Welcome to the Create New Virtual Disk Wizard!
- Click Next
- Create New Virtual Disk: Hard Disk Storage Type
- Select Dynamically expanding storage
- Click Next
- Create New Virtual Disk: Virtual Disk Location Size
- Pick where to put the virtual hard disk. Recommend leaving it in the default location and name.
- Select the size of the virtual hard disk. I recommend at least 32GB.
- Click Next
- Create New Virtual Disk: Summary
- Click Finish
- Create New Virtual Disk: Welcome to the Create New Virtual Disk Wizard!
- Create New Virtual Machine: Summary
- Click Finish
- Customize the virtual machine
- Right click your newly created virtual machine in the VirtualBox main appplication window and select Settings
- Setup networking
- Click Networking in the Settings Window
- Ensure you are on the Adapter 1 tab
- Ensure Enable Network Adapter is checked
- Select Bridge Adapter from the Attached To drop down
- Select your host computer network adapter from the Name drop down
- (Optional) Disable Audio
- Click Audio in the Settings Window
- Uncheck Enable Audio
- Click OK
- Set the Ubuntu ISO as a bootable CD on the virtual machine
- Right click your newly created virtual machine in the VirtualBox main appplication window and select Settings
- Click Storage
- Select the Empty CD under IDE Controller
- Click the folder with a green caret to open the Virtual Media Manager
- In the Virtual Media Manager, add the Ubuntu ISO to available CD/DVD Images
- Click the Add icon
- Navigate to and select the Ubuntu ISO you downloaded
- Ensure Ubuntu ISO is highlighted
- Click Select
- Ensure the Ubuntu ISO is shown under IDE Controller in the Storage Settings
- Click OK
- Install Ubuntu
- In the VirtualBox main application window, double click your virtual machine to start it
- The virtual machine should boot in to Ubuntu, follow Step 4 Install it! by clicking the Show Me button.
- Update Ubuntu
- Click the System menu from the top menu bar
- Select Administration
- Click Update Manager
- When Update Manager starts, click Install Updates
- Restart the virtual machine if necessary
- Install VirtualBox Guest Additions
- Install packages required by Android
- Open a terminal window and execute the following commands:
- sudo apt-get install git-core gnupg flex bison gperf libsdl-dev libesd0-dev libwxgtk2.6-dev build-essential zip curl libncurses5-dev zlib1g-dev
- Open a terminal window and execute the following commands:
- Install Sun Java [3]
- Open a teminal window and execute the following commands:
- For Android 2.1 Eclair, you need Sun Java 1.5
- sudo add-apt-repository "deb http://us.archive.ubuntu.com/ubuntu/ jaunty multiverse"
- sudo add-apt-repository "deb http://us.archive.ubuntu.com/ubuntu/ jaunty-updates multiverse"
- sudo apt-get update
- sudo apt-get install sun-java5-jdk
- sudo update-java-alternatives -l (Verify that java 1.5 installed)
- sudo update-java-alternatives -s java-1.5.0-sun (set java 1.5 was not the default installation)
- java -version (Verify that java 1.5 is the default installation)
- For Android 2.2 Froyo, you need Sun Java 1.6
- sudo apt-get install sun-java6-jdk
- sudo update-java-alternatives -l (Verify that java 1.6 installed)
- sudo update-java-alternatives -s java-6-sun (if java 1.6 was not the default installation)
- java -version (Verify that java 1.6 is the default installation)
- Java 6 for Ubuntu 10.10 instructions [4]
- Some people swear by openjdk
- app-get install openjdk-6-jdk
- Some people swear by openjdk
- For Android 2.1 Eclair, you need Sun Java 1.5
- Open a teminal window and execute the following commands:
- Install the toolchain of your choice and compile!
[edit] Tips
- (HOW-TO) ADB via VirtualBox USB passthrough (Windows host to Ubuntu guest)
- if you get "error: insufficient permissions for device" when running an "adb" command, use "sudo adb" instead
- Configure VirtualBox Shared Folders in a Windows Host
- If you have trouble accessing the shared folder after running update manager, reinstall VirtualBox additions
[edit] Tools
- agcc - script wrapping commands for cross-compiling for the android platform
- droid-wrapper - This wrapper is similar to agcc but all command line arguments will be passed to the compiler and linker (this is important for the software uses configure) and this script supports gcc, g++, and ld.
