Android Software Development – The First Few Hours<br />Coast Nerds – 15 March 2011<br />Image: www.android.com<br />
What am I going to talk about?<br /><ul><li>What is Android all about?
Why did I choose this platform?
What do you need to get started developing Android Applications?
How to create your first App?
Where to Next?
Things to Avoid</li></li></ul><li>What is Android all about? <br />Image: www.metalmickey.com<br />
<ul><li>Android is an Open Source “Software Stack” targeted at mobile devices.
Built on modified version of the Linux Kernel
Android Inc. founded in 2003. Purchased by Google in 2005 as wholly owned subsidiary
The Open Handset Alliance (est. 2007) collaborated on development, release and on-going maintenance/development.
Ref http://en.wikipedia.org/wiki/Android_(operating_system)</li></li></ul><li><ul><li>Android SDK first released to develo...
First Android Mobile Phone: T-Mobile G1 (or HTC Dream) Released October 2008
Android consists of Java Applications running on Java core libraries running on a Dalvic Virtual Machine. Some core librar...
Consists of 12 million lines of code including 3 million lines of XML, 2.8 million lines of C, 2.1 million lines of Java, ...
Grew to 33% by Q4 2010
In February 2011 Android has reached 350,000 activations per day</li></li></ul><li>Image:<br />http://t3.gstatic.com/image...
Why did I choose this Platform?<br />Image: www.popsiculturereviews.blogspot.com<br />
<ul><li>The Alternatives
Apple iPhone
Windows Phone
Symbian
Research In Motion (RIM/Blackberry)
HP WebOS (Palm)
Android</li></ul>Canalysis – Worldwide Q4 2010<br />
<ul><li>Apple iPhone</li></ul>Image: http://www.esarcasm.com<br />
<ul><li>Windows Phone 7</li></ul>Image: windowsphonejunky.com<br />
<ul><li>Symbian</li></ul>Image: www.toptechviews.com<br />
<ul><li>Android</li></li></ul><li>What do you need to get started developing Android Applications?<br />Image: www.conspir...
Install Java Development Kit (JDK) http://www.oracle.com/technetwork/java/javase/downloads/index.html<br />Install Eclipse...
Install and configure the Android Plug-in for Eclipse (ADT)<br />Start Eclipse, then select Help > Install New Software......
Test Installation<br />In Eclipse choose File -> New Project from the menu.<br />You should see an option to create an And...
The SDK / AVD Manager<br />The Android SDK is componentised allowing you to customise your development environment for you...
SDK Manager showing Available packages to download<br />
SDK Manager showing installed packages<br />
Android SDK Supported Operating Systems<br />Windows XP (32-bit), Vista (32- or 64-bit), or Windows 7 (32- or 64-bit)<br /...
How to create your first App.  Hello World!<br />Image:  www.jeffbots.com<br />
<ul><li>Create the App</li></ul>From the File Menu in Eclipse choose Create New Project<br />The New Project Dialog will o...
Enter Project Name<br />Choose a Target Platform (if the list of platforms are blank you will need to use the SDK Manager ...
The next screen asks about creating a test project for your application.  At this stage ignore this option and click next ...
<ul><li>Explore the Application Manifest</li></ul>From the Package Explorer, expand out the project folder for you app.  A...
<ul><li>View the Layout Resource</li></ul>From the Package Explorer, expand out the project folder for you app.  Then expa...
<ul><li>Resources</li></ul>If you view the properties for the “Hello World” text box shown on the layout you will notice t...
<ul><li>Debug & Run Your App
Before you can run your app for the first time you need to create a debug configuration and also an Android Virtual Device...
<ul><li>Create a Debug Configuration</li></ul>From the Run menu choose Debug Configurations…<br />Choose “Android Applicat...
<ul><li>Create a Debug Configuration cont…</li></ul>Click on the Target tab<br />Choose Automatic <br />Choose an AVD (you...
Upcoming SlideShare
Loading in …5
×

Android software development – the first few hours

2,014 views

Published on

My challenge for this year is to learn a new programming language or software development technology. While I don’t intend adopting the suggestion of The Pragmatic Programmer and learning one new language each year, I do think that there is much to be gained by seeing what else is out there. With the booming popularity of the Android platform for mobile devices I thought what better place to start? Over the past few weeks I have taken the first few steps in learning about Android application development.

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
2,014
On SlideShare
0
From Embeds
0
Number of Embeds
3
Actions
Shares
0
Downloads
42
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide
  • Software/Solution Stack – OS, Middleware + Key ApplicationsOpen Handset Alliance consists of 80 firms including Google, HTC, Dell, Intel, Motorola, Qualcomm, Texas Instruments, Samsung, LG, T-Mobile, Nvidia, and Wind River Systems.[
  • - Dalvic Virtual Machine also Open Source. Uses different bytecode to standard Java VM. Based on the Apache implementation of Java. - In 2010 Oracle sued Google of infringing it’s Intellectual Property on several patents.- C libraries include Surface manager, SQLite and OpenGL graphics engines
  • - Dalvic Virtual Machine also Open Source. Uses different bytecode to standard Java VM. Based on the Apache implementation of Java. - In 2010 Oracle sued Google of infringing it’s Intellectual Property on several patents.- C libraries include Surface manager, SQLite and OpenGL graphics engines
  • Another survey by Gartner puts Symbian ahead but forecasts Android to lead by 2014.
  • http://www.computerworld.com/s/article/9178684/Developing_for_the_iPhone_and_Android_The_pros_and_cons?taxonomyId=18&amp;pageNumber=2http://developer.apple.com/programs/ios/
  • Feb 2011 Nokia and Microsoft announced strategic partnership which sees Windows Phone 7 as Nokia’s primary OS.http://social.msdn.microsoft.com/Forums/en/mktplace/thread/4b727251-7089-4261-8928-1a218f96a300http://blogs.computerworld.com/16622/windows_phone_7s_achilles_heel_no_enterprise_app_deployment_toolhttp://www.zdnet.co.uk/news/mobile-apps/2010/10/21/microsoft-hints-at-windows-phone-7-enterprise-future-40090605/
  • http://pocketnow.com/windows-phone/nokia-undertaking-two-year-plan-for-wp7-transition-symbian-gone-by-2013
  • http://pocketnow.com/windows-phone/nokia-undertaking-two-year-plan-for-wp7-transition-symbian-gone-by-2013
  • Eclipse for Java EE Developers contains additional plug-ins including the Java Development Tools (JDT) for eclipse as well as the Web Tools Platform (WTP)
  • Eclipse for Java EE Developers contains additional plug-ins including the Java Development Tools (JDT) for eclipse as well as the Web Tools Platform (WTP)
  • Eclipse for Java EE Developers contains additional plug-ins including the Java Development Tools (JDT) for eclipse as well as the Web Tools Platform (WTP)
  • Eclipse for Java EE Developers contains additional plug-ins including the Java Development Tools (JDT) for eclipse as well as the Web Tools Platform (WTP)
  • Android software development – the first few hours

    1. 1. Android Software Development – The First Few Hours<br />Coast Nerds – 15 March 2011<br />Image: www.android.com<br />
    2. 2. What am I going to talk about?<br /><ul><li>What is Android all about?
    3. 3. Why did I choose this platform?
    4. 4. What do you need to get started developing Android Applications?
    5. 5. How to create your first App?
    6. 6. Where to Next?
    7. 7. Things to Avoid</li></li></ul><li>What is Android all about? <br />Image: www.metalmickey.com<br />
    8. 8. <ul><li>Android is an Open Source “Software Stack” targeted at mobile devices.
    9. 9. Built on modified version of the Linux Kernel
    10. 10. Android Inc. founded in 2003. Purchased by Google in 2005 as wholly owned subsidiary
    11. 11. The Open Handset Alliance (est. 2007) collaborated on development, release and on-going maintenance/development.
    12. 12. Ref http://en.wikipedia.org/wiki/Android_(operating_system)</li></li></ul><li><ul><li>Android SDK first released to developers in November 2007
    13. 13. First Android Mobile Phone: T-Mobile G1 (or HTC Dream) Released October 2008
    14. 14. Android consists of Java Applications running on Java core libraries running on a Dalvic Virtual Machine. Some core libraries also written in C/++
    15. 15. Consists of 12 million lines of code including 3 million lines of XML, 2.8 million lines of C, 2.1 million lines of Java, and 1.75 million lines of C++.</li></li></ul><li><ul><li>Q2 2009 Android had 2.8% share of Worldwide handset shipments
    16. 16. Grew to 33% by Q4 2010
    17. 17. In February 2011 Android has reached 350,000 activations per day</li></li></ul><li>Image:<br />http://t3.gstatic.com/images?q=tbn:ANd9GcSGt5iAisqb6Do_Fj6PgF6xtvWjghsrEVmdwi-mRXmMDv8pCCCU<br />Image: http://t1.gstatic.com/images?q=tbn:ANd9GcQyIOqpf4sm4__JsRfCE8bIoIh4ayh16VJkxHZ66tyFOF1cba_ZiA<br />
    18. 18. Why did I choose this Platform?<br />Image: www.popsiculturereviews.blogspot.com<br />
    19. 19. <ul><li>The Alternatives
    20. 20. Apple iPhone
    21. 21. Windows Phone
    22. 22. Symbian
    23. 23. Research In Motion (RIM/Blackberry)
    24. 24. HP WebOS (Palm)
    25. 25. Android</li></ul>Canalysis – Worldwide Q4 2010<br />
    26. 26. <ul><li>Apple iPhone</li></ul>Image: http://www.esarcasm.com<br />
    27. 27. <ul><li>Windows Phone 7</li></ul>Image: windowsphonejunky.com<br />
    28. 28. <ul><li>Symbian</li></ul>Image: www.toptechviews.com<br />
    29. 29. <ul><li>Android</li></li></ul><li>What do you need to get started developing Android Applications?<br />Image: www.conspiracygrimoire.com<br />
    30. 30. Install Java Development Kit (JDK) http://www.oracle.com/technetwork/java/javase/downloads/index.html<br />Install Eclipse for Java EE Developers* http://www.eclipse.org/downloads/<br />Install the Android SDK http://developer.android.com/sdk/index.html<br /><ul><li>WINDOWS: Upgrade the Path Environment Variable to include the Android Tools directory.</li></ul>* Eclipse is the most common IDE for Android Development but there are others. See developer.android.com/guide/developing/other-ide.html<br />
    31. 31. Install and configure the Android Plug-in for Eclipse (ADT)<br />Start Eclipse, then select Help > Install New Software....<br />Click Add, in the top-right corner.<br />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/Note: If you have trouble acquiring the plugin, try using "http" in the Location URL, instead of "https" (https is preferred for security reasons).<br />Click OK.<br />In the Available Software dialog, select the checkbox next to Developer Tools and click Next.<br />In the next window, you'll see a list of the tools to be downloaded. Click Next. NOTE: Selecting all tools will take some time to download.<br />Read and accept the license agreements, then click Finish.<br />When the installation completes, restart Eclipse.<br />More Details Here http://developer.android.com/sdk/eclipse-adt.html<br />
    32. 32. Test Installation<br />In Eclipse choose File -> New Project from the menu.<br />You should see an option to create an Android Project and an Android Test Project<br />
    33. 33. The SDK / AVD Manager<br />The Android SDK is componentised allowing you to customise your development environment for your target platform<br />The SDK Manager allows you to manage components for your specific requirements. It is located in the sdk folder (installed at step 3) android-sdk-windowsSDK Manager.exe<br />You can also access the SDK Manager from within Eclipse by clicking on the toolbar icon as shown below<br />AVD = Android Virtual Device<br />
    34. 34. SDK Manager showing Available packages to download<br />
    35. 35. SDK Manager showing installed packages<br />
    36. 36. Android SDK Supported Operating Systems<br />Windows XP (32-bit), Vista (32- or 64-bit), or Windows 7 (32- or 64-bit)<br />Mac OS X 10.5.8 or later (x86 only)<br />Linux (tested on Ubuntu Linux, Lucid Lynx)<br />GNU C Library (glibc) 2.7 or later is required.<br />On Ubuntu Linux, version 8.04 or later is required.<br />64-bit distributions must be capable of running 32-bit applications. For information about how to add support for 32-bit applications, see the Ubuntu Linux installation notes.<br />
    37. 37. How to create your first App. Hello World!<br />Image: www.jeffbots.com<br />
    38. 38. <ul><li>Create the App</li></ul>From the File Menu in Eclipse choose Create New Project<br />The New Project Dialog will open. Choose Android Project and click Next<br />
    39. 39. Enter Project Name<br />Choose a Target Platform (if the list of platforms are blank you will need to use the SDK Manager to install some for your PC).<br />Enter Properties<br />Application Name<br />Package Name<br />Ensure “Create Activity” is checked and enter the default Activity Name.<br />Enter the Min SDK Version<br />Click Next<br />
    40. 40. The next screen asks about creating a test project for your application. At this stage ignore this option and click next (… sorry to the TDD faithful!)<br />Click Finish<br />At this point your Hello World Application is done. By default a simple “Hello World” app is created. <br />
    41. 41. <ul><li>Explore the Application Manifest</li></ul>From the Package Explorer, expand out the project folder for you app. Application Manifest is at the root level. Double click on it to open the dialog.<br />The Application Manifest is the main configuration point for you app. Here you can control versioning, register activities and security (among other things).<br />
    42. 42. <ul><li>View the Layout Resource</li></ul>From the Package Explorer, expand out the project folder for you app. Then expand out res=>layout, then double click on main.xml.<br />Layout resources define the layout of the various screens in your app. A default main.xml layout is created but you can create others.<br />You can edit the layout using the designer or switch to xml view.<br />
    43. 43. <ul><li>Resources</li></ul>If you view the properties for the “Hello World” text box shown on the layout you will notice that the text is not hardcoded and in fact points to a string resource.<br />You can view and edit the string resource to change the value of the text displayed.<br />In the Package Explorer navigate to res=>values=>strings.xml<br />You can view the string resources in a dialog view or in xml. You will also notice that a resource has been created for the app name<br />
    44. 44. <ul><li>Debug & Run Your App
    45. 45. Before you can run your app for the first time you need to create a debug configuration and also an Android Virtual Device (AVD). An AVD is just a virtual target platform that can be used in the emulator. AVDs can be shared between apps so this may be a one-off process until you start needing more varied AVDs to work with. </li></li></ul><li><ul><li>Create an AVD</li></ul>Launch the SDK/AVD Manager (discussed in an earlier slide).<br />Click on the New button<br />Fill out the details as shown (creating an Android 2.1 target)<br />Click “Create AVD”<br />It will take a couple of minutes to create the AVD. Your AVD should be shown in the list on completion.<br />
    46. 46. <ul><li>Create a Debug Configuration</li></ul>From the Run menu choose Debug Configurations…<br />Choose “Android Application” from the list and then click on the New button at the top of the screen.<br />Give your Debug Configuration a name and click Browse to select your app’s project<br />
    47. 47. <ul><li>Create a Debug Configuration cont…</li></ul>Click on the Target tab<br />Choose Automatic <br />Choose an AVD (you should see the AVD you created earlier in the list)<br />Click Apply<br />
    48. 48. <ul><li>Launch/Debug your app with the emulator</li></ul>With the debug configuration screen still open click on “Debug”. Note you can also launch the debugger from the debug button on the toolbar (be sure to select the correct configuration from the drop-down list)<br />This will launch the emulator and run your app. Note this will take a few minutes the first time you run it in a particular session of Eclipse.<br />
    49. 49.
    50. 50. <ul><li>Playing with the Emulator</li></ul>Use the Emulator Control Window to simulate phone calls or text messages.<br />If you cannot see the Emulator Control Window, choose Window from the menu then Show View=>Other=>Android=>Emulator Control<br />NB. Mobile phone numbers should not contain spaces.<br />
    51. 51. <ul><li>Launch/Debug your app with your Android phone or mobile device</li></ul>You need to ensure your Android Device is set to Debug mode. You may need to refer to your user manual for more details on how to do this. In my example I followed these steps:<br />Close Eclipse if it is open<br />Connect the phone to your PC via the USB Cable<br />Open Settings (on the phone)<br />Choose Applications<br />Choose Development<br />Enable USB Debugging<br />Enable Stay Awake<br />NB. The first time you do this you may have to install additional driver software to you PC.<br />
    52. 52. <ul><li>Launch/Debug your app with your Android phone or mobile device</li></ul>You need to ensure your Android Device is set to Debug mode. You may need to refer to your user manual for more details on how to do this. For my phone I followed these steps:<br />Close Eclipse if it is open<br />Connect the phone to your PC via the USB Cable<br />Open Settings (on the phone)<br />Choose Applications<br />Choose Development<br />Enable USB Debugging<br />Enable Stay Awake<br />NB. The first time you do this you may have to install additional driver software to you PC.<br />You may also need to add the Google USB Driver package via the SDK Manager (on your PC) if it has not already been installed<br />
    53. 53. <ul><li>Launch/Debug your app with your Android phone or mobile device cont…</li></ul>Open your app project in Eclipse<br />Go to the Debug Configuration (created in an earlier slide)<br />Click on the Target Tab<br />Choose Manual<br />Click on the Debug button<br />You will be prompted to choose an Android device. <br />Hopefully you will see your phone listed (or something that resembles it) in the “Choose a running Android device” section (if you don’t you may need to check connections or driver installations)<br />Select your phone from the list<br />Click OK<br />After a short while your app should appear loaded on your phone. You should also see an icon for your app amongst all your other installed apps.<br />
    54. 54. <ul><li>Launch/Debug your app with your Android phone or mobile device cont…</li></ul>Choosing your phone from the Debug Configuration<br />
    55. 55. <ul><li>Launch/Debug your app with your Android phone or mobile device cont…
    56. 56. Note that you do not need to stop the debugger or close the application in any way from Eclipse.
    57. 57. When finished debugging simply go back to your phone and disable the debugging features (enabled in the previous slide) then continue to disconnect your phone in the normal manor.
    58. 58. You may find that your app is still installed on your phone. Uninstall it if required.</li></li></ul><li>Things to avoid<br />Image: http://www.lz95.net/lzhs/english/isilverman/policies.htm<br />
    59. 59. <ul><li>The standard Eclipse for Java Developer installation does not include all the necessary components for Android Development. For new installations it is better to download and install the Eclipse for Java EE Developers.
    60. 60. While the standard install will still work you will need to download more add-ins to start developing. </li></li></ul><li><ul><li>When debugging be sure to use the correct debug configuration. Failing to do so can sometimes add an extra resource file to your project and cause a build error. (I have yet to investigate the cause of this issue. There may be a valid reason.)</li></li></ul><li>Where to next?<br />Image: www.heightofhappiness.wordpress.com<br />
    61. 61. <ul><li>In a future presentation I will discuss:
    62. 62. Debugging using the Dalvik Debug Monitor Service (DDMS). This is a more advanced debugging tool that give you more visibility and control over the debugging process.
    63. 63. Application Design – Context, Activities and Intents. These are the main building blocks to an Android app. This is where the actual coding begins!
    64. 64. More on Resources and State management. Using images and how to store app/user settings.
    65. 65. Anything else I can fit in.</li></li></ul><li>Questions?<br />Image: www.alaskacommons.wordpress.com<br />
    66. 66. That’s All.<br />Image: www.blogs.eveningsun.com<br />

    ×