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

mobilemethod-osaka-2018-11-09-jakalada-android

9de7a10d760bcc0a690f8b23b408fb6c?s=47 Hideki Hamada
November 09, 2018

 mobilemethod-osaka-2018-11-09-jakalada-android

モバイルメソッド大阪 第4回 登壇資料「AndroidアプリのターゲットAPIレベルを上げたときのなんやかんや」

9de7a10d760bcc0a690f8b23b408fb6c?s=128

Hideki Hamada

November 09, 2018
Tweet

Transcript

  1. "OESPJEΞϓϦͷ  λʔήοτ"1*ϨϕϧΛ  ্͛ͨͱ͖ͷͳΜ΍͔Μ΍  ϞόΠϧϝιουେࡕୈ̐ճ ඿ాӯथ!KBLBMBEB

  2. ࣗݾ঺հ w ඿ాӯथʢ͸·ͩͻͰ͖ʣ

  3. ࣗݾ঺հ w ඿ాӯथʢ͸·ͩͻͰ͖ʣ w Ϋϥεϝιουגࣜձࣾ w ϞόΠϧΞϓϦαʔϏε෦ॴଐ

  4. ࣗݾ঺հ w ඿ాӯथʢ͸·ͩͻͰ͖ʣ w Ϋϥεϝιουגࣜձࣾ w ϞόΠϧΞϓϦαʔϏε෦ॴଐ w "OESPJEΤϯδχΞ w

    ϲ݄લʹೖࣾʢ೥݄ʣ
  5. ࠓ೔͢Δ࿩

  6. "OESPJEΞϓϦͷ λʔήοτ"1*ϨϕϧΛ ্͛ͨͱ͖ͷͳΜ΍͔Μ΍

  7. ໨࣍  (PPHMF1MBZͷཁ݅มߋ  ରԠͨ͠ΞϓϦ  ରԠͷ֓ཁ  ରԠͷৄࡉ

  8. (PPHMF1MBZͷཁ݅มߋ

  9. AndroidΞϓϦ։ൃͷ Ұ࣍৘ใ

  10. Android Developers https://developer.android.com

  11. Google Developers https://developers.google.com

  12. Google Developersͷ ϒϩά

  13. https://developers-jp.googleblog.com/2017/12/improving-app-security-and-performance.html

  14. https://developers-jp.googleblog.com/2017/12/improving-app-security-and-performance.html

  15. https://developers-jp.googleblog.com/2017/12/improving-app-security-and-performance.html

  16. ֓ཁ

  17. https://developers-jp.googleblog.com/2017/12/improving-app-security-and-performance.html

  18. https://developers-jp.googleblog.com/2017/12/improving-app-security-and-performance.html

  19. https://developers-jp.googleblog.com/2017/12/improving-app-security-and-performance.html

  20. APIϨϕϧΛ λʔήοτʹࢦఆ͢Δʁ

  21. https://developer.android.com/about/versions/pie/android-9.0-changes-28

  22. https://developer.android.com/about/versions/pie/android-9.0-changes-28

  23. "1*Ϩϕϧະຬ͕λʔήοτͷ ΞϓϦʹ͸ద༻͞Εͳ͍ https://developer.android.com/about/versions/pie/android-9.0-changes-28

  24. λʔήοτAPIϨϕϧཁ݅

  25. https://developers-jp.googleblog.com/2017/12/improving-app-security-and-performance.html

  26. https://developers-jp.googleblog.com/2017/12/improving-app-security-and-performance.html

  27. https://developers-jp.googleblog.com/2017/12/improving-app-security-and-performance.html

  28. https://developers-jp.googleblog.com/2017/12/improving-app-security-and-performance.html

  29. https://developers-jp.googleblog.com/2017/12/improving-app-security-and-performance.html

  30. UBSHFU4EL7FSTJPO λʔήοτ"1*Ϩϕϧͷ͜ͱ https://developers-jp.googleblog.com/2017/12/improving-app-security-and-performance.html

  31. https://developers-jp.googleblog.com/2017/12/improving-app-security-and-performance.html

  32. ίʔυωʔϜͱ͓ͯ͠՛ࢠͷ໊લ͕෇͍ͯΔ "OESPJE$VQDBLF ΧοϓέʔΩ   "OESPJE0SFP ΦϨΦ  "OESPJE1JF ύΠ

    https://developers-jp.googleblog.com/2017/12/improving-app-security-and-performance.html
  33. ࠷৽ͷOSʹະରԠͷ ΞϓϦ͸ެ։Ͱ͖ͳ͍

  34. ެ։ࡁΈͷΞϓϦ͸ ຖ೥ͷରԠ͕ඞཁ

  35. ରԠͨ͠ΞϓϦ

  36. ॳ࢓ࣄ

  37. None
  38. ࠷ऴߋ৽೥݄

  39. ࠷ऴߋ৽೥݄ &DMJQTF

  40. ࠷ऴߋ৽೥݄ &DMJQTF +BWB

  41. ࠷ऴߋ৽೥݄ &DMJQTF +BWB "OESPJEΛαϙʔτ

  42. ࠷ऴߋ৽೥݄ &DMJQTF +BWB "OESPJEΛαϙʔτ λʔήοτ"1*Ϩϕϧʜ

  43. ࠷ऴߋ৽೥݄ &DMJQTF +BWB "OESPJEΛαϙʔτ λʔήοτ"1*Ϩϕϧʜ

  44. ࠷ऴߋ৽೥݄ &DMJQTF +BWB "OESPJEΛαϙʔτ λʔήοτ"1*Ϩϕϧʜ

  45. https://developers-jp.googleblog.com/2017/12/improving-app-security-and-performance.html

  46. https://developers-jp.googleblog.com/2017/12/improving-app-security-and-performance.html

  47. 19→26Ҏ߱

  48. ରԠͷ֓ཁ

  49. ։ൃ؀ڥ

  50. ։ൃ؀ڥ ରԠલ ରԠޙ *%& &DMJQTF "%5 "OESPJE4UVEJP ݴޠ +BWB ͦͷ··

  51. ։ൃ؀ڥ ରԠલ ରԠޙ *%& &DMJQTF "%5 "OESPJE4UVEJP ݴޠ +BWB ͦͷ··

    ೥຤ ਖ਼ࣜ൛ϦϦʔε ೥຤ αϙʔτऴྃ
  52. ։ൃ؀ڥ ରԠલ ରԠޙ *%& &DMJQTF "%5 "OESPJE4UVEJP ݴޠ +BWB ͦͷ··

  53. ։ൃ؀ڥ ରԠલ ରԠޙ *%& &DMJQTF "%5 "OESPJE4UVEJP ݴޠ +BWB ͦͷ··

    Ҡߦ͢Δͱͨ͠Β গͣͭ͠,PUMJO Ұؾʹ,PUMJO
  54. Ϗϧυπʔϧ

  55. Ϗϧυπʔϧ ରԠલ ରԠޙ (SBEMF ະ࢖༻  "OESPJEQMVHJOGPS (SBEMF ະ࢖༻ 

    CVJME5PPMT7FSTJPO ෆ໌ 
  56. Ϗϧυπʔϧ ରԠલ ରԠޙ (SBEMF ະ࢖༻  "OESPJEQMVHJOGPS (SBEMF ະ࢖༻ 

    CVJME5PPMT7FSTJPO ෆ໌ 
  57. Ϗϧυπʔϧ ରԠલ ରԠޙ (SBEMF ະ࢖༻  "OESPJEQMVHJOGPS (SBEMF ະ࢖༻ 

    CVJME5PPMT7FSTJPO ෆ໌ 
  58. Ϗϧυπʔϧ ରԠલ ରԠޙ (SBEMF ະ࢖༻  "OESPJEQMVHJOGPS (SBEMF ະ࢖༻ 

    CVJME5PPMT7FSTJPO ෆ໌  "OESPJE4UVEJP΁ͷҠߦ࣌ʹ ࠷৽൛͕ࢦఆ͞Εͨ
  59. λʔήοτAPIϨϕϧؔ࿈

  60. λʔήοτAPIϨϕϧؔ࿈ ରԠલ ରԠޙ UBSHFU4EL7FSTJPO   DPNQJMF4EL7FSTJPO ෆ໌  BQQDPNQBUW

    ෆ໌ 
  61. λʔήοτAPIϨϕϧؔ࿈ ରԠલ ରԠޙ UBSHFU4EL7FSTJPO   DPNQJMF4EL7FSTJPO ෆ໌  BQQDPNQBUW

    ෆ໌  λʔήοτ"1*Ϩϕϧ
  62. λʔήοτAPIϨϕϧؔ࿈ ରԠલ ରԠޙ UBSHFU4EL7FSTJPO   DPNQJMF4EL7FSTJPO ෆ໌  BQQDPNQBUW

    ෆ໌  ίϯύΠϧʹ࢖༻͢Δ 4%,ͷόʔδϣϯ
  63. λʔήοτAPIϨϕϧؔ࿈ ରԠલ ରԠޙ UBSHFU4EL7FSTJPO   DPNQJMF4EL7FSTJPO ෆ໌  BQQDPNQBUW

    ෆ໌  αϙʔτϥΠϒϥϦͷͻͱͭ
  64. build.gradle android { // ... compileSdkVersion 28 defaultConfig { //

    ... targetSdkVersion 28 } } dependencies { // ... implementation 'com.android.support:appcompat-v7:28.0.0' }
  65. λʔήοτAPIϨϕϧؔ࿈ ରԠલ ରԠޙ UBSHFU4EL7FSTJPO   DPNQJMF4EL7FSTJPO ෆ໌  BQQDPNQBUW

    ෆ໌ 
  66. λʔήοτAPIϨϕϧؔ࿈ ରԠલ ରԠޙ UBSHFU4EL7FSTJPO   DPNQJMF4EL7FSTJPO ෆ໌  BQQDPNQBUW

    ෆ໌  Λ௒͑ͯ·Ͱ্͛ͨ
  67. 28Ͱ߹Θ͍ͤͯΔཧ༝

  68. λʔήοτAPIϨϕϧؔ࿈ ରԠલ ରԠޙ UBSHFU4EL7FSTJPO   DPNQJMF4EL7FSTJPO ෆ໌  BQQDPNQBUW

    ෆ໌ 
  69. λʔήοτAPIϨϕϧؔ࿈ ରԠલ ରԠޙ UBSHFU4EL7FSTJPO   DPNQJMF4EL7FSTJPO ෆ໌  BQQDPNQBUW

    ෆ໌  ݹ͍4%,͸৽͍͠4%,Λ஌Βͳ͍ DPNQJMF4EL7FSTJPO͸ UBSHFU4EL7FSTJPOҎ্
  70. λʔήοτAPIϨϕϧؔ࿈ ରԠલ ରԠޙ UBSHFU4EL7FSTJPO   DPNQJMF4EL7FSTJPO ෆ໌  BQQDPNQBUW

    ෆ໌  όʔδϣϯ͕ҟͳΔͱ ҟৗಈ࡞͢Δʢ͔΋ʣ DPNQJMF4EL7FSTJPOͱ BQQDPNQBUWͷόʔδϣϯ͸ಉ͡
  71. λʔήοτAPIϨϕϧؔ࿈ ରԠલ ରԠޙ UBSHFU4EL7FSTJPO   DPNQJMF4EL7FSTJPO ෆ໌  BQQDPNQBUW

    ෆ໌  ߹ΘͤͨΒ͢΂ͯͷ৚݅Λຬͨ͢
  72. ରԠͷৄࡉ

  73. ਐΊํ

  74. build.gradle android { // ... compileSdkVersion 19 defaultConfig { //

    ... targetSdkVersion 19 } } dependencies { // ... implementation 'com.android.support:appcompat-v7:19.1.0' } ελʔτ஍఺ 
  75. build.gradle android { // ... compileSdkVersion 28 defaultConfig { //

    ... targetSdkVersion 28 } } dependencies { // ... implementation 'com.android.support:appcompat-v7:28.0.0' } ΰʔϧ 
  76. 1ݸ্ͣͭ͛Δ

  77. https://developer.android.com/about/versions/pie/android-9.0-changes-28

  78. ͦͷ·͑ʹ

  79. Android StudioҠߦ࣌఺Ͱ ϏϧυΤϥʔ

  80. resource android:attr/ preserveIconSpacing is private. failed linking references.

  81. 19→22 (Android 4.4→5.1) ࢀߟ: https://stackoverflow.com/questions/29248579/error-in-declare- styleable-menuview-unable-to-find-attribute-androidpreserv

  82. ϏϧυͰ͖ͨ

  83. 1ݸ্ͣͭ͛Δ

  84. 22→23 (Android 5.1→6.0)

  85. ϏϧυΤϥʔ 22→23

  86. org.apache.http ͷ࡟আ 22→23

  87. build.gradle android { // ... useLibrary 'org.apache.http.legacy' }

  88. ϏϧυΤϥʔ͸ղܾ 22→23

  89. ࣮ߦ࣌Τϥʔ 22→23

  90. ࣮ߦ࣌ύʔϛογϣϯ ͷ࢓༷௥Ճ 22→23

  91. ϥΠϒϥϦ͕৭ʑ͋Δ 22→23

  92. PermissionsDispatcher ࢖ͬͨ 22→23

  93. ࢖༻ྫ @RuntimePermissions public class MainActivity extends AppCompatActivity { @NeedsPermission(Manifest.permission.CAMERA) void

    showCamera() { // ... } @OnShowRationale(Manifest.permission.CAMERA) void showRationaleForCamera(final PermissionRequest request) { // ... } @OnPermissionDenied(Manifest.permission.CAMERA) void showDeniedForCamera() { // ... } @OnNeverAskAgain(Manifest.permission.CAMERA) void showNeverAskForCamera() { // ... } } https://github.com/permissions-dispatcher/PermissionsDispatcher
  94. 23→24 (Android 6.0→7.0)

  95. ಈ࡞ɾUIͷද͕͓͔͍ࣔ͠ 23→24

  96. ContentResolver.addPeriodicSync ͷ࢓༷มߋ 23→24 ࢀߟ: https://developer.android.com/reference/android/content/ContentResolver.html

  97. ࢦఆִ͕ͨؒ͠15෼ʹؙΊΒΕΔ 23→24 ࢀߟ: https://developer.android.com/reference/android/content/ContentResolver.html

  98. UIͷද͚ࣔͩमਖ਼ 23→24

  99. 24→25 (Android 7.0→7.1)

  100. OK 24→25

  101. 25→26 (Android 7.1→8.0)

  102. ϏϧυΤϥʔ 25→26

  103. ActionBarActivity ͷ࡟আ 25→26 ࢀߟ: https://android-developers.googleblog.com/2015/04/android-support-library-221.html

  104. ରԠྫ import android.support.v7.app.ActionBarActivity; // ... public class BaseActivity extends ActionBarActivity

    { // ... }
  105. ରԠྫ import android.support.v7.app.AppCompatActivity; // ... public class BaseActivity extends AppCompatActivity

    { // ... }
  106. 26→27 (Android 8.0→8.1)

  107. OK 26→27

  108. 27→28 (Android 8.1→9.0)

  109. ࣮ߦ࣌Τϥʔ 27→28

  110. org.apache.http.legacy ͷ࡟আ 27→28 ࢀߟ: https://developer.android.com/about/versions/pie/android-9.0-changes-28

  111. AndroidManifest.xml <?xml version="1.0" encoding="utf-8"?> <manifest ... > ... <application ...

    > <uses-library android:name="org.apache.http.legacy" android:required="false"/> ... </application> </manifest> ࢀߟ: https://developer.android.com/about/versions/pie/android-9.0-changes-28
  112. ·ͱΊ

  113. Ұཡ "1*Ϩϕϧ 04όʔδϣϯ ग़͖ͯͨ՝୊   —   PSHBQBDIFIUUQͷ࡟আ

    ࣮ߦ࣌ύʔϛογϣϯͷ࢓༷௥Ճ   $POUFOU3FTPMWFSBEE1FSJPEJD4ZODͷ࢓༷มߋ   —   "DUJPO#BS"DUJWJUZͷ࡟আ   —   PSHBQBDIFIUUQMFHBDZͷ࡟আ
  114. ෛ࠴͸ͨ͘͞Μ࢒ͬͯΔ…

  115. ͋Γ͕ͱ͏͍͟͝·ͨ͠