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

Android Jetpack 2018-2019

Android Jetpack 2018-2019

Google I/O Extended Tokyo 2019 での LT です。
https://yj-meetup.connpass.com/event/126019/

266af7918931b0ea15eae9e8f42ecfa6?s=128

kumamotone

May 08, 2019
Tweet

Transcript

  1. Android Jetpack 2018-2019 2019/05/07 Google I/O Extended Tokyo LT https://twitter.com/kumamo_tone

    https://kuma.dev
  2. ࣗݾ঺հ • ۽ຊ ࿨ਖ਼ (@kumamo_tone) • iOS/AndroidΞϓϦΤϯδχΞˏϠϑʔ • ษڧձӡӦ •

    དྷ݄ WWDC ࢀՃ͠·͢ • ࠷ۙ͸DMMӳձ࿩ͱγϟχϚεΛ΍͍ͬͯ·͢
  3. Google I/O 2018 Androidʹؔ͢Δൃදͱ͍͑͹

  4. https://www.youtube.com/watch?v=ogfYd705cRs

  5. Android P Beta ɾ/FX4ZTUFN/BWJHBUJPO ɾ"QQ"DUJPOT ɹɾϢʔβʔͷߦಈΛ෼ੳͯ͠ɺ࣍ʹߦͳ͍ͦ ͏ͳૢ࡞ΛϗʔϜը໘ʹαδΣετ͢Δػೳ ɾ4MJDFT ɹɾݕࡧͨ͠಺༰ʹରͯ͠ɺ֤ΞϓϦ͕ؔ࿈͠ ͨ৘ใΛαδΣετ͢Δػೳ

    https://www.youtube.com/watch?v=ogfYd705cRs
  6. Android P Beta ɾ"EBQUJWF#BUUFSZ ɹɾϢʔβʔͷߦಈΛֶश͠ɺόοςϦʔΛઅ໿ ͯ͘͠ΕΔʢΒ͍͠ʣ ɾ%BTICPBSE "QQ5JNFS 8JOE%PXO ɹɾ%JHJUBM8FMMCFJOHπʔϧ

    ˞͜ͷࠒ͸1JYFMͷ೔ຊͰͷൃച͸ൃද͞Ε͓ͯΒ ͣɺ೔ຊͰ།Ұ߹๏తʹݕূͰ͖Δ୺຤͸ &TTFOUJBMQIPOF 1) ͷΈͱ͍͏ঢ়گͩͬͨ https://www.youtube.com/watch?v=ogfYd705cRs
  7. ͦͯ͠…

  8. https://developer.android.com/images/jetpack/jetpack-hero.svg

  9. Android Jetpack ͖͜͜͢ Android Jetpack ख্͛ͯΔͷ ͔Θ͍͍ ੜ਎Ͱ ඈߦͯ͠ େৎ෉

    ͳͷ͔ʁ https://developer.android.com/images/jetpack/jetpack-hero.svg
  10. Android Jetpack • Jetpack ͸ɺ༏Εͨ Android ΞϓϦΛ؆୯ ʹ։ൃͰ͖ΔΑ͏ʹ͢ΔͨΊͷ Android ι

    ϑτ΢ΣΞ ίϯϙʔωϯτͷίϨΫγϣϯ Ͱ͢ɻ • ͜ΕΒͷίϯϙʔωϯτʹΑΓɺϘΠϥʔϓ Ϩʔτ ίʔυΛ࡞੒͢ΔखؒΛͳ͘͠ɺ͓ ͢͢Ίͷํ๏ʹԊͬͯ։ൃΛਐΊͳ͕Βɺ ෳࡶͳλεΫΛ؆ૉԽͰ͖ΔͷͰɺίʔυ ͷॏཁͳ෦෼ʹूத͢Δ͜ͱ͕Ͱ͖·͢ɻ jetpack-hero.svg https://developer.android.com/jetpack?hl=JA https://developer.android.com/images/jetpack/jetpack-hero.svg
  11. ࠓ೔ͷ࿩ • Android Jetpack/Android Xͱ͸ • ࠓߋͳ͕ΒͰ͕͢ɺࣗ෼ࣗ਎ɺࡶͳཧղΛͯͨ͠ͷͰ… • ͜ͷ1೥ͰAndroid Jetpackʹىͬͨ͜͜ͱΛͬ͘͟ΓৼΓฦΓ

  12. Android Jetpack

  13. https://developer.android.com/jetpack?hl=JA

  14. Android Jetpack • ΞϓϦ։ൃΛՃ଎ͤ͞ΔެࣜϥΠϒϥϦʢʴΨΠυϥΠϯͳͲʁʣ • ϥΠϑαΠΫϧ؅ཧͳͲͷΊΜͲ͍͘͞෦෼Λ΍ͬͯ͘ΕΔ • ϕετϓϥΫςΟεʹ৐͔ͬΔ͜ͱ͕Ͱ͖Δ • androidx.*

    ύοέʔδͰߏ੒͞ΕΔ • Android API͔Βಠཱ͍ͯ͠Δ • ͭ·ΓɺԼҐޓ׵ੑ͕͋Δͱ͍͏͜ͱ • ͭ·Γɺ࠷৽͔ͭ࠷ߴͷόʔδϣϯͷ Jetpack ίϯϙʔωϯτΛৗ ʹར༻͢Δ͜ͱ͕Ͱ͖Δͱ͍͏͜ͱʢڧؾʣ
  15. AndroidX • Support Library ͷ৽࣌୅ͷນ։͚ͱͳΔɺ৽͍͠ Android ֦ுػೳ ϥΠϒϥϦ • ݱࡏɺαϙʔτ͞ΕΔ࠷খ

    SDK Ϩϕϧ͸ 14 Ͱ͕͢ɺʮv7ʯͱ͍͏໊ લ͕෇͍ͨίϯϙʔωϯτ΍ύοέʔδ͕Ҿ͖ଓ͖ଘࡏ͍ͯ͠·͢ɻ ͲΕ͕ϓϥοτϑΥʔϜʹόϯυϧ͞Ε͍ͯΔ API ͰɺͲΕ͕ Android ͷ͞·͟·ͳόʔδϣϯͰಈ࡞͢ΔΞϓϦ σϕϩούʔ༻੩ తϥΠϒϥϦͳͷ͔Λ໌֬ʹ۠ผͰ͖ΔΑ͏ʹ͍ͨ͠ͱߟ͍͑ͯ· ͢ɻ AndroidX ͷ঺հ https://developers-jp.googleblog.com/2018/05/hello-world-androidx.html
  16. AndroidX • Support Library͸android.support.*ύοέʔδͩͬͨ • androidx.*͸Support Library ͓ΑͼArchitecture ComponentsΛؚ ΉɺOSʹόϯυϧ͞Ε͍ͯͳ͍ϥΠϒϥϦͷΈͱ͢Δ

    • ͨͱ͑͹: • PackageManager ͸ android.*ʢOSʹόϯυϧ͞Ε͓ͯΓɺ Android όʔδϣϯ͝ͱʹ API ΍ಈ࡞͕ҟͳΔ৔߹͕͋Δʣ • AppCompatActivity ΍ ViewModel ͸ androidx.* AndroidX ͷ঺հ https://developers-jp.googleblog.com/2018/05/hello-world-androidx.html
  17. https://github.com/googlesamples/android-sunflower

  18. αϯϓϧ (Android Sunflower) • JetpackΛ࢖ͬͨAndroid։ൃͷ ϕετϓϥΫςΟεΛઆ໌͢Δ ΨʔσχϯάΞϓϦ • Android Sunflower

    is currently released as an alpha and is under heavy development.ʢLast updated: Oct 11, 2018) https://github.com/googlesamples/android-sunflower
  19. A journey to AndroidX Release Notes

  20. Android Jetpack(AndroidX) Release Notes • Release Notes ͱ Release Note

    Archive ͕͋Δ https://developer.android.com/jetpack/androidx?hl=JA
  21. Recent Updates • ೔෇͝ͱʹ·ͱ·͍ͬͯΔ • ࠨͷϖΠϯ͔Β֤androidx.* ʹ͍ͭͯݟΔ͜ͱ΋Ͱ͖Δ https://developer.android.com/jetpack/androidx/releases?hl=JA

  22. AndroidX Release Notes Archive • Ҡߦظલޙ (2018೥12݄ʙ2019೥1݄ʣҎલͷ΋ͷ͸ͬͪ͜ • AndroidX was

    originally developed by three separate teams. Β͍͠ https://developer.android.com/jetpack/androidx/releases/archive?hl=JA
  23. τϐοΫε • Architecture Components • WorkManager, Navigation ͕ొ৔ɺͦͯ͠Stableʹ • Room

    2 • ConstraintLayout 2 • MotionLayout • Android KTX
  24. Navigation • Version 2.1.0-alpha02 • (April 3rd, 2019) • Version

    2.0.0 • (March 14, 2019) Android Jetpack Navigation ͷ҆ఆ൛ϦϦʔε https://developers-jp.googleblog.com/2019/04/android-jetpack-navigation-stable.html
  25. WorkManager Android Developers Blog: Android Jetpack WorkManager Stable Release https://android-developers.googleblog.com/2019/03/android-jetpack-workmanager-stable.html

    • Version 2.1.0-alpha01(April 24, 2019) • APIมߋ • Version 2.0.1(April 9, 2019) • όάमਖ਼ • Version 2.0.0(March 20, 2019)
  26. Room • Version 1.1.1(June 19, 2018) • Version 2.0.0-beta01(October 8,

    2018) • Full Text Search (@Fts4) • Views • AutoValue • Rx Support • Version 2.1.0-alpha07 (April 25, 2019) • Coroutines Support
  27. Room • શจݕࡧ(@Fts4) @Entity @Fts4 data class Mail { @PrimaryKey

    val id: Long, val subject: String, val body: String, val timestamp: Long } http://yaraki.github.io/slides/aac-paging/index.html#17 @Dao interface MailDao { @Query("SELECT * FROM Mail WHERE Mail MATCH :q") fun search(q: String): List<Mail> }
  28. Room • Version 1.1.1(June 19, 2018) • Version 2.0.0-beta01(October 8,

    2018) • Full Text Search (@Fts4) • Views • AutoValue • Rx Support • Version 2.1.0-alpha07 (April 25, 2019) • Coroutines Support
  29. ConstraintLayout • ConstraintLayout 2.0.0 alpha 5 (April 26, 2019) •

    Flow Virtual layout • MotionLayout https://developer.android.com/jetpack/androidx/releases/constraintlayout ConstraintLayout Flowͷ঺հ - stsnϒϩά https://satoshun.github.io/2019/04/constraintlayout-flow/
  30. Android KTX https://developer.android.com/kotlin/ktx

  31. Android KTX • lifecycle-viewmodel-ktx (2.1.0-alpha01) • ViewModel ͷதͰ viewModelScope.launch {}

    Ͱ͖Δ https://android.googlesource.com/platform/frameworks/support/+/androidx-master-dev/lifecycle/viewmodel/ktx/src/main/java/androidx/lifecycle/ViewModel.kt
  32. • fragment-ktx(1.1.0-alpha07) • lifecycle-livedata-ktx(2.1.0-alpha04) Android KTX val viewModel: MyViewModel by

    viewModels() viewModel.livedata.observe(this) { }
  33. androidx.activity • Version 1.0.0-alpha07(April 25th, 2019) • ComponentActivity • activity.onBackPressedDispatcher.addCallback(this,

    object : OnBackPressedCallback {})
  34. androidx.remotecallback • Version 1.0.0-alpha01(December 3, 2018) • Remote Callback is

    a new library aimed at making generating and receiving PendingIntents easier. This is the first version of Remote Callback. • PendingIntentΛ؆୯ʹѻ͑ΔΑ͏ʹ͢ΔͬΆ͍
  35. androidx.viewpager2 • Version 1.0.0-alpha03(April 3rd, 2019) • Comparing to its

    predecessor android.support.v4.view.ViewPager (VP1): • Right-to-left (RTL) layout support • Vertical orientation support • notifyDataSetChanged fully functional (VP1 bugs addressed) • RecyclerViewΛ࢖ͬͨViewPager • ViewPager1ͷόάϑΟοΫεؚ͕·ΕΔΒ͍͠
  36. ͓ΘΓʹ

  37. ͓ΘΓʹ • Android Jetpack࠷ߴʂʂ • ԼҐޓ׵ੑΛ࣋ͬͨศརϥΠϒϥϦΛ
 ެࣜͰఏڙ͠Α͏ͱ͍͏৺ҙؾɺͦͯ͠౒ྗ • WorkManager, Navigation

    ΋ Stable ʹ • ৽ػೳ΍Android-KTXͰͲΜͲΜศརʹͳ͍ͬͯ͘ • ໷໌͚·Ͱ͕࣌ؒ͋ΔͷͰɺ
 ଞʹ΋͍͍ײ͡ͷWhat’s NewΛΈͳ͞·ڭ͍͑ͯͩ͘͞
  38. ̎ "OESPJE։ൃऀతॏେχϡʔε ̌ ̍ ̔ ೥ Android Jetpack ;Γ͔͑Γ ݄༵ਂ໷൪૊෩

    ɹεϥΠυʢϘπʣ ͓ΘΓ ͝ਗ਼ௌ͋Γ͕ͱ͏͍͟͝·ͨ͠ https://developer.android.com/images/jetpack/jetpack-hero.svg