├── .gitignore ├── cookbooks └── sqlite-dev │ ├── recipes │ └── default.rb │ ├── metadata.rb │ ├── LICENSE.txt │ └── README.md ├── .gitmodules ├── Vagrantfile ├── 51-android.rules ├── provision.sh ├── README.md └── LICENSE /.gitignore: -------------------------------------------------------------------------------- 1 | .vagrant 2 | *~ 3 | .Ulysses* -------------------------------------------------------------------------------- /cookbooks/sqlite-dev/recipes/default.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Cookbook Name:: sqlite-dev 3 | # Recipe:: default 4 | # 5 | # Copyright 2012, Pedro Axelrud 6 | # 7 | 8 | package "sqlite-dev" do 9 | package_name value_for_platform( 10 | %w[centos redhat suse fedora] => { "default" => "sqlite-devel" }, 11 | "default" => "libsqlite3-dev" 12 | ) 13 | end 14 | -------------------------------------------------------------------------------- /cookbooks/sqlite-dev/metadata.rb: -------------------------------------------------------------------------------- 1 | name "sqlite-dev" 2 | maintainer "Pedro Axelrud" 3 | maintainer_email "pedroaxl@gmail.com" 4 | license "MIT" 5 | description "Installs sqlite dev libs" 6 | long_description "Please refer to README.md" 7 | version "0.0.1" 8 | 9 | recipe "sqlite-dev", "Installs sqlite development packages" 10 | 11 | %w[ubuntu debian centos redhat suse fedora].each do |os| 12 | supports os 13 | end 14 | -------------------------------------------------------------------------------- /cookbooks/sqlite-dev/LICENSE.txt: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | Copyright © 2012 Phil Cohen 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy 5 | of this software and associated documentation files (the “Software”), to deal 6 | in the Software without restriction, including without limitation the rights 7 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | copies of the Software, and to permit persons to whom the Software is 9 | furnished to do so, subject to the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be included in 12 | all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | THE SOFTWARE. -------------------------------------------------------------------------------- /cookbooks/sqlite-dev/README.md: -------------------------------------------------------------------------------- 1 | # chef-xslt 2 | 3 | ## Description 4 | 5 | Installs development package for `libxslt`. 6 | 7 | 8 | ## Requirements 9 | 10 | ### Supported Platforms 11 | 12 | The following platforms are supported by this cookbook, meaning that the recipes run on these platforms without error: 13 | 14 | * Ubuntu 15 | * Debian 16 | * CentOS 17 | * Red Hat 18 | * Scientific 19 | * Fedora 20 | * SUSE 21 | 22 | 23 | ## Recipes 24 | 25 | * `xslt` - The default recipe. 26 | 27 | 28 | ## Usage 29 | 30 | This cookbook installs the libxslt components if not present, and pulls updates if they are installed on the system. 31 | 32 | 33 | ## Attributes 34 | 35 | None 36 | 37 | 38 | ## Basic Settings 39 | 40 | None 41 | 42 | 43 | ## Contributing 44 | 45 | 1. Fork it 46 | 2. Create your feature branch (`git checkout -b my-new-feature`) 47 | 3. Commit your changes (`git commit -am 'Added some feature'`) 48 | 4. Push to the branch (`git push origin my-new-feature`) 49 | 5. Create new Pull Request 50 | 51 | 52 | ## License 53 | 54 | **chef-xslt** 55 | 56 | * Freely distributable and licensed under the [MIT license](http://phlipper.mit-license.org/2012/license.html). 57 | * Copyright (c) 2012 Phil Cohen (github@phlippers.net) [![endorse](http://api.coderwall.com/phlipper/endorsecount.png)](http://coderwall.com/phlipper) 58 | * http://phlippers.net/ 59 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "cookbooks/apt"] 2 | path = cookbooks/apt 3 | url = https://github.com/opscode-cookbooks/apt.git 4 | [submodule "cookbooks/build-essential"] 5 | path = cookbooks/build-essential 6 | url = https://github.com/opscode-cookbooks/build-essential.git 7 | [submodule "cookbooks/git"] 8 | path = cookbooks/git 9 | url = https://github.com/opscode-cookbooks/git.git 10 | [submodule "cookbooks/vim"] 11 | path = cookbooks/vim 12 | url = https://github.com/opscode-cookbooks/vim.git 13 | [submodule "cookbooks/java"] 14 | path = cookbooks/java 15 | url = https://github.com/opscode-cookbooks/java.git 16 | [submodule "cookbooks/yum-epel"] 17 | path = cookbooks/yum-epel 18 | url = https://github.com/opscode-cookbooks/yum-epel.git 19 | [submodule "cookbooks/windows"] 20 | path = cookbooks/windows 21 | url = https://github.com/opscode-cookbooks/windows.git 22 | [submodule "cookbooks/dmg"] 23 | path = cookbooks/dmg 24 | url = https://github.com/opscode-cookbooks/dmg.git 25 | [submodule "cookbooks/runit"] 26 | path = cookbooks/runit 27 | url = https://github.com/opscode-cookbooks/runit.git 28 | [submodule "cookbooks/packagecloud"] 29 | path = cookbooks/packagecloud 30 | url = https://github.com/computology/packagecloud-cookbook.git 31 | [submodule "cookbooks/chef_handler"] 32 | path = cookbooks/chef_handler 33 | url = https://github.com/opscode-cookbooks/chef_handler.git 34 | [submodule "cookbooks/yum"] 35 | path = cookbooks/yum 36 | url = https://github.com/opscode-cookbooks/yum.git 37 | -------------------------------------------------------------------------------- /Vagrantfile: -------------------------------------------------------------------------------- 1 | # -*- mode: ruby -*- 2 | # vi: set ft=ruby : 3 | 4 | VAGRANTFILE_API_VERSION = "2" 5 | HARVARD_CLASS_NAME = "csci65" 6 | 7 | Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| 8 | 9 | config.vm.box = "precise64" 10 | config.vm.box_url = "http://files.vagrantup.com/precise64.box" 11 | config.vm.host_name = HARVARD_CLASS_NAME 12 | 13 | # Boot with a GUI so you can see the screen. (Default is headless) 14 | # config.vm.boot_mode = :gui 15 | config.vm.provider "virtualbox" do |v| 16 | v.name = HARVARD_CLASS_NAME 17 | v.gui = true 18 | end 19 | 20 | 21 | config.vm.provider "vmware_fusion" do |v, override| 22 | override.vm.box_url = "http://files.vagrantup.com/precise64_vmware.box" 23 | v.name = HARVARD_CLASS_NAME 24 | v.gui = true 25 | v.vmx["memsize"] = "1024" 26 | v.vmx["numvcpus"] = "1" 27 | end 28 | 29 | # Create a forwarded port mapping which allows access to a specific port 30 | # within the machine from a port on the host machine. In the example below, 31 | # accessing "localhost:8080" will access port 80 on the guest machine. 32 | config.vm.network :forwarded_port, guest: 5037, host: 5037, auto_correct: true # Android ADB port 33 | 34 | 35 | # Enable provisioning with chef solo, specifying a cookbooks path, roles 36 | # path, and data_bags path (all relative to this Vagrantfile), and adding 37 | # some recipes and/or roles. 38 | config.vm.provision :chef_solo do |chef| 39 | 40 | chef.cookbooks_path = "cookbooks" 41 | 42 | chef.add_recipe "apt" 43 | chef.add_recipe "git" 44 | chef.add_recipe "build-essential" 45 | chef.add_recipe "java" 46 | chef.add_recipe "sqlite-dev" 47 | chef.add_recipe "vim" 48 | 49 | end 50 | 51 | config.vm.provision "shell", inline: "echo Installing Android ADT bundle and NDK..." 52 | config.vm.provision "shell", path: "provision.sh" 53 | config.vm.provision "shell", inline: "echo Installation complete" 54 | 55 | config.vm.synced_folder "./", "/vagrant", owner: 'vagrant', group: 'vagrant' 56 | end 57 | -------------------------------------------------------------------------------- /51-android.rules: -------------------------------------------------------------------------------- 1 | #Acer 2 | SUBSYSTEM=="usb", ATTR{idVendor}=="0502", MODE="0666", GROUP="plugdev" 3 | 4 | #ASUS 5 | SUBSYSTEM=="usb", ATTR{idVendor}=="0b05", MODE="0666", GROUP="plugdev" 6 | 7 | #Dell 8 | SUBSYSTEM=="usb", ATTR{idVendor}=="413", MODE="0666", GROUP="plugdev" 9 | 10 | #Foxconn 11 | SUBSYSTEM=="usb", ATTR{idVendor}=="0489", MODE="0666", GROUP="plugdev" 12 | 13 | #Fujitsu/Fujitsu Toshiba 14 | SUBSYSTEM=="usb", ATTR{idVendor}=="04c5", MODE="0666", GROUP="plugdev" 15 | 16 | #Garmin-Asus 17 | SUBSYSTEM=="usb", ATTR{idVendor}=="091e", MODE="0666", GROUP="plugdev" 18 | 19 | #Google 20 | SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", MODE="0666", GROUP="plugdev" 21 | 22 | #Hisense 23 | SUBSYSTEM=="usb", ATTR{idVendor}=="109b", MODE="0666", GROUP="plugdev" 24 | 25 | #HTC 26 | SUBSYSTEM=="usb", ATTR{idVendor}=="0bb4", MODE="0666", GROUP="plugdev" 27 | 28 | #Huawei 29 | SUBSYSTEM=="usb", ATTR{idVendor}=="12d1", MODE="0666", GROUP="plugdev" 30 | 31 | #K-Touch 32 | SUBSYSTEM=="usb", ATTR{idVendor}=="24e3", MODE="0666", GROUP="plugdev" 33 | 34 | #KT Tech 35 | SUBSYSTEM=="usb", ATTR{idVendor}=="2116", MODE="0666", GROUP="plugdev" 36 | 37 | #Kyocera 38 | SUBSYSTEM=="usb", ATTR{idVendor}=="0482", MODE="0666", GROUP="plugdev" 39 | 40 | #Lenovo 41 | SUBSYSTEM=="usb", ATTR{idVendor}=="2006", MODE="0666", GROUP="plugdev" 42 | 43 | #LG 44 | SUBSYSTEM=="usb", ATTR{idVendor}=="1004", MODE="0666", GROUP="plugdev" 45 | 46 | #Motorola 47 | SUBSYSTEM=="usb", ATTR{idVendor}=="22b8", MODE="0666", GROUP="plugdev" 48 | 49 | #NEC 50 | SUBSYSTEM=="usb", ATTR{idVendor}=="0409", MODE="0666", GROUP="plugdev" 51 | 52 | #Nook 53 | SUBSYSTEM=="usb", ATTR{idVendor}=="2080", MODE="0666", GROUP="plugdev" 54 | 55 | #Nvidia 56 | SUBSYSTEM=="usb", ATTR{idVendor}=="0955", MODE="0666", GROUP="plugdev" 57 | 58 | #OTGV 59 | SUBSYSTEM=="usb", ATTR{idVendor}=="2257", MODE="0666", GROUP="plugdev" 60 | 61 | #Pantech 62 | SUBSYSTEM=="usb", ATTR{idVendor}=="10a9", MODE="0666", GROUP="plugdev" 63 | 64 | #Pegatron 65 | SUBSYSTEM=="usb", ATTR{idVendor}=="1d4d", MODE="0666", GROUP="plugdev" 66 | 67 | #Philips 68 | SUBSYSTEM=="usb", ATTR{idVendor}=="0471", MODE="0666", GROUP="plugdev" 69 | 70 | #PMC-Sierra 71 | SUBSYSTEM=="usb", ATTR{idVendor}=="04da", MODE="0666", GROUP="plugdev" 72 | 73 | #Qualcomm 74 | SUBSYSTEM=="usb", ATTR{idVendor}=="05c6", MODE="0666", GROUP="plugdev" 75 | 76 | #SK Telesys 77 | SUBSYSTEM=="usb", ATTR{idVendor}=="1f53", MODE="0666", GROUP="plugdev" 78 | 79 | #Samsung 80 | SUBSYSTEM=="usb", ATTR{idVendor}=="04e8", MODE="0666", GROUP="plugdev" 81 | 82 | #Sharp 83 | SUBSYSTEM=="usb", ATTR{idVendor}=="04dd", MODE="0666", GROUP="plugdev" 84 | 85 | #Sony 86 | SUBSYSTEM=="usb", ATTR{idVendor}=="054c", MODE="0666", GROUP="plugdev" 87 | 88 | #Sony Ericsson 89 | SUBSYSTEM=="usb", ATTR{idVendor}=="0fce", MODE="0666", GROUP="plugdev" 90 | 91 | #Teleepoch 92 | SUBSYSTEM=="usb", ATTR{idVendor}=="2340", MODE="0666", GROUP="plugdev" 93 | 94 | #Toshiba 95 | SUBSYSTEM=="usb", ATTR{idVendor}=="0930", MODE="0666", GROUP="plugdev" 96 | 97 | #ZTE 98 | SUBSYSTEM=="usb", ATTR{idVendor}=="19d2", MODE="0666", GROUP="plugdev" -------------------------------------------------------------------------------- /provision.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | echo "Installing System Tools..." 4 | sudo apt-get update -y >/dev/null 2>&1 5 | sudo apt-get install -y curl >/dev/null 2>&1 6 | sudo apt-get install -y unzip >/dev/null 2>&1 7 | sudo apt-get install -y libc6-i386 lib32stdc++6 lib32gcc1 lib32ncurses5 >/dev/null 2>&1 8 | sudo apt-get update >/dev/null 2>&1 9 | sudo apt-get install apt-file && apt-file update 10 | sudo apt-get install -y python-software-properties >/dev/null 2>&1 11 | 12 | # http://askubuntu.com/questions/147400/problems-with-eclipse-and-android-sdk 13 | sudo apt-get install -y ia32-libs >/dev/null 2>&1 14 | 15 | # Install a desktop for the Android graphical tooling, e.g. Eclipse 16 | 17 | #echo "What is your preferred Ubuntu desktop?" 18 | #echo "1) Unity desktop (Ubuntu default)" 19 | #echo "2) Gnome desktop" 20 | #echo "3) Gnome Classic desktop" 21 | #echo "4) xfce (lightweight desktop)" 22 | #echo "5) KDE desktop" 23 | #echo "6) Do not install a desktop (use the command line interface only)" 24 | #read case; 25 | 26 | #case $case in 27 | # 1) echo "Installing Unity desktop..." | sudo aptitude install -y --without-recommends ubuntu-desktop >/dev/null 2>&1;; 28 | # 2) echo "Installing Gnome desktop..." | sudo apt-get install -y ubuntu-desktop >/dev/null 2>&1;; 29 | # 3) echo "Installing Gnome Classic desktop..." | sudo apt-get install -y gnome-panel >/dev/null 2>&1;; 30 | # 4) echo "Installing xfce lightweight desktop..." | sudo apt-get install -y xubuntu-desktop >/dev/null 2>&1;; 31 | # 5) echo "Installing KDE desktop..." | sudo apt-get install -y kubuntu-desktop >/dev/null 2>&1;; 32 | # 6) exit 33 | #esac 34 | 35 | echo "Installing Ubuntu Unity Desktop..." 36 | sudo aptitude install -y --without-recommends ubuntu-desktop >/dev/null 2>&1 37 | 38 | # Or, the following desktop... 39 | 40 | #echo "Installing Ubuntu Gnome Desktop..." 41 | #sudo apt-get install -y ubuntu-desktop >/dev/null 2>&1 42 | 43 | # Or, the following desktop... 44 | 45 | #echo "Installing Ubuntu xfce lightweight desktop..." 46 | #sudo apt-get install -y xubuntu-desktop >/dev/null 2>&1 47 | 48 | # Or, the following desktop... 49 | 50 | #echo "Installing Ubuntu KDE Desktop..." 51 | #sudo apt-get install -y kubuntu-desktop >/dev/null 2>&1 52 | 53 | echo "Installing Android ADT Bundle with SDK and Eclipse..." 54 | cd /tmp 55 | sudo curl -O http://dl.google.com/android/adt/adt-bundle-linux-x86_64-20130729.zip 56 | sudo unzip /tmp/adt-bundle-linux-x86_64-20130729.zip >/dev/null 2>&1 57 | sudo mv /tmp/adt-bundle-linux-x86_64-20130729 /usr/local/android/ 58 | sudo rm -rf /tmp/adt-bundle-linux-x86_64-20130729.zip 59 | 60 | echo "Installing Android NDK..." 61 | cd /tmp 62 | sudo curl -O http://dl.google.com/android/ndk/android-ndk-r9-linux-x86_64.tar.bz2 63 | sudo tar -jxf /tmp/android-ndk-r9-linux-x86_64.tar.bz2 >/dev/null 2>&1 64 | sudo mv /tmp/android-ndk-r9 /usr/local/android/ndk 65 | sudo rm -rf /tmp/android-ndk-r9-linux-x86_64.tar.bz2 66 | 67 | sudo mkdir /usr/local/android/sdk/add-ons 68 | 69 | sudo chmod -R 755 /usr/local/android 70 | 71 | sudo ln -s /usr/local/android/sdk/tools/android /usr/bin/android 72 | sudo ln -s /usr/local/android/sdk/platform-tools/adb /usr/bin/adb 73 | 74 | echo "Updating ANDROID_HOME..." 75 | cd ~/ 76 | cat << End >> .profile 77 | export ANDROID_HOME="/usr/local/android/sdk" 78 | export PATH=$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools:$PATH 79 | End 80 | 81 | 82 | echo "Adding USB device driver information..." 83 | echo "For more detail see http://developer.android.com/tools/device.html" 84 | 85 | sudo cp /vagrant/51-android.rules /etc/udev/rules.d 86 | sudo chmod a+r /etc/udev/rules.d/51-android.rules 87 | 88 | sudo service udev restart 89 | 90 | sudo android update adb 91 | sudo adb kill-server 92 | sudo adb start-server 93 | 94 | echo " " 95 | echo " " 96 | echo " " 97 | echo "[ Next Steps ]================================================================" 98 | echo " " 99 | echo "1. Manually setup a USB connection for your Android device to the new VM" 100 | echo " " 101 | echo " If using VMware Fusion (for example, will be similar for VirtualBox):" 102 | echo " 1. Plug your android device hardware into the computers USB port" 103 | echo " 2. Open the 'Virtual Machine Library'" 104 | echo " 3. Select the VM, e.g. 'android-vm: default', right-click and choose" 105 | echo " 'Settings...'" 106 | echo " 4. Select 'USB & Bluetooth', check the box next to your device and set" 107 | echo " the 'Plug In Action' to 'Connect to Linux'" 108 | echo " 5. Plug the device into the USB port and verify that it appears when " 109 | echo " you run 'lsusb' from the command line" 110 | echo " " 111 | echo "2. Your device should appear when running 'lsusb' enabling you to use adb, e.g." 112 | echo " " 113 | echo " $ adb devices" 114 | echo " ex. output," 115 | echo " List of devices attached" 116 | echo " 007jbmi6 device" 117 | echo " " 118 | echo " $ adb shell" 119 | echo " i.e. to log into the device (be sure to enable USB debugging on the device)" 120 | echo " " 121 | echo "See the included README.md for more detail on how to run and work with this VM." 122 | echo " " 123 | echo "[ Start your Ubuntu VM ]======================================================" 124 | echo " " 125 | echo "To start the VM, " 126 | echo " To use with VirtualBox (free)," 127 | echo " " 128 | echo " $ vagrant up" 129 | echo " " 130 | echo " To use with VMware Fusion (OS X) (requires paid plug-in)," 131 | echo " " 132 | echo " $ vagrant up --provider=vmware_fusion" 133 | echo " " 134 | echo " To use VMware Workstation (Windows, Linux) (requires paid plug-in)," 135 | echo " " 136 | echo " $ vagrant up --provider=vmware_workstation" 137 | echo " " 138 | echo " " 139 | echo "See the included README.md for more detail on how to run and work with this VM." 140 | 141 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | android-vm 2 | ========== 3 | 4 | Automated provisioning and configuration of an Ubuntu VM containing the Android development environment, including Android ADT Bundle with SDK, Eclipse & the Android NDK using the Vagrant DevOps tool with Chef and shell-scripts. 5 | 6 | This automated VM installation and configuration uses the excellent DevOps tool, [Vagrant](http://downloads.vagrantup.com/) which works with both VirtualBox (free) and VMware Fusion & Workstation (paid plug-in) in addition to several [Community Chef Cookbooks](http://community.opscode.com/cookbooks). 7 | 8 | **A special welcome to fellow Harvard classmates. This project was built with the Harvard CSCI E-65 Building Mobile Apps course in mind. However, there is no reason it cannot be used to provision a consistent, professional Android development environment.** 9 | 10 | Please feel free to contribute improvements and enhancements to the provisioning code & reporting issues or questions. The goal is to improve this Android VM project with community support. 11 | 12 | Currently, it will provision an Android VM for development with the following specifications, 13 | 14 | - Ubuntu Precise64 VM 15 | - Memory size: 1024 MB 16 | - 1 vCPU 17 | - Ubuntu Unity Desktop as the UI launched at startup (see the provision.sh section "Install a desktop for the Android graphical tooling" for other options) 18 | - [Android ADT Bundle 20130729 (SDK r22.0.5 & Eclipse)](http://dl.google.com/android/adt/adt-bundle-linux-x86_64-20130729.zip) 19 | - [Android NDK r9](http://dl.google.com/android/ndk/android-ndk-r9-linux-x86_64.tar.bz2) 20 | 21 | ## Clone the Android VM Code Repository 22 | 23 | 1. Create a working directory to use for the Android VM project in, e.g. /csci65/android-vm or C:/csci65/android-vm 24 | 25 | In OS X & Linux, e.g. 26 | 27 | $ mkdir /csci65/android-vm 28 | $ cd /csci65/android-vm 29 | 30 | In Windows, e.g. 31 | 32 | $ mkdir c:\csci65\android-vm 33 | $ cd c:\csci65\android-vm 34 | 35 | 2. Download or clone the project repository into the newly created directory on your local machine from one of the following sources, 36 | 37 | Visit the Android-VM repository on GitHub, 38 | 39 | [https://github.com/rickfarmer/android-vm](https://github.com/rickfarmer/android-vm) 40 | 41 | Clone the Android-VM repository directly from GitHub, 42 | 43 | [https://github.com/rickfarmer/android-vm.git](https://github.com/rickfarmer/android-vm.git) 44 | 45 | Download the Android-VM repository as a zip file, 46 | 47 | [https://github.com/rickfarmer/android-vm/archive/master.zip](https://github.com/rickfarmer/android-vm/archive/master.zip) 48 | 49 | 50 | ## Install Vagrant 51 | 52 | Note: Vagrant has a prerequisite of an installed and functioning version of one of the following virtualization products, 53 | 54 | * [VMware Fusion (mac)](http://www.vmware.com/go/tryfusion) (Trial) 55 | * [VMware Workstation (windows, linux)](http://www.vmware.com/products/workstation/workstation-evaluation) (Trial) 56 | * [VirtualBox](https://www.virtualbox.org/wiki/Downloads) (Free) 57 | 58 | 1. Download and install the latest version of Vagrant for your OS from [https://www.vagrantup.com/downloads.html](vagrantup.com/) 59 | 60 | 2. If using VMware, install the purchased VMware Provider Plug-in as mentioned in the documentation 61 | 62 | 63 | ## Install the Android VM 64 | 65 | _Note: All the software needed is automatically downloaded as it is needed. Several of the downloads are somewhat large. Patience is a virtue while the automated installation is running._ 66 | 67 | 1. From the newly created working directory, e.g. 68 | 69 | $ cd /csci65/android-vm 70 | $ git submodule init 71 | $ git submodule update 72 | 73 | 2. Run the following to start Vagrant and kick-off the process to build an Android VM, 74 | 75 | For VirtualBox, 76 | 77 | $ vagrant up 78 | 79 | For VMware Fusion, 80 | 81 | $ vagrant up --provider=vmware_fusion 82 | 83 | For VMware Workstation 84 | 85 | $ vagrant up --provider=vmware_workstation 86 | 87 | _Note: As the Android VM build runs you will see various types of screen output from Vagrant, Chef and Shell scripts -- some of the dependency downloads and compilations require a bit of time. Again, Patience is a virtue._ 88 | 3. Once the Android VM build provisioning process is complete, run the following to login via SSH, 89 | 90 | $ vagrant ssh 91 | 92 | 4. The Ubuntu Unity desktop UI is set to automatically launch on `vagrant up`, login using the credentials, 93 | - Username: vagrant 94 | - Password: vagrant 95 | 5. The Android development environment directories with eclipse, sdk and ndk are located in the directory `/usr/local/android/`. 96 | 6. The VM has an internal `/vagrant` directory which maps to the directory created previously (i.e. the one from which you are running the Android VM on your local machine), e.g. `/csci65/android-vm` or `c:\csci65\android-vm` maps to the internal VM directory `/vagrant`. 97 | 98 | _The net effect is that anything you drop in your local working directory, e.g. e.g. /csci65/android-vm or c:\csci65\android-vm, can be accessed from within the VM by opening the directory "/vagrant" and vice-versa_ 99 | 100 | 101 | ## Manually Configure the Android VM in the Virtualization Provider 102 | 103 | To connect an Android device you must manually setup a USB connection mapping for your Android device to the new VM 104 | 105 | This configuration will vary with your provider (hypervisor), VMware Fusion, Workstation, or VirtualBox. 106 | 107 | For example, if using VMware Fusion perform the following steps, 108 | 109 | 1. Plug your android device hardware into the computers USB port 110 | 2. Open the 'Virtual Machine Library' 111 | 3. Select the VM, e.g. "android-vm: default", right-click and choose 'Settings...' 112 | 4. Select 'USB & Bluetooth', check the box next to your device and set the 'Plug In Action' to 'Connect to Linux' 113 | 5. Plug the device into the USB port and verify that it appears when you run `lsusb` from the command line 114 | 6. Your device should appear when running `lsusb` enabling you to use Android `adb`, e.g. 115 | 116 | $ adb devices 117 | ... 118 | List of devices attached 119 | 007jbmi6 device 120 | 121 | $ adb shell 122 | i.e. to log into the device (be sure to enable USB debugging on the device) 123 | 124 | _Note: Additionally you may want to change various settings in the Virtualization Provider to size memory and vCPUs allocated to the Android VM_ 125 | _Note: To open the terminal from desktop, use ctrl-alt-T for PC or control-option-T for Mac 126 | 127 | ### Vagrant Basics & Workflow 128 | 129 | Vagrant boxes are just pre-configured virtual machines that Vagrant uses as a template to clone. 130 | 131 | To see the available boxes, 132 | 133 | $ vagrant box list 134 | ... 135 | precise64 (vmware_fusion) 136 | precise64 (virtualbox) 137 | centos64 (vmware_fusion) 138 | 139 | The box files (aka template VMs) are stored in `~/vagrant.d` but you should not care since you manage the box files through vagrant. 140 | 141 | When you issue `vagrant up`, vagrant will download the box from the url unless its already cached locally. Once available, it will clone the box into the directory you've chosen to work in, e.g. `/csci65/android-vm` 142 | 143 | In the base directory (e.g. `/csci65/android-vm`) where the `Vagrantfile` is located, you should see a hidden `.vagrant` directory which holds the actual cloned VM files if you are interested in exploring further. 144 | 145 | - To start your vagrant system use, 146 | 147 | For VirtualBox, 148 | 149 | $ vagrant up 150 | 151 | For VMware Fusion, 152 | 153 | $ vagrant up --provider=vmware_fusion 154 | 155 | For VMware Workstation 156 | 157 | $ vagrant up --provider=vmware_workstation 158 | 159 | - To login to your vagrant system use, 160 | 161 | $ vagrant ssh 162 | 163 | - The basic workflow is, 164 | 165 | $ vagrant up # To start the VM using VirtualBox (default) 166 | or 167 | 168 | $ vagrant up --provider=vmware_fusion # To start the VM using VMware Fusion (vmware_workstation for Windows users) 169 | *Spins up the Android VM and loads the Ubuntu Unity desktop UI* 170 | $ vagrant ssh 171 | *At this point you are logged into the VM to do the cli work you want to do, e.g.* 172 | $ lsusb 173 | $ adb devices 174 | $ adb shell 175 | $ adb install 176 | $ adb push 177 | $ adb pull 178 | ... for more detail see [http://developer.android.com/tools/help/adb.html] 179 | 180 | $ android (from the command line) see [http://developer.android.com/tools/projects/projects-cmdline.html] 181 | 182 | $ vagrant status 183 | $ vagrant halt # To shutdown the VM 184 | or 185 | 186 | $ vagrant suspend 187 | 188 | - These are the only commands you will likely use on a regular basis. Vagrant manages everything for you, so there is no need to configure the VM from VMware or Virtual Box except to change the VM memory, CPU allocation, & connect the Android USB device for connection via the Android `adb` command. 189 | 190 | If you are interested in the other options Vagrant offers, please see the man help file using, 191 | 192 | $ vagrant --help 193 | 194 | 195 | ### References 196 | 197 | 1. [Vagrant v2 documentation](http://docs.vagrantup.com/v2/getting-started/) 198 | 2. [http://www.vagrantbox.es/](http://www.vagrantbox.es/) 199 | 3. [Chef Cookbooks](http://community.opscode.com/cookbooks) 200 | 201 | 202 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, and 10 | distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by the copyright 13 | owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all other entities 16 | that control, are controlled by, or are under common control with that entity. 17 | For the purposes of this definition, "control" means (i) the power, direct or 18 | indirect, to cause the direction or management of such entity, whether by 19 | contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the 20 | outstanding shares, or (iii) beneficial ownership of such entity. 21 | 22 | "You" (or "Your") shall mean an individual or Legal Entity exercising 23 | permissions granted by this License. 24 | 25 | "Source" form shall mean the preferred form for making modifications, including 26 | but not limited to software source code, documentation source, and configuration 27 | files. 28 | 29 | "Object" form shall mean any form resulting from mechanical transformation or 30 | translation of a Source form, including but not limited to compiled object code, 31 | generated documentation, and conversions to other media types. 32 | 33 | "Work" shall mean the work of authorship, whether in Source or Object form, made 34 | available under the License, as indicated by a copyright notice that is included 35 | in or attached to the work (an example is provided in the Appendix below). 36 | 37 | "Derivative Works" shall mean any work, whether in Source or Object form, that 38 | is based on (or derived from) the Work and for which the editorial revisions, 39 | annotations, elaborations, or other modifications represent, as a whole, an 40 | original work of authorship. For the purposes of this License, Derivative Works 41 | shall not include works that remain separable from, or merely link (or bind by 42 | name) to the interfaces of, the Work and Derivative Works thereof. 43 | 44 | "Contribution" shall mean any work of authorship, including the original version 45 | of the Work and any modifications or additions to that Work or Derivative Works 46 | thereof, that is intentionally submitted to Licensor for inclusion in the Work 47 | by the copyright owner or by an individual or Legal Entity authorized to submit 48 | on behalf of the copyright owner. For the purposes of this definition, 49 | "submitted" means any form of electronic, verbal, or written communication sent 50 | to the Licensor or its representatives, including but not limited to 51 | communication on electronic mailing lists, source code control systems, and 52 | issue tracking systems that are managed by, or on behalf of, the Licensor for 53 | the purpose of discussing and improving the Work, but excluding communication 54 | that is conspicuously marked or otherwise designated in writing by the copyright 55 | owner as "Not a Contribution." 56 | 57 | "Contributor" shall mean Licensor and any individual or Legal Entity on behalf 58 | of whom a Contribution has been received by Licensor and subsequently 59 | incorporated within the Work. 60 | 61 | 2. Grant of Copyright License. 62 | 63 | Subject to the terms and conditions of this License, each Contributor hereby 64 | grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, 65 | irrevocable copyright license to reproduce, prepare Derivative Works of, 66 | publicly display, publicly perform, sublicense, and distribute the Work and such 67 | Derivative Works in Source or Object form. 68 | 69 | 3. Grant of Patent License. 70 | 71 | Subject to the terms and conditions of this License, each Contributor hereby 72 | grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, 73 | irrevocable (except as stated in this section) patent license to make, have 74 | made, use, offer to sell, sell, import, and otherwise transfer the Work, where 75 | such license applies only to those patent claims licensable by such Contributor 76 | that are necessarily infringed by their Contribution(s) alone or by combination 77 | of their Contribution(s) with the Work to which such Contribution(s) was 78 | submitted. If You institute patent litigation against any entity (including a 79 | cross-claim or counterclaim in a lawsuit) alleging that the Work or a 80 | Contribution incorporated within the Work constitutes direct or contributory 81 | patent infringement, then any patent licenses granted to You under this License 82 | for that Work shall terminate as of the date such litigation is filed. 83 | 84 | 4. Redistribution. 85 | 86 | You may reproduce and distribute copies of the Work or Derivative Works thereof 87 | in any medium, with or without modifications, and in Source or Object form, 88 | provided that You meet the following conditions: 89 | 90 | You must give any other recipients of the Work or Derivative Works a copy of 91 | this License; and 92 | You must cause any modified files to carry prominent notices stating that You 93 | changed the files; and 94 | You must retain, in the Source form of any Derivative Works that You distribute, 95 | all copyright, patent, trademark, and attribution notices from the Source form 96 | of the Work, excluding those notices that do not pertain to any part of the 97 | Derivative Works; and 98 | If the Work includes a "NOTICE" text file as part of its distribution, then any 99 | Derivative Works that You distribute must include a readable copy of the 100 | attribution notices contained within such NOTICE file, excluding those notices 101 | that do not pertain to any part of the Derivative Works, in at least one of the 102 | following places: within a NOTICE text file distributed as part of the 103 | Derivative Works; within the Source form or documentation, if provided along 104 | with the Derivative Works; or, within a display generated by the Derivative 105 | Works, if and wherever such third-party notices normally appear. The contents of 106 | the NOTICE file are for informational purposes only and do not modify the 107 | License. You may add Your own attribution notices within Derivative Works that 108 | You distribute, alongside or as an addendum to the NOTICE text from the Work, 109 | provided that such additional attribution notices cannot be construed as 110 | modifying the License. 111 | You may add Your own copyright statement to Your modifications and may provide 112 | additional or different license terms and conditions for use, reproduction, or 113 | distribution of Your modifications, or for any such Derivative Works as a whole, 114 | provided Your use, reproduction, and distribution of the Work otherwise complies 115 | with the conditions stated in this License. 116 | 117 | 5. Submission of Contributions. 118 | 119 | Unless You explicitly state otherwise, any Contribution intentionally submitted 120 | for inclusion in the Work by You to the Licensor shall be under the terms and 121 | conditions of this License, without any additional terms or conditions. 122 | Notwithstanding the above, nothing herein shall supersede or modify the terms of 123 | any separate license agreement you may have executed with Licensor regarding 124 | such Contributions. 125 | 126 | 6. Trademarks. 127 | 128 | This License does not grant permission to use the trade names, trademarks, 129 | service marks, or product names of the Licensor, except as required for 130 | reasonable and customary use in describing the origin of the Work and 131 | reproducing the content of the NOTICE file. 132 | 133 | 7. Disclaimer of Warranty. 134 | 135 | Unless required by applicable law or agreed to in writing, Licensor provides the 136 | Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, 137 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, 138 | including, without limitation, any warranties or conditions of TITLE, 139 | NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are 140 | solely responsible for determining the appropriateness of using or 141 | redistributing the Work and assume any risks associated with Your exercise of 142 | permissions under this License. 143 | 144 | 8. Limitation of Liability. 145 | 146 | In no event and under no legal theory, whether in tort (including negligence), 147 | contract, or otherwise, unless required by applicable law (such as deliberate 148 | and grossly negligent acts) or agreed to in writing, shall any Contributor be 149 | liable to You for damages, including any direct, indirect, special, incidental, 150 | or consequential damages of any character arising as a result of this License or 151 | out of the use or inability to use the Work (including but not limited to 152 | damages for loss of goodwill, work stoppage, computer failure or malfunction, or 153 | any and all other commercial damages or losses), even if such Contributor has 154 | been advised of the possibility of such damages. 155 | 156 | 9. Accepting Warranty or Additional Liability. 157 | 158 | While redistributing the Work or Derivative Works thereof, You may choose to 159 | offer, and charge a fee for, acceptance of support, warranty, indemnity, or 160 | other liability obligations and/or rights consistent with this License. However, 161 | in accepting such obligations, You may act only on Your own behalf and on Your 162 | sole responsibility, not on behalf of any other Contributor, and only if You 163 | agree to indemnify, defend, and hold each Contributor harmless for any liability 164 | incurred by, or claims asserted against, such Contributor by reason of your 165 | accepting any such warranty or additional liability. 166 | 167 | END OF TERMS AND CONDITIONS 168 | 169 | APPENDIX: How to apply the Apache License to your work 170 | 171 | To apply the Apache License to your work, attach the following boilerplate 172 | notice, with the fields enclosed by brackets "[]" replaced with your own 173 | identifying information. (Don't include the brackets!) The text should be 174 | enclosed in the appropriate comment syntax for the file format. We also 175 | recommend that a file or class name and description of purpose be included on 176 | the same "printed page" as the copyright notice for easier identification within 177 | third-party archives. 178 | 179 | Copyright [yyyy] [name of copyright owner] 180 | 181 | Licensed under the Apache License, Version 2.0 (the "License"); 182 | you may not use this file except in compliance with the License. 183 | You may obtain a copy of the License at 184 | 185 | http://www.apache.org/licenses/LICENSE-2.0 186 | 187 | Unless required by applicable law or agreed to in writing, software 188 | distributed under the License is distributed on an "AS IS" BASIS, 189 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 190 | See the License for the specific language governing permissions and 191 | limitations under the License. 192 | --------------------------------------------------------------------------------