Android Basic Course © 2012 University of Science – HCM City . Module 2: Getting Started with Android Development M.Sc. Bui Tan Loc btloc@fit.hcmus.edu.vn Department of Software Engineering, Faculty of Information Technology, University of Science – Ho Chi Minh City, Viet Nam Android Basic Course © 2012 University of Science – HCM City . Objectives • After completing this module, you will have learned: • About installing the Android development environment • About using SDK Manager and AVD Manager • About Android project structure • About launching an Android application with different emulators corresponding different platforms • About DDMS tools • About how to debug an application • About changing xml resource file by GUI or Text editor. 2 Android Basic Course © 2012 University of Science – HCM City . Contents • Getting to install the Android development environment • Getting to know Android SDK tools • Getting to know Android project structure • Getting to know how to run with the default emulator • Getting to know how to run with the specified emulator • Getting to know DDMS tools • Getting to know how to debug with the default emulator • Getting to know how to change xml resource files 3 Android Basic Course © 2012 University of Science – HCM City . Getting to install the Android development environment • Supported OS: • Windows, Mac OS X, Linux • Pre-requirement: • JDK 1. Installing Editor: • Eclipse (Eclipse classic version is recommended) 2.Installing SDK Starter Package (SDK Manager): • Note that you need to refer to the SDK directory (In Windows OS, this called “set path”) 3.Installing ADT plugin for Eclipse: • Configuring Eclipse to work with SDK Manager 4.Using SDK Manager to add platforms and other components: • SDKs, documents, sample source codes, etc. 4 Android Basic Course © 2012 University of Science – HCM City . Installing JDK • http://www.oracle.com/technetwork/java/javase/downloads/index.html • Ex: • The installation directory is “c:\Program Files\Java\” • The JDK folder’s path is “c:\Program Files\Java\jdk1.6.0_17” 5 Android Basic Course © 2012 University of Science – HCM City . Installing Eclipse Editor • http://www.eclipse.org/downloads/ • Ex: • The installation directory is “d:\Program Files\” • The Eclipse folder’s path is “d:\Program Files\eclipse\” • At the first time launching Eclipse, you must select a workspace folder to store your projects. • Ex: The workspace folder is “d:\Program Files\eclipse\workspace\” • You can change workspace folder at any time you want. • Ex: File > Switch workspace > Other… 6 Android Basic Course © 2012 University of Science – HCM City . Installing SDK starter package (SDK Manager) • http://developer.android.com/sdk/index.html • Ex: • The installation directory is “d:\Program Files\Android\” • The SDK folder’s path is “d:\Program Files\Android\android-sdk-windows\” 7 Android Basic Course © 2012 University of Science – HCM City . Installing 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 8 Android Basic Course © 2012 University of Science – HCM City . Updating the ADT Plugin • Want to update the ADT plugin, see more : • http://developer.android.com/sdk/eclipse-adt.html#installing 9 Android Basic Course © 2012 University of Science – HCM City . Installing ADT plugin for Eclipse 10 [...]... an Android application with different emulator corresponding different platforms • How to modify xml files in the Android project 32 © 2012 University of Science – HCM City Android Basic Course References & Further Readings • Installing the SDK: • http://developer .android. com/sdk/installing.html • http://mobiforge.com/developing/story /getting- started- with- android- development • http://developer .android. com/guide/developing/devices/managing-avds.html... http://developer .android. com/guide/developing/devices/managing-avds-cmdline.html • http://developer .android. com/guide/developing/devices/emulator.html • Getting Started with Android Development: • Managing AVDs with AVD Manager: • Managing AVDs from the Command Line: • Using the Android Emulator: 33 © 2012 University of Science – HCM City Android Basic Course References & Further Readings • Creating an Android. .. HCM City Android Basic Course Getting to know how to run with the specified emulator • Run application with the specified emulator • Right click project, then select Run As > Run Configurations… > select the specified emulator 20 © 2012 University of Science – HCM City Android Basic Course Getting to know how to run with the specified emulator 21 © 2012 University of Science – HCM City Android Basic... University of Science – HCM City Android Basic Course Configuring Eclipse to work with SDK Manager 12 © 2012 University of Science – HCM City Android Basic Course Getting to know Android SDK tools • SDK Manager is used for adding platforms and other components • • Start Eclipse, then Select Android SDK Manager Or launch SDK Manager.exe in Android SDK folder • AVD (Android Virtual Device) Manager is... Science – HCM City Android Basic Course Getting to know how to switch platform • Right click the project root, then select Properties > Android > select the platform you want 18 © 2012 University of Science – HCM City Android Basic Course Getting to know how to run with the default emulator • Run application with the default emulator • Right click project, then select Run As > Android Application... University of Science – HCM City Android Basic Course Getting to know how to debug with the default emulator • Debug application with the default emulator • • Right click project, then select Debug As > Android Application Select Yes to open Debug Perspective 25 © 2012 University of Science – HCM City Android Basic Course Insert breakpoint 26 © 2012 University of Science – HCM City Android Basic Course Debug... Science – HCM City Android Basic Course Ex: Using text editor to change main.xml 30 © 2012 University of Science – HCM City Android Basic Course Ex: Using GUI editor to change main.xml 31 © 2012 University of Science – HCM City Android Basic Course Questions or Discussions • How to install a new Android platform • How to create an Android emulator • How to run an Android application with different emulators... Manager Or launch AVD Manager.exe in Android SDK folder 13 © 2012 University of Science – HCM City Android Basic Course Using SDK Manager to add platforms and other components 14 © 2012 University of Science – HCM City Android Basic Course Using AVD Manager to create a new emulator 15 © 2012 University of Science – HCM City Android Basic Course Testing your development environment • If above things... Science – HCM City Android Basic Course Getting to know DDMS tools • The ADT plug-in in Eclipse provides some useful tools to control your Android Emulator In Eclipse, click on the Open Perspective button and select DDMS or select Other…/DDMS 22 © 2012 University of Science – HCM City Android Basic Course Overview DDMS Tools 23 © 2012 University of Science – HCM City Android Basic Course Overview DDMS.. .Android Basic Course Configuring Eclipse to work with SDK Manager • Start Eclipse, then Select Window > Preferences to open the Preferences panel (Mac OS X: Eclipse > Preferences) • Select Android from the left panel • You may see a dialog asking whether you want to send usage statistics to Google If so, make your choice and click Proceed You cannot continue with this procedure