tools of the trade
play

TOOLS OF THE TRADE Hello! I AM ZARAH I am an Android developer - PowerPoint PPT Presentation

TOOLS OF THE TRADE Hello! I AM ZARAH I am an Android developer for Domain.com.au THE KEY Know available tools THE KEY Know available tools There is no correct setup CODE FRAGMENTS FRAGMENT LIFECYCLE FragmentManager.


  1. TOOLS OF THE TRADE

  2. Hello! I AM ZARAH I am an Android developer for Domain.com.au

  3. THE KEY Know available tools

  4. THE KEY Know available tools There is no “correct” setup

  5. CODE

  6. FRAGMENTS

  7. FRAGMENT LIFECYCLE FragmentManager. enableDebugLogging (true);

  8. SERVICES

  9. SERVICES @Override public void onCreate() { super.onCreate(); android.os.Debug. waitForDebugger (); // Do stuff in your service Log. d ("MyService", "I am inside the service!"); }

  10. SERVICES @Override public void onCreate() { super.onCreate(); android.os.Debug. waitForDebugger (); // Do stuff in your service Log. d ("MyService", "I am inside the service!"); }

  11. SERVICES ◦ Put a breakpoint AFTER the call to wait

  12. SERVICES ◦ Put a breakpoint AFTER the call to wait ◦ Edit your Run Configurations

  13. SERVICES ◦ Trigger service

  14. SERVICES ◦ Trigger service ◦ Attach debugger <service android:name="com.myapp.MySyncService" android:exported="true" android:process=":sync" >

  15. BUILT-IN TOOLS

  16. DEBUGGER

  17. DEBUGGER Say NO! to the green bug

  18. DEBUGGER Say NO! to the green bug Create a new keyboard shortcut for Attach Debugger to Android Process

  19. DEBUGGER Say NO! to the green bug Create a new keyboard shortcut for Attach Debugger to Android Process Preferences > Keymap > Main Menu > Run > Attach Debugger to Android Process > Right Click > Add Keyboard Shortcut

  20. DEBUGGER Say NO! to the green bug Create a new keyboard shortcut for Attach Debugger to Android Process AIN’T NOBODY GOT TIME FOR Preferences > Keymap > Main Menu > Run > Attach Debugger to Android Process > Right Click > Add Keyboard Shortcut THAT!

  21. DEBUGGER

  22. DEBUGGER Run then Attach

  23. BREAKPOINTS

  24. BREAKPOINTS

  25. BREAKPOINTS (AN ASIDE)

  26. BREAKPOINTS

  27. BREAKPOINTS Stop during interesting iterations

  28. BREAKPOINTS Suspend on exceptions

  29. BREAKPOINTS If you have a bunch of breakpoints related to a particular bug, GROUP THEM

  30. DEBUG TOOL WINDOW

  31. DEBUG TOOL WINDOW

  32. FRAMES

  33. VARIABLES

  34. VARIABLES

  35. EVALUATING EXPRESSIONS

  36. WATCHES

  37. WATCHES ◦ Add variables and expressions ◦ Resolved in the context of the current frame

  38. WATCHES ◦ Add variables and expressions ◦ Resolved in the context of the current frame

  39. WATCHES

  40. WATCHES

  41. WATCHES

  42. WATCHES ◦ No need to Timber/Toast/Log

  43. WATCHES ◦ No need to Timber/Toast/Log ◦ Like evaluated expressions, but lots of them

  44. WATCHES ◦ No need to Timber/Toast/Log ◦ Like evaluated expressions, but lots of them ◦ Persistent across sessions

  45. WATCHES ◦ No need to Timber/Toast/Log ◦ Like evaluated expressions, but lots of them ◦ Persistent across sessions ◦ Change expressions on the fly Do even more: IntelliJ blog

  46. SYSTEM INFORMATION

  47. SYSTEM INFORMATION Info dump of system state

  48. SYSTEM INFORMATION

  49. SYSTEM INFORMATION Activity Manager State Activity lifecycle state Config values Fragments and their states View hierarchy Choreography state Looper state

  50. SYSTEM INFORMATION Activity Manager Package Info State Manifest information Activity lifecycle state APK info Config values User install info Fragments and their states View hierarchy Choreography state Looper state

  51. SYSTEM INFORMATION Activity Manager Package Info Memory Usage State Manifest information Memory allocations Activity lifecycle state APK info Asset allocations Config values User install info Fragments and their states View hierarchy Choreography state Looper state

  52. SYSTEM INFORMATION Memory Usage over Time Runtime stats Memory usages Low level info

  53. SYSTEM INFORMATION Memory Usage Graphics State over Time How well animations are Runtime stats doing Memory usages Cache info Low level info View hierarchy

  54. LAYOUT INSPECTOR

  55. LAYOUT INSPECTOR

  56. THIRD PARTY TOOLS

  57. HUGO Annotation-based = EASY

  58. HUGO Annotation-based = EASY Shows method calls++ 9477-9477/io.plaidapp V/DataManager: ⇢ sourceLoaded(data=[Redraw Keyboard, Saas 01, Air Traveller App, Become a driver], page=2, key="DRIBBBLE_QUERY_Material Design") 9477-9477/io.plaidapp V/DataManager: ⇠ sourceLoaded [0ms] = true https://github.com/JakeWharton/hugo

  59. HUGO (AN ASIDE) logm live template

  60. ADB PLUGIN App actions from within Studio

  61. ADB PLUGIN No fussing with Settings https://github.com/pbreault/adb-idea

  62. STETHO Wealth of options

  63. STETHO Wealth of options ◦ DB inspection

  64. STETHO Wealth of options ◦ DB inspection ◦ SharedPreferences

  65. STETHO Wealth of options ◦ DB inspection ◦ SharedPreferences ◦ Network inspection

  66. STETHO Wealth of options ◦ DB inspection ◦ SharedPreferences ◦ Network inspection ◦ View hierarchy

  67. STETHO Wealth of options ◦ DB inspection ◦ SharedPreferences ◦ Network inspection ◦ View hierarchy ◦ dumpapp

  68. STETHO Source: Facebook http://facebook.github.io/stetho/

  69. PIDCAT Logcat with less pain

  70. PIDCAT Logcat with less pain https://github.com/JakeWharton/pidcat

  71. LEAK CANARY

  72. LEAK CANARY Source: Square https://github.com/square/leakcanary

  73. Some practical stuff

  74. STUDIO IS BEING WEIRD Cannot add breakpoint

  75. STUDIO IS BEING WEIRD Cannot add breakpoint ADB cannot see devices

  76. STUDIO IS BEING WEIRD First aid

  77. STUDIO IS BEING WEIRD First aid ◦ Unplug then re-plug device

  78. STUDIO IS BEING WEIRD First aid ◦ Unplug then re-plug device ◦ Disable then re-enable ADB integration

  79. STUDIO IS BEING WEIRD First aid ◦ Unplug then re-plug device ◦ Disable then re-enable ADB integration ◦ Invalidate caches and restart

  80. STUDIO IS BEING WEIRD First aid ◦ Unplug then re-plug device ◦ Disable then re-enable ADB integration ◦ Invalidate caches and restart ◦ Disable the re-enable USB debugging on device

  81. But I really don’t want to do all that...

  82. BETTER CODING, (HOPEFULLY) LESS DEBUGGING Use support annotations

  83. BETTER CODING, (HOPEFULLY) LESS DEBUGGING Use support annotations Listen to Lint

  84. BETTER CODING, (HOPEFULLY) LESS DEBUGGING Use support annotations Listen to Lint Use AppCompat methods

  85. ADDITIONAL RESOURCES Philippe Breault [Twitter] Jake Wharton [Github] Square [Github]

  86. Thank you! ANY QUESTIONS? THANK YOU! www.zdominguez.com +ZarahDominguez @zarahjutz

  87. APPENDIX

  88. SUPPORT ANNOTATIONS Add the dependency** dependencies { compile 'com.android.support:support-annotations:24.2.0' }

  89. SUPPORT ANNOTATIONS Profit private void setThingsToTextView(int res1, int res2, int res3, int res4) { // do stuff } private void setThingsToTextView(@IdRes int textView, @StringRes int introText, @DrawableRes int heroImage, @ColorRes int backgroundColour) { // do stuff }

  90. SYSTEM INFORMATION Activity Manager State

  91. SYSTEM INFORMATION Package Information

  92. SYSTEM INFORMATION Memory Usage

  93. SYSTEM INFORMATION Memory Usage over time

  94. SYSTEM INFORMATION Graphics state

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend