Module 2: Getting Started with Android Development M.Sc.. Getting to install the Android development environment... Installing ADT plugin for Eclipse• http://developer.android.com/sdk/ec
Trang 1© 2012 University of Science – HCM City
.
Module 2: Getting Started with Android Development
M.Sc Bui Tan Locbtloc@fit.hcmus.edu.vn
Department of Software Engineering,Faculty of Information Technology,University of Science – Ho Chi Minh City, Viet Nam
Trang 2Objectives
Trang 3© 2012 University of Science – HCM City
.
Contents
3
Trang 4Getting to install the Android development environment
Trang 5© 2012 University of Science – HCM City
.
Installing JDK
• http://www.oracle.com/technetwork/java/javase/downloads/index.html
5
Trang 6Installing Eclipse Editor
• http://www.eclipse.org/downloads/
• The installation directory is “ d:\Program Files\ ”
• The Eclipse folder’s path is “ d:\Program Files\eclipse\ ”
• Ex: File > Switch workspace > Other…
Trang 7© 2012 University of Science – HCM City
.
Installing SDK starter package (SDK Manager)
• http://developer.android.com/sdk/index.html
7
Trang 8Installing ADT plugin for Eclipse
• http://developer.android.com/sdk/eclipse-adt.html#installing
• Start Eclipse, then select Help > Install New Software
• Click Add, in the top-right corner.
• In the Add Repository dialog that appears, enter "ADT Plugin" for the Name and the following URL for the Location:
• https://dl-ssl.google.com/android/eclipse/
• Click OK
• Note: If you have trouble acquiring the plugin, try using "http" in the Location URL, instead of "https" (https is preferred for security reasons).
• In the Available Software dialog, select the checkbox next to Developer Tools and click Next.
• In the next window, you'll see a list of the tools to be downloaded Click Next
• Read and accept the license agreements, then click Finish.
• Note: If you get a security warning saying that the authenticity or validity of the software can't be established, click OK.
• When the installation completes, restart Eclipse
Trang 9© 2012 University of Science – HCM City
.
Updating the ADT Plugin
• http:// developer.android.com/sdk/eclipse-adt.html#installing
9
Trang 10Installing ADT plugin for Eclipse
Trang 11© 2012 University of Science – HCM City
.
Configuring Eclipse to work with SDK Manager
• Start Eclipse, then Select Window > Preferences to open the Preferences panel (Mac OS X:
Eclipse > Preferences).
choice and click Proceed You cannot continue with this procedure until you click Proceed.
directory
11
Trang 12Configuring Eclipse to work with SDK Manager
Trang 13© 2012 University of Science – HCM City
.
Getting to know Android SDK tools
• SDK Manager is used for adding platforms and other components
• AVD (Android Virtual Device) Manager is used for creating emulators corresponding to the selected platforms
13
Trang 14Using SDK Manager to add platforms and other components
Trang 15© 2012 University of Science – HCM City
.
Using AVD Manager to create a new emulator
15
Trang 16Testing your development environment
• If above things are be ready-to-work You will run the
HelloWorld Application successfully.
• http://
developer.android.com/resources/tutorials/hello-world.ht
ml
Trang 17© 2012 University of Science – HCM City
.
Getting to know project structure
contains java source files
is generated when res folder is modified
is selected platform to build the application
is application package that will be installed on emulators or real devices
are image resources
describes UI components describes string constant values
is an application configuration file
17
Trang 18Getting to know how to switch platform
Trang 19© 2012 University of Science – HCM City
.
Getting to know how to run with the default emulator
• Right click project, then select Run As > Android Application
19
Trang 20Getting to know how to run with the specified emulator
• Right click project, then select Run As > Run Configurations… >
select the specified emulator
Trang 21© 2012 University of Science – HCM City
.
Getting to know how to run with the specified emulator
21
Trang 22Getting to know DDMS tools
Trang 23© 2012 University of Science – HCM City
.
Overview DDMS Tools
23
Trang 24Overview DDMS Tools
Trang 25© 2012 University of Science – HCM City
.
Getting to know how to debug with the default emulator
25
• Right click project, then select Debug As > Android Application
Trang 26Insert breakpoint
Trang 27© 2012 University of Science – HCM City
Trang 29© 2012 University of Science – HCM City
.
Getting to know how to change xml resource file: main.xml , string.xml , and
AndroidManifest.xml
29
Trang 30Ex: Using text editor to change main.xml
Trang 31© 2012 University of Science – HCM City
.
Ex: Using GUI editor to change main.xml
31
Trang 32Questions or Discussions
Trang 33© 2012 University of Science – HCM City
Trang 34References & Further Readings