====== Set up a virtual Android environment ====== ---- These instructions apply only to the Linux lab machines in HH 310. __For long Terminal commands, I recommend copying and pasting from this page into a Terminal. __ ===== Part 1. Install needed Android SDK components. ===== On your assigned lab machine, start a Terminal and change to the /usr/local/android/sdk directory: cd /usr/local/android/sdk Run the Android SDK Manager GUI: tools/android In the Android SDK Manager GUI, check the box for "Android 4.1.2 (API 16)" and click on the "Install packages..." packages. Accept the license agreements and proceed to install. ===== Part 2. Create Android Virtual Devices (AVD) and try running them. ===== After you've installed everything from Part 1, choose the "Tools" menu in the Android SDK Manager GUI and choose "Manage AVDs..." Create a new AVD with a name you can remember. It should also have the following characteristics: * a Device with a 4.0" display or lower for better performance * Target = Android 4.1.2 - API Level 16 * CPU/ABI = Intel Atom (x86) * Optionally choose "Use Host GPU" After you create an AVD, select it and press the "Start..." button. There may be a lengthy wait before a virtual Android device appears on your display. Create a second AVD like your first AVD, but one that uses CPU/ABI = ARM (armeabi-v7a). This ARM-based AVD will be used to boot the kernel from the [[cs-438_compile_and_run_the_android_goldfish_kernel|Compile and run the Android goldfish kernel]] tutorial. (My AVDs are named ''TestAVDintel'' and ''TestAVDarm'' to avoid any confusion.) Your Android AVDs are defined and set up in your UNIX home directories. To see them, run the following command in a Terminal: ls ~/.android/avd In the ~/.android/avd directory you should see a ''.ini'' file for every AVD you currently have defined. ===== Part 3. Set up environment variables for Android tools future ease-of-use ===== **NOTE: Do this part only once.** Add the Android program directories to the system $PATH environment variable for ease of access (you won't need to type ''/usr/local/android/sdk/tools/'' before every command). To update the $PATH environment variable, run the following commands in a Terminal: echo '' >> ~/.bashrc echo '# CS-438/505 Android PATH setup, FA13' >> ~/.bashrc echo 'export PATH=/usr/local/android/sdk/tools:$PATH' >> ~/.bashrc echo 'export PATH=/usr/local/android/sdk/platform-tools:$PATH' >> ~/.bashrc If you want to see the changes that have been made by the above 4 commands, run the following command: cat ~/.bashrc ===== Part 4. Start your AVD from the command line. ===== **NOTE: For the changes from Part 3 to take effect, you must start a new Terminal.** Try to start one of your AVDs from the Terminal. If your AVD's name is TestAVD, your command will look like this: emulator -avd TestAVDintel ----