Coursework 2: getting started (1) – running the phone emulator Chris Greenhalgh G54UBI / Chris Greenhalgh
Contents Option 1: using the Android SDK – Installing the Android SDK – Configuring the Android SDK Manager – Creating an emulator – Starting an Emulator Option 2: – Running an Android emulator using the AppInventor local installation 2Chris Greenhalgh
Option 1: using the Android SDK (for use with HTML/JS, PhoneGap or native apps) 3Chris Greenhalgh
Installing the Android SDK Follow the steps in – Step 1: Ensure you have a JDK (version 1.6) (Eclipse is NOT required at this stage) – Step 2: download the SDK.zip file and extract its contents (e.g. android-sdk-windows/) to your chosen working directory – (Step 3: ADT is NOT required at this stage) 4 Note: this step should NOT be required in the labs: should already be installed in C:\Program Files\Android\android-sdk-windows\ Chris Greenhalgh
Setting up the Android SDK (1) (Without Eclipse) run “SDK Manager.exe” from the unpacked directory – (with eclipse, choose Window > Android SDK and AVD Manager) – You can “cancel” the initial dialog which suggests installing all of the available packages – Under “Settings” set the HTTP proxy if required E.g. in the University host “ ” and port “8080” 5 Note: this step should NOT be required in the labs: should already be installed in C:\Program Files\Android\android-sdk-windows\ Chris Greenhalgh
Setting up the Android SDK (2) From “Available Packages” select and install at least: – Android SDK Platform-tools and – SDK Platform Android 2.2, API 8 Under Android Repository – Google APIs by Google, Inc., Android API 8 Under Third party add-ons, Google Inc. add-ons [for google maps] – (If you have an older Android device then install a version of Android and Google APIs that is compatible with it) – Note: you will need to click “Accept” for the Google APIs licence: 6 Note: this step should NOT be required in the labs: should already be installed in C:\Program Files\Android\android-sdk-windows\ Chris Greenhalgh
Creating an emulator, a.k.a. Android Virtual Device Under Virtual Devices click “New…” and choose – name (any), – target (Google APIs…) – SD Card size, e.g. 64 MB – Resolution (WVGA800) – and Create AVD… Note that the (large) emulator file(s) are usually stored in a hidden directory.android, in your home directory (H:\), which can be deleted if you no longer need the emulator 7 Note: this step should only need to be done ONCE Chris Greenhalgh
Starting an emulator Start the SDK Manager if required (see earlier slide) Under “Virtual Devices” select the emulator (“AVD”) you want and click “Start…” – You can modify the launch options if required, e.g. size on the monitor, then press “Launch” – It typically takes a minute or two for the emulator to start up Note: this step needs to be done each time you want to start an emulator 8Chris Greenhalgh
A running emulator (exact appearance depends on version and AVD options) 9Chris Greenhalgh
Option 2: using the AppInventor tools (for use with Google AppInventor) 10Chris Greenhalgh
Installing the AppInventor tools Follow the set-up instructions for your operating system: – html#setupComputer html#setupComputer – Make a note of the installation directory, typically …\AppInventor\commands-for- Appinventor If a web proxy is required then you need to configure it now, e.g. by setting the http_proxy environment variable 11 Note: this should already be installed in the labs in C:\G54UBI\ Chris Greenhalgh
Configuring the emulator web proxy From inside the University network (except UoN-guest) if the proxy is not set then you will be able to access University web sites but not external web sites (e.g. google). – At present a suitable proxy from within the University network is “ If you start an emulator from the SDK Manager then it should use the proxy set there (slide 4) Otherwise the emulator will use the environment variable “http_proxy” to determine what (if any) proxy to use – This can be set/checked in (Windows 7) Control Panels Search “Environment” Edit environment variables for your account (Windows XP) Control Panels System Advanced Environment Variables – You need to restart the emulator to pick up any change 12Chris Greenhalgh
Running the emulator using the AppInventor tools In the AppInventor installation directory ( … \AppInventor\commands-for- Appinventor ) run the emulator command – Windows: double click run-emulator.bat After a few seconds the phone emulator should appear and start up 13 Note: this should be installed in the labs in C:\G54UBI\ Chris Greenhalgh
Conclusions You should now be able to: – Install and setup the Android SDK if required – Run an Android emulator – And optionally install the AppInventor tools and run an Android emulator using those 14Chris Greenhalgh