Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Tips for making build faster without Instant Run

Tips for making build faster without Instant Run

Tips for making build faster without Instant Run.

860bf040d996601213e05747dd661c23?s=128

Tomoaki Imai

July 15, 2016
Tweet

Transcript

  1. ਓྨ͕ Instant Run Λ࢖͍͜ͳ ͦ͢ͷ೔·Ͱ Mercari, Inc. Tomoaki Imai

  2. twitter: @tomoaki_imai github: tomoima525 ࠓҪ ஐষ Android Engineer 2016.1 transfered

    to Mercari@US ඒຯ͍͠ΧϨʔͷΑ͏ʹ ਓΛ޾ͤʹग़དྷΔΑ͏ʹͳΓ͍ͨ
  3. Recent https://speakerdeck.com/tomoima525/ab-testing-tips-for-mobile

  4. Recent https://github.com/mercari/siberi-android Client library for AB Testing

  5. Instant Run, ࢖ͬͯ·͔͢

  6. Instant Runͷಛ௃ • Ϗϧυ͕ര଎! • ݟ͍ͯΔActivityΛߋ৽ • Ξπ͍!!

  7. Instant Runͷಛ௃ • Ϗϧυ͕ര଎! • ݟ͍ͯΔActivityΛߋ৽ • Ξπ͍!! େ͖ͳϓϩδΣΫτͩͱ஗͍(1,2min) ߋ৽ͨ͠ϑϦͯ͠͠ͳ͍(ReRun͕ඞཁ)

    ෺ཧతʹΞπ͍(AS͕ϝϞϦര৯͍ɺCPUͿΜճ͢) ଞͷϓϩάϥϜ͕஗͘ͳΔ
  8. None
  9. Instant Run ͸ ਓྨʹ͸ૣ͗ͨ͢Μ΍…

  10. ͱΓ͋͑ͣշదʹ։ൃ͢Δͨ Ίʹ΍ͬͯΔ͜ͱ

  11. Tips 1. Self Instant Run

  12. // Build with cached dependencies alias gud='./gradlew --offline assembleUsDev’ Build

  13. // Notify after build is completed alias noti='terminal-notifier -message “done!!"'

    alias gudn='./gradlew --offline assembleUsDev && noti’ Build & Notify https://github.com/julienXX/terminal-notifier
  14. /** Build **/ alias gudd=‘gud Build & Install & Notify

  15. /** Build **/ alias gudd=‘gud /** Show the latest ask

    **/ && ls -lt ${AND_STD_DIR}/app/apk/ Build & Install & Notify
  16. /** Build **/ alias gudd=‘gud /** Show the list of

    apks **/ && ls -lt ${AND_STD_DIR}/app/apk/ /** The latest apk **/ | head -n 2 Build & Install & Notify
  17. Build & Install & Notify /** Build **/ alias gudd=‘gud

    /** Show the list of apks **/ && ls -lt ${AND_STD_DIR}/app/apk/ /** The latest apk **/ | head -n 2 /** Fetch the apk name **/ | awk '\''{print $9}'\''
  18. Build & Install & Notify /** Build **/ alias gudd=‘gud

    /** Show the list of apks **/ && ls -lt ${AND_STD_DIR}/app/apk/ /** The latest apk **/ | head -n 2 /** Fetch the apk name **/ | awk '\''{print $9}'\'' /** Install **/ | xargs -Immm adb install -r ${AND_STD_DIR}/app/apk/mmm
  19. /** Build **/ alias gudd=‘gud /** Show the list of

    apks **/ && ls -lt ${AND_STD_DIR}/app/apk/ /** The latest apk **/ | head -n 2 /** Fetch the apk name **/ | awk '\''{print $9}'\'' /** Install **/ | xargs -Immm adb install -r ${AND_STD_DIR}/app/apk/mmm /** Nofity when everything is done **/ && noti' Build & Install & Notify
  20. /** Install **/ alias insl=‘gud && ls -lt ${AND_STD_DIR}/app/apk/ |

    head -n 2 | awk '\''{print $9}'\''| xargs -Immm adb install -r $ {AND_STD_DIR}/app/apk/mmm’ Build & Install & Launch & Nofity = Self Instant Run
  21. /** Install **/ alias insl=‘gud && ls -lt ${AND_STD_DIR}/app/apk/ |

    head -n 2 | awk '\''{print $9}'\''| xargs -Immm adb install -r $ {AND_STD_DIR}/app/apk/mmm’ /** Launch **/ alias gudl=‘insl && adb shell am start com.mercariapp.mercari.dev/ com.kouzoh.mercari.activity.SplashActivity && noti' Build & Install & Launch & Nofity = Self Instant Run
  22. • Good ! • ·͋·͋଎͍(--offlineޮՌ) • Ξπ͘ͳ͍(javaͷprocessͷΈ) • ଞͷ࡞ۀ͕ḿΔ(஗͘ͳΒͳ͍ɺ௨஌དྷΔ) •

    Bad • ඞͣLaunchը໘ʹ໭ͬͯ͠·͏ Build & Install & Launch & Nofity = Self Instant Run
  23. Tips 2. PlayGround

  24. None
  25. None
  26. Android Playground • ࠷௿ݶͷϦιʔεϑΝΠϧ,UtilityΫϥε • ػೳ୯ҐͰߴ଎ʹ࣮૷͢Δ • ޙ΄ͲຊϓϩδΣΫτʹ౤ೖ͢Δ

  27. Ingredients and Process • Ingredients ‣ build.gradle ( + proguard)

    ‣ Remove unused feature dependencies ‣ Application.java ‣ AndroidManifest.xml ‣ res/ ‣ utils/, lang/, Base Classes • Process ‣ Mix everything into new project(10min) ‣ Remove errors (50-60min)
  28. ͠͹Β͘࢖ͬͯΈͨײ૝ ˕଎͍ & Instant Runշద ˚ ෳ਺ͷػೳͷ։ൃΛ͍ͯ͠ΔͱMessyʹͳΔ ˚ ఆظతͳΩϟονΞοϓ͸ඞཁ →

    ૉͷঢ়ଶΛmaster, ௥Ճ͓͍ͯͨ͠ํ͕Α͍ػ ೳ͸దٓmerge
  29. Wrap up • ΦϨΦϨͳΜͪΌͬͯInstant Run͍͍Α • ػೳผ։ൃ༻؀ڥ(Playground)͍͍Α • ਓྨ͕Instant RunΛ࢖͍͜ͳͤΔ·Ͱ࠲ͯ͠଴ͭ

    (=AS2.2Ҏ߱ʹظ଴)