SELP: Debugging, AVDs and Manifests

413 views
351 views

Published on

Software Engineering Large Practical:
Debugging Android Applications, working with Android Virtual Devices, and Manifests

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

  • Be the first to like this

No Downloads
Views
Total views
413
On SlideShare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
6
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

SELP: Debugging, AVDs and Manifests

  1. 1. Software Engineering Large Practical Debugging Android Applications,working with Android Virtual Devices, and Manifests Stephen Gilmore School of Informatics, University of Edinburgh October 10th, 2012 Stephen Gilmore Software Engineering Large Practical
  2. 2. Eclipse DDMS perspectiveThe Dalvik Debug Monitor Server (DDMS) is a debugging tool forAndroid. It provides port-forwarding services and screen capture onthe device. It provides information about process, threads andheap usage. It contains the logcat console which allows us to seediagnostic error messages. It allows the developer to simulate theeffect of an incoming call or SMS, or to simulate setting thephone’s location. Stephen Gilmore Software Engineering Large Practical
  3. 3. DDMS perspective in Eclipse.05.14.png Stephen Gilmore Software Engineering Large Practical
  4. 4. Set your location Stephen Gilmore Software Engineering Large Practical
  5. 5. LogCat — a log of events on the phone Stephen Gilmore Software Engineering Large Practical
  6. 6. File Explorer — see files on the phone.07.32.png Stephen Gilmore Software Engineering Large Practical
  7. 7. Devices — see processes in the emulator.10.14.png Stephen Gilmore Software Engineering Large Practical
  8. 8. Allocation tracker.10.28.png Stephen Gilmore Software Engineering Large Practical
  9. 9. Creating an Android Virtual DeviceAn Android Virtual Device (AVD) is an emulator configurationwhich allows the developer to replicate the effect of having anactual Android device such as a phone or a tablet. The AVD allowsyou to specify hardware and software settings which will beemulated by the Android Emulator. When creating a new AVD youspecify the target API (i.e. a particular version of Android). Stephen Gilmore Software Engineering Large Practical
  10. 10. Creating an emulator Stephen Gilmore Software Engineering Large Practical
  11. 11. Android Virtual Device (AVD) manager Stephen Gilmore Software Engineering Large Practical
  12. 12. Create a new AVD (Click New...) Stephen Gilmore Software Engineering Large Practical
  13. 13. Create new Android Virtual Device.21.54.png Stephen Gilmore Software Engineering Large Practical
  14. 14. Starting the emulatorHaving defined the type of AVD that we are interested in, we canstart one running and investigate the functions of our virtualdevice. Stephen Gilmore Software Engineering Large Practical
  15. 15. Start the new AVD.22.07.png Stephen Gilmore Software Engineering Large Practical
  16. 16. Launch Options.22.18.png Stephen Gilmore Software Engineering Large Practical
  17. 17. Emulator launches ....23.31.png Stephen Gilmore Software Engineering Large Practical
  18. 18. Emulator home page is displayed.03.13.png Stephen Gilmore Software Engineering Large Practical
  19. 19. Click to display options.03.14.png Stephen Gilmore Software Engineering Large Practical
  20. 20. Functions of the phone.03.57.png Stephen Gilmore Software Engineering Large Practical
  21. 21. Developer toolsThere are some tools on the device which are specifically there tohelp developers (API Demos and Dev Tools). The developer toolsallow us to see (for example) processes which are running on thephone. Stephen Gilmore Software Engineering Large Practical
  22. 22. Useful functions.11.56.png Stephen Gilmore Software Engineering Large Practical
  23. 23. Developer Tools.04.23.png Stephen Gilmore Software Engineering Large Practical
  24. 24. Running processes.05.16.png Stephen Gilmore Software Engineering Large Practical
  25. 25. API demosThere are some tools on the device which are specifically there tohelp developers (API Demos and Dev Tools). Using these we canlearn about the Android API features such as auto-completion. Stephen Gilmore Software Engineering Large Practical
  26. 26. Useful functions.11.56.png Stephen Gilmore Software Engineering Large Practical
  27. 27. API demos.05.43.png Stephen Gilmore Software Engineering Large Practical
  28. 28. API demos.06.09.png Stephen Gilmore Software Engineering Large Practical
  29. 29. API demos.06.17.png Stephen Gilmore Software Engineering Large Practical
  30. 30. Auto-complete contacts.09.29.png Stephen Gilmore Software Engineering Large Practical
  31. 31. Manifest filesEvery Android application must have an AndroidManifest.xmlfile (with precisely that name) in its root directory. The manifestpresents essential information about the application to the Androidsystem, including information about intents which are messagessent to activities, services and broadcast receivers. The manifestalso specifies permissions which the application requests (such asthe permission to connect to paired Bluetooth devices) andlibraries that it needs. Stephen Gilmore Software Engineering Large Practical
  32. 32. Manifest files Stephen Gilmore Software Engineering Large Practical
  33. 33. The manifest editor Stephen Gilmore Software Engineering Large Practical
  34. 34. Adding extras.50.09.png Stephen Gilmore Software Engineering Large Practical
  35. 35. Labels and icons Stephen Gilmore Software Engineering Large Practical
  36. 36. Application nodes and intents.50.50.png Stephen Gilmore Software Engineering Large Practical
  37. 37. Attributes for an action Stephen Gilmore Software Engineering Large Practical
  38. 38. Add permissions Stephen Gilmore Software Engineering Large Practical
  39. 39. Add instrumentation Stephen Gilmore Software Engineering Large Practical
  40. 40. Source code view Stephen Gilmore Software Engineering Large Practical
  41. 41. Source code tab.51.48.2.png Stephen Gilmore Software Engineering Large Practical
  42. 42. Resources and stringsAn Android application may need resources such as image files andstrings. A string resource provides text strings for the applicationwith optional text styling and formatting. Stephen Gilmore Software Engineering Large Practical
  43. 43. Resources and strings Stephen Gilmore Software Engineering Large Practical
  44. 44. A String resource, app name Stephen Gilmore Software Engineering Large Practical
  45. 45. Managing string resources Stephen Gilmore Software Engineering Large Practical
  46. 46. Drawable resources Stephen Gilmore Software Engineering Large Practical
  47. 47. Managing drawable resources Stephen Gilmore Software Engineering Large Practical
  48. 48. Contents of app notes.png Stephen Gilmore Software Engineering Large Practical
  49. 49. The icon in the launcher view Stephen Gilmore Software Engineering Large Practical
  50. 50. Editing string resourcesString resources can be edited using the Android Resources editor. Stephen Gilmore Software Engineering Large Practical
  51. 51. Application nodes Stephen Gilmore Software Engineering Large Practical
  52. 52. Browsing Stephen Gilmore Software Engineering Large Practical
  53. 53. Editing strings Stephen Gilmore Software Engineering Large Practical
  54. 54. Updating a string Stephen Gilmore Software Engineering Large Practical
  55. 55. Text in the XML view Stephen Gilmore Software Engineering Large Practical
  56. 56. Updating a string in the Resources view Stephen Gilmore Software Engineering Large Practical
  57. 57. The XML text is updated automatically Stephen Gilmore Software Engineering Large Practical
  58. 58. Getting it wrong: editing the XML Stephen Gilmore Software Engineering Large Practical
  59. 59. The bug shows up in the resources view Stephen Gilmore Software Engineering Large Practical
  60. 60. Oh dear Stephen Gilmore Software Engineering Large Practical
  61. 61. Android Eclipse issuesWorking with hand-crafted and automatically-generated Java filescan be confusing. In particular we focus on errors involving theautomatically-generated R.java file. Stephen Gilmore Software Engineering Large Practical
  62. 62. Oh no, Java problems . . . Stephen Gilmore Software Engineering Large Practical
  63. 63. “Layout cannot be resolved . . . ” Stephen Gilmore Software Engineering Large Practical
  64. 64. R.java is generated so clean the project? Stephen Gilmore Software Engineering Large Practical
  65. 65. No good. Delete R.java and try again? Stephen Gilmore Software Engineering Large Practical
  66. 66. R.java is regenerated but errors remain Stephen Gilmore Software Engineering Large Practical
  67. 67. Refresh the view? Stephen Gilmore Software Engineering Large Practical
  68. 68. No good. What now? Stephen Gilmore Software Engineering Large Practical
  69. 69. Close the project and reopen it? Stephen Gilmore Software Engineering Large Practical
  70. 70. Reopening the project. Praying . . . Stephen Gilmore Software Engineering Large Practical
  71. 71. Didn’t work :-( but look at this . . . Stephen Gilmore Software Engineering Large Practical
  72. 72. Moving the folder fixes the problem :-) Stephen Gilmore Software Engineering Large Practical
  73. 73. Moving the folder fixes the problem :-) Stephen Gilmore Software Engineering Large Practical

×