More Related Content
Similar to ヤフオク!の快適なカスタマー体験を支えるモバイルアプリのライブアップデート技術
Similar to ヤフオク!の快適なカスタマー体験を支えるモバイルアプリのライブアップデート技術 (20)
More from Yahoo!デベロッパーネットワーク
More from Yahoo!デベロッパーネットワーク (20)
ヤフオク!の快適なカスタマー体験を支えるモバイルアプリのライブアップデート技術
- 1. Copyrig ht © 2017 Yahoo Japan Corporation. All Rig hts Reserved.
森 洋之
2017年2月16日
ヤフオク!の快適なカスタマー体験を支えるモバ
イルアプリのライブアップデート技術
- 2. Copyrig ht © 2017 Yahoo Japan Corporation. All Rig hts Reserved.
自己紹介
1
森 洋之
ヤフオク!カンパニーアプリ部
Android黒帯
ヤフオク
Androidアプリチームリーダー
- 3. Copyrig ht © 2017 Yahoo Japan Corporation. All Rig hts Reserved.
概要
2
■アジェンダ
・ モバイルアプリの競争は激しい
・ 改善速度で差をつけよう
・ Hot Patchingが効果的
・ AndroidでHot Patchingをするには
・ デモ
- 4. Copyrig ht © 2017 Yahoo Japan Corporation. All Rig hts Reserved.
モバイルアプリを
取り巻く環境
- 5. Copyrig ht © 2017 Yahoo Japan Corporation. All Rig hts Reserved.
モバイルアプリを取り巻く環境
4
Google Playには約270万のアプリ
2,105,234
2,324,154
2,556,171
2,683,508
1,800,000
2,050,000
2,300,000
2,550,000
2,800,000
2016-04-07 2016-08-01 2016-11-25 2017-01-25
App Tornado GmbH “Number of Android applications” http://www.appbrain.com/stats/number-of-android-apps
- 6. Copyrig ht © 2017 Yahoo Japan Corporation. All Rig hts Reserved.
モバイルアプリを取り巻く環境
5
4割のユーザーは、1日4〜6アプリ使用
Millward Brown Digital “The New Mobile Mantra” Oct 5, 2015
1%
28%
43%
20%
8%
0%
10%
20%
30%
40%
50%
None 1-3 apps 4-6 apps 7-10 apps more than 10 apps
- 7. Copyrig ht © 2017 Yahoo Japan Corporation. All Rig hts Reserved.
モバイルアプリを取り巻く環境
66
平均評価は★4.1と高水準
App Tornado GmbH “Ratings of apps on Google Play” http://www.appbrain.com/stats/android-app-ratings
0
200,000
400,000
600,000
800,000
1,000,000
1,200,000
None < 2.5 2.5-3.0 3.0-3.5 3.5-4.0 4.0-4.5 > 4.5
- 8. Copyrig ht © 2017 Yahoo Japan Corporation. All Rig hts Reserved.
モバイルアプリを取り巻く環境
7
国内ではアプリダウンロード数が減少
App Annie 2016 Retrospective
- 9. Copyrig ht © 2017 Yahoo Japan Corporation. All Rig hts Reserved.
モバイルアプリを取り巻く環境
8
まとめ
・高品質なアプリが、多く世に出ている
・新規ダウンロードは横ばい
→出せば使われる時代は終わり
競争は激しくなっている
- 10. Copyrig ht © 2017 Yahoo Japan Corporation. All Rig hts Reserved.
モバイルアプリを取り巻く環境
9
2016年日本トップパブリッシャーに
Rank Company Country
1 Yahoo Japan Japan
2 LINE Japan
3 Apple United States
4 Google United States
5 CyberAgent Japan
App Annie 2016 Retrospective
- 11. Copyrig ht © 2017 Yahoo Japan Corporation. All Rig hts Reserved.
Yahoo! JAPANの
アプリ開発について
- 12. Copyrig ht © 2017 Yahoo Japan Corporation. All Rig hts Reserved.
Yahoo! JAPANのアプリ開発について
11
使いやすいアプリを開発する
・「あたりまえ」品質の基準を定義
→サポートするプラットフォーム整備
→ワークショップや勉強会の開催
- 13. Copyrig ht © 2017 Yahoo Japan Corporation. All Rig hts Reserved.
Yahoo! JAPANのアプリ開発について
12
「あたりまえ」品質の基準を定義
・信頼性
→安心、安全に使用できること
・市場性
→市場優位性、新規性があること
・使用性
→使いやすいこと
- 14. Copyrig ht © 2017 Yahoo Japan Corporation. All Rig hts Reserved.
Yahoo! JAPANのアプリ開発について
13
「あたりまえ」品質の基準を定義
・機能性
→合目的的で想定通りに動くこと
・改善性
→迅速に改修可能であること
- 15. Copyrig ht © 2017 Yahoo Japan Corporation. All Rig hts Reserved.
Yahoo! JAPANのアプリ開発について
14
全社CI環境
GitHub
- 16. Copyrig ht © 2017 Yahoo Japan Corporation. All Rig hts Reserved.
Yahoo! JAPANのアプリ開発について
15
全社CI環境
GitHub Jenkins
- 17. Copyrig ht © 2017 Yahoo Japan Corporation. All Rig hts Reserved.
Yahoo! JAPANのアプリ開発について
16
全社CI環境
Jenkins JacocoGitHub
- 18. Copyrig ht © 2017 Yahoo Japan Corporation. All Rig hts Reserved.
Yahoo! JAPANのアプリ開発について
17
全社CI環境
GitHub AppiumJenkins Jacoco
- 19. Copyrig ht © 2017 Yahoo Japan Corporation. All Rig hts Reserved.
Yahoo! JAPANのアプリ開発について
18
全社CI環境
テスト結果
UIテストのスクリーンショット
Jenkins Jacoco Appium
Artifactory
Android
GitHub
- 20. Copyrig ht © 2017 Yahoo Japan Corporation. All Rig hts Reserved.
Yahoo! JAPANのアプリ開発について
19
複数のユーザーチャネル
Google Play
- 21. Copyrig ht © 2017 Yahoo Japan Corporation. All Rig hts Reserved.
Yahoo! JAPANのアプリ開発について
20
複数のユーザーチャネル
Google Play
- 22. Copyrig ht © 2017 Yahoo Japan Corporation. All Rig hts Reserved.
Yahoo! JAPANのアプリ開発について
21
複数のユーザーチャネル
Google Play
- 23. Copyrig ht © 2017 Yahoo Japan Corporation. All Rig hts Reserved.
Yahoo! JAPANのアプリ開発について
22
複数のユーザーチャネル
バージョン×機能
別カテゴライズ
Google Play Watson
- 24. Copyrig ht © 2017 Yahoo Japan Corporation. All Rig hts Reserved.
Yahoo! JAPANのアプリ開発について
23
Rollout.io
Rollout.io
App Store
※2017年3月8日、Apple社からRolloutの利用に関する警告を受けたため、こちらの記事にあるRolloutは利用しないようお願いいたします。
- 25. Copyrig ht © 2017 Yahoo Japan Corporation. All Rig hts Reserved.
Yahoo! JAPANのアプリ開発について
ターゲティングプッシュツール
自動車好き
アクセサリ好き
パソコン好き
自動車が
とてもオトク
- 26. Copyrig ht © 2017 Yahoo Japan Corporation. All Rig hts Reserved.
Yahoo! JAPANのアプリ開発について
25
ターゲティングプッシュツール
自動車好き
アクセサリ好き
パソコン好き
自動車が
とてもオトク
アクセサリが
タイムセール
パソコン機器
大バーゲン
- 27. Copyrig ht © 2017 Yahoo Japan Corporation. All Rig hts Reserved.
Yahoo! JAPANのアプリ開発について
26
ターゲティングプッシュツール
App Indexing
Web2App
ネイティブ画面
WebView
URIで
判定
自動車が
オトク 通知
- 28. Copyrig ht © 2017 Yahoo Japan Corporation. All Rig hts Reserved.
アプリ特有の課題
- 29. Copyrig ht © 2017 Yahoo Japan Corporation. All Rig hts Reserved.
アプリ特有の課題
28
理想のリリースサイクル
企画
テスト
開発リリース
- 30. Copyrig ht © 2017 Yahoo Japan Corporation. All Rig hts Reserved.
アプリ特有の課題
29
現実のリリースサイクル
企画
テスト
開発
部分
リリース
審査
計測
完全
リリース
- 31. Copyrig ht © 2017 Yahoo Japan Corporation. All Rig hts Reserved.
アプリ特有の課題
30
新しいバージョンが普及するまでの
タイムラグ
1 0 月1 0 日 1 0 月2 5 日 1 1 月8 日1 0 月3 1 日
- 32. Copyrig ht © 2017 Yahoo Japan Corporation. All Rig hts Reserved.
アプリ特有の課題
31
新しいバージョンが普及するまでの
タイムラグ
1 0 月1 0 日 1 0 月2 5 日 1 1 月8 日1 0 月3 1 日
1週間
- 33. Copyrig ht © 2017 Yahoo Japan Corporation. All Rig hts Reserved.
アプリ特有の課題
32
新しいバージョンが普及するまでの
タイムラグ
1 0 月1 0 日 1 0 月2 5 日 1 1 月8 日1 0 月3 1 日
2週間
- 34. Copyrig ht © 2017 Yahoo Japan Corporation. All Rig hts Reserved.
アプリ特有の課題
33
不具合のリスク
企画
テスト
開発
部分
リリース
審査
計測
完全
リリース
- 35. Copyrig ht © 2017 Yahoo Japan Corporation. All Rig hts Reserved.
アプリ特有の課題
34
Hot Patchingによるフローの改善
企画
テスト
開発
部分
リリース
審査
計測
完全
リリース
- 36. Copyrig ht © 2017 Yahoo Japan Corporation. All Rig hts Reserved.
アプリ特有の課題
35
OS Version Diversity
https://developer.android.com/about/dashboards/index.html
- 37. Copyrig ht © 2017 Yahoo Japan Corporation. All Rig hts Reserved.
アプリ特有の課題
36
メンテナンスコストの増大と
コードの複雑化
・Camera2 API
・マテリアルデザイン関連
→Android 4.xをはやく切りたい
→4系が30%…
- 38. Copyrig ht © 2017 Yahoo Japan Corporation. All Rig hts Reserved.
アプリ特有の課題
37
パッチによるサポート
version 1 version 2 version 3
version 1 version 2
OS 6.x
OS 4.x Patch
サポート
- 39. Copyrig ht © 2017 Yahoo Japan Corporation. All Rig hts Reserved.
一般化するHot Patching
- 40. Copyrig ht © 2017 Yahoo Japan Corporation. All Rig hts Reserved.
一般化するHot Patching
39
主だったHot Patchingライブラリ
iOS - Rollout.io
iOS – bang590/JSPatch
Android - Tencent/tinker
Android – alibaba/AndFix
Android - Avocarrot/json2view
※2017年3月8日、Apple社からRolloutの利用に関する警告を受けたため、こちらの記事にあるRolloutは利用しないようお願いいたします。
- 41. Copyrig ht © 2017 Yahoo Japan Corporation. All Rig hts Reserved.
一般化するHot Patching
40
iOS – Rollout.io
https://rollout.io/success-stories/
※2017年3月8日、Apple社からRolloutの利用に関する警告を受けたため、こちらの記事にあるRolloutは利用しないようお願いいたします。
- 42. Copyrig ht © 2017 Yahoo Japan Corporation. All Rig hts Reserved.
一般化するHot Patching
41
iOS – bang590/JSPatch
レポジトリにつけられたスター数をグラフ化
http://www.timqian.com/star-history/ を利用
- 43. Copyrig ht © 2017 Yahoo Japan Corporation. All Rig hts Reserved.
一般化するHot Patching
42
Android - Tencent/tinker
レポジトリにつけられたスター数をグラフ化
http://www.timqian.com/star-history/ を利用
- 44. Copyrig ht © 2017 Yahoo Japan Corporation. All Rig hts Reserved.
一般化するHot Patching
43
Android - Tencent/tinker
現バージョン
新バージョン
現バージョン
dex
dex
パッチ dex
dex
- 45. Copyrig ht © 2017 Yahoo Japan Corporation. All Rig hts Reserved.
一般化するHot Patching
44
Android – alibaba/AndFix
レポジトリにつけられたスター数をグラフ化
http://www.timqian.com/star-history/ を利用
- 46. Copyrig ht © 2017 Yahoo Japan Corporation. All Rig hts Reserved.
一般化するHot Patching
45
Android – Avocarrot/json2view
レポジトリにつけられたスター数をグラフ化
http://www.timqian.com/star-history/ を利用
- 47. Copyrig ht © 2017 Yahoo Japan Corporation. All Rig hts Reserved.
Androidと
Hot Patching
- 48. Copyrig ht © 2017 Yahoo Japan Corporation. All Rig hts Reserved.
AndroidとHot Patching
47
処理の置換
・ vtable操作
・ DexClassLoader
・ Script
デザインの置換
・ ひたすらがんばる
- 49. Copyrig ht © 2017 Yahoo Japan Corporation. All Rig hts Reserved.
AndroidとHot Patching
48
vtable操作
Method A Method B Method C Method D Method E
0 1 2 3 4
- 50. Copyrig ht © 2017 Yahoo Japan Corporation. All Rig hts Reserved.
AndroidとHot Patching
49
vtable操作
Method A Method B Method C Method D Method E
0 1 2 3 4
Method B’
- 51. Copyrig ht © 2017 Yahoo Japan Corporation. All Rig hts Reserved.
AndroidとHot Patching
50
DexClassLoader
Activity A
Activity B
ProxyActivity
Activity B’
external.jar
- 52. Copyrig ht © 2017 Yahoo Japan Corporation. All Rig hts Reserved.
AndroidとHot Patching
51
Script
if (スクリプトがある) {
return スクリプトの実行
}
通常の処理
- 53. Copyrig ht © 2017 Yahoo Japan Corporation. All Rig hts Reserved.
AndroidとHot Patching
52
デザインの置換
public void createView(Context ctx, JSONObject obj) {
// Classオブジェクトを得て
Class viewClass = Class.forName(obj.getString("name"));
// 生成する
View view = (View)viewClass.getConstructor(Context.class).newInstance(ctx);
// プロパティを得て
JSONArray properties = obj.getJSONArray("properties");
// 設定する
setProperties(view, properties);
}
- 54. Copyrig ht © 2017 Yahoo Japan Corporation. All Rig hts Reserved.
AndroidとHot Patching
53
デザインの置換
public void setProperties(View view, JSONArray properties) {
for (int i = 0; i < properties.length(); i++) {
JSONObject property = properties.getJSONObject(i);
switch (property.getString("name")) {
case LAYOUT_WIDTH:
…
case LAYOUT_HEIGHT:
…
case GRAVITY:
…
- 55. Copyrig ht © 2017 Yahoo Japan Corporation. All Rig hts Reserved.
Hot Patching諸注意
- 56. Copyrig ht © 2017 Yahoo Japan Corporation. All Rig hts Reserved.
Hot Patching諸注意
55
Hot Patchingとセキュリティ
- 57. Copyrig ht © 2017 Yahoo Japan Corporation. All Rig hts Reserved.
Hot Patching諸注意
56
Hot Patchingとセキュリティ
- 58. Copyrig ht © 2017 Yahoo Japan Corporation. All Rig hts Reserved.
Hot Patching諸注意
57
Hot Patchingとセキュリティ
- 59. Copyrig ht © 2017 Yahoo Japan Corporation. All Rig hts Reserved.
Hot Patching諸注意
58
Hot Patchingとセキュリティ
- 60. Copyrig ht © 2017 Yahoo Japan Corporation. All Rig hts Reserved.
Hot Patching諸注意
59
Hot Patchingとガイドライン
Rollout.io
・WebKit / JavaScriptCoreで実行し
・アプリの主要な目的を変更しない
ことで、
Apple Developer Program Requirements
3.3.2, 3.3.3に違反していない
※2017年3月8日、Apple社からRolloutの利用に関する警告を受けたため、こちらの記事にあるRolloutは利用しないようお願いいたします。
- 61. Copyrig ht © 2017 Yahoo Japan Corporation. All Rig hts Reserved.
Hot Patching諸注意
60
Hot Patchingとガイドライン
Google Play
・apkバイナリを書き換えてはいけない
・と、あったと思ったんだけど…
・ユーザーは尊重しましょう
- 62. Copyrig ht © 2017 Yahoo Japan Corporation. All Rig hts Reserved.
お手軽Hot Patching
- 63. Copyrig ht © 2017 Yahoo Japan Corporation. All Rig hts Reserved.
お手軽Hot Patching
62
使用するもの
・Transform API
→ビルド時にバイトコード変換を行う
・jboss-javassist/javassist
→手軽にバイトコード変換を書ける
・mozilla/rhino
→OSS JavaScript実装
・json2view
→jsonからViewを生成する https://goo.gl/MDnvUt
- 64. Copyrig ht © 2017 Yahoo Japan Corporation. All Rig hts Reserved.
お手軽Hot Patching
63
Transform API
・Android Gradle Plugin提供のAPI
・Android Gradle Plugin 1.5〜
・Jackは未サポート(別のAPIで可能)
- 65. Copyrig ht © 2017 Yahoo Japan Corporation. All Rig hts Reserved.
お手軽Hot Patching
64
gradle pluginを作って、registerTransform()
で登録する
class Patcher implements Plugin<Project>{
@Override
void apply(Project project) {
// バイトコード変換を行うTransformerを登録する
project.android.registerTransform(
new PatcherTransformer(project))
}
- 66. Copyrig ht © 2017 Yahoo Japan Corporation. All Rig hts Reserved.
お手軽Hot Patching
65
Javassistで処理を挿入する
if (スクリプトがある) {
return スクリプトの実行
}
通常の処理
- 67. Copyrig ht © 2017 Yahoo Japan Corporation. All Rig hts Reserved.
お手軽Hot Patching
66
Javassistで処理を挿入する
全クラス.each{
全メソッド.each{
メソッド.insertBefore(
“スクリプトがあれば実行”
)
}
}
- 68. Copyrig ht © 2017 Yahoo Japan Corporation. All Rig hts Reserved.
お手軽Hot Patching
67
mozilla/rhino
・Javaで書かれたJavaScriptの実装
・Androidでも動く
・JavaのObjectを渡して、
スクリプト内でアクセス可能
- 69. Copyrig ht © 2017 Yahoo Japan Corporation. All Rig hts Reserved.
お手軽Hot Patching
68
Java ObjectをJavaScript用Objectに変換、
実行し、戻り値を受け取る
ScriptableObject.putProperty(scope, "instance",
Context.javaToJS(instance, scope));
rhino.evaluateString(scope, script, "JavaScript", 1, null);
Function function = (Function)scope.get("apply", scope);
Object result = function.call(rhino, scope, scope, functionParams);
- 70. Copyrig ht © 2017 Yahoo Japan Corporation. All Rig hts Reserved.
お手軽Hot Patching
69
json2view
・xmlをjsonに変換し、それを配信する
$ ./gradlew runScript -Pxml=./pathToInputXmlFile.xml
- 71. Copyrig ht © 2017 Yahoo Japan Corporation. All Rig hts Reserved.
お手軽Hot Patching
70
レイアウトを設定する箇所に、
こういうコードを書く
if (レイアウトパッチがある) {
View view = DynamicView.createView(
this, パッチ, null);
setContentView(view);
} else {
setContentView(R.layout.default_layout)
}
- 72. Copyrig ht © 2017 Yahoo Japan Corporation. All Rig hts Reserved.
お手軽Hot Patching
71
サンプルのサーバ
・サンプルなので、なんでもいいです
https://goo.gl/DvUggq
- 73. Copyrig ht © 2017 Yahoo Japan Corporation. All Rig hts Reserved.
お手軽Hot Patching
72
デモ
- 74. Copyrig ht © 2017 Yahoo Japan Corporation. All Rig hts Reserved.
まとめ
73
まとめ
・ モバイルアプリの競争は激しいので
・ 改善速度で差をつけよう
・ Hot Patchingが効果的!
- 75. Copyrig ht © 2017 Yahoo Japan Corporation. All Rig hts Reserved.