coursework2_1_running_an_emulator

Report
Coursework 2: getting started (1)
– running the phone emulator
Chris Greenhalgh
G54UBI / 2011-02-21
Chris Greenhalgh ([email protected])
1
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
Chris Greenhalgh ([email protected])
2
Option 1: using the Android SDK (for use
with HTML/JS, PhoneGap or native apps)
Chris Greenhalgh ([email protected])
3
Installing the Android SDK
Note: this step should NOT be required in the labs: should already be installed in
C:\Program Files\Android\android-sdk-windows\
• Follow the steps in
http://developer.android.com/sdk/installing.html
– 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)
Chris Greenhalgh ([email protected])
4
Setting up the Android SDK (1)
Note: this step should NOT be required in the labs: should already be installed in
C:\Program Files\Android\android-sdk-windows\
• (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 “128.243.253.109” and port
“8080”
Chris Greenhalgh ([email protected])
5
Setting up the Android SDK (2)
Note: this step should NOT be required in the labs: should already be installed in
C:\Program Files\Android\android-sdk-windows\
• 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:
Chris Greenhalgh ([email protected])
6
Creating an emulator,
a.k.a. Android Virtual Device
Note: this step should only need to be done ONCE
• 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 emulatorChris Greenhalgh ([email protected])
7
Starting an emulator
Note: this step needs to be done each time you want to start 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
Chris Greenhalgh ([email protected])
8
A running emulator
(exact appearance depends on version and AVD options)
Chris Greenhalgh ([email protected])
9
Option 2: using the AppInventor tools
(for use with Google AppInventor)
Chris Greenhalgh ([email protected])
10
Installing the AppInventor tools
Note: this should already be installed in the labs in C:\G54UBI\
• Follow the set-up instructions for your
operating system:
– http://appinventor.googlelabs.com/learn/setup/index.
html#setupComputer
– Make a note of the installation directory, typically
…\AppInventor\commands-forAppinventor
• If a web proxy is required then you need to
configure it now, e.g. by setting the
http_proxy environment variable
Chris Greenhalgh ([email protected])
11
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
“http://128.243.253.109:8080”
• 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
Chris Greenhalgh ([email protected])
12
Running the emulator using the
AppInventor tools
Note: this should be installed in the labs in C:\G54UBI\
• In the AppInventor installation directory
(…\AppInventor\commands-forAppinventor) run the emulator command
– Windows: double click run-emulator.bat
• After a few seconds the phone emulator should appear
and start up
Chris Greenhalgh ([email protected])
13
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
Chris Greenhalgh ([email protected])
14

similar documents