Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
TargetSdkVersion29で BottomNavigationが点滅する件
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
yu mitsuhori
October 01, 2019
Programming
1.6k
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
TargetSdkVersion29で BottomNavigationが点滅する件
potatotips#65での発表資料です
yu mitsuhori
October 01, 2019
More Decks by yu mitsuhori
See All by yu mitsuhori
【DroidKaigi版】ReactNativeとKotlinで叶える夢のリアルタイム音声配信
youmitsu
1
3.2k
ReactNativeとKotlinで叶える夢のリアルタイム音声配信
youmitsu
1
920
stand.fm(Android)におけるreact-native-track-playerの改善
youmitsu
1
2.2k
リリース前のリグレッションテストをUIテストで自動化、1年間運用した話
youmitsu
2
420
New features in RemoteConfig, Analytics at Google I/O 2019
youmitsu
1
780
FirebaseNotification,RemoteConfigでユーザセグメントごとにプッシュ通知を実装する
youmitsu
8
1.6k
Report from Google I/O 2019
youmitsu
1
110
OSSにコントリビュートした話
youmitsu
1
110
初めて自作ViewのAARライブラリを公開した話
youmitsu
1
430
Other Decks in Programming
See All in Programming
Spring Security 実践 ─ GraphQL APIで実務に役立つ 認証・認可 を学ぶ
wagyu
0
260
TypeScript+Orvalで実現する型安全かつ堅牢でスケーラブルなマルチチャネル通知基盤 / TSKaigi Night talks ~after conference~
d0riven
0
360
AIを活用したE2Eテスト実装効率化のあゆみ / ebisu-mobile-14-kotetu
kotetuco
0
130
1B+ /day規模のログを管理する技術
broadleaf
0
110
ADKを使って簡単にAIエージェントを作ってみよう
k1mu21
0
280
OSもどきOS
arkw
0
590
「なぜそう決めたのか」を残し続ける仕組み ― Notion AI カスタムエージェント × Slack連携による設計判断の自動記録 - NIKKEI Tech Talk #47
niftycorp
PRO
0
230
その問い、本当に正しいですか?AI時代のエンジニアに必要な哲学と認知科学 / ai-philosophy-cognitive-science
minodriven
13
6.3k
不変条件と整合性境界—ビジネスが決める設計判断と実現パターン / Invariants and Consistency Boundaries
nrslib
14
5.8k
例外の正しい扱い方 そのエラー try-catchして大丈夫?
jinwatanabe
0
280
ふつうのFeature Flag実践入門
irof
8
4.2k
そのテスト、説明できますか?~LWテスト戦略FW~のご紹介
nakahara
0
160
Featured
See All Featured
Mind Mapping
helmedeiros
PRO
1
260
Jess Joyce - The Pitfalls of Following Frameworks
techseoconnect
PRO
1
170
Java REST API Framework Comparison - PWX 2021
mraible
34
9.4k
Keith and Marios Guide to Fast Websites
keithpitt
413
23k
Facilitating Awesome Meetings
lara
57
7k
A Soul's Torment
seathinner
6
3k
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
37
6.5k
Heart Work Chapter 1 - Part 1
lfama
PRO
7
36k
SEO for Brand Visibility & Recognition
aleyda
0
4.6k
B2B Lead Gen: Tactics, Traps & Triumph
marketingsoph
0
160
Reality Check: Gamification 10 Years Later
codingconduct
0
2.2k
AI: The stuff that nobody shows you
jnunemaker
PRO
8
730
Transcript
TargetSdkVersion29で BottomNavigationが点滅する件 養命酒(Yu Mitsuhori) potatotips #65
whoami - 三堀裕(みつほりゆう) - CCCグループ(株)Blabo 所属 - 共創マーケティングプラットフォーム 「Blabo!」のAndroid版を主に担当 -
@1013Youmeee - youmitsu - youmeee
Android 10 Released!!
Let’s migrate to API level 29(Android 10)!!
しかしBottomNavigationでissue発見... - そんなすんなり行くほど世の中甘くない。。 - 今日はそのissueについての紹介です
BottomNavigationとは - Androidにおけるいわゆる下タブ - https://material.io/components/bottom-navigation/
- コードはこちらに公開しています - https://github.com/youmitsu/BottomNavigationBugTestApp APILevel29でなぜか点滅する 選択されているMenuItemが 別タブに移る際に点滅する。。
再現条件を整理してみる - TargetSdkVersion, CompileSdkVersionは29 - material-component-android:1.1.0-alpha09を使用 - Android10の端末で再現 - Android
Pie(9)以下の端末では再現しない =>ライブラリが対応できていないことによるバグっぽい。。? - 一応他のバージョンでも試したところ1.0.0の時点から起きる
material-componentsにissueをあげてみる https://github.com/material-components/material-components-android/issues/628
すでに上がっていました。。
すでに上がっていた方を見てみる https://github.com/material-components/material-components-android/issues/530
原因判明 - どうやらBottomNavigationMenuViewのバグっぽい - プロパティで使われているTransitionSetが悪さしている? - ただ既存コードであるし、Android10にあげた途端に再現するようになるのは少し 謎。。(深追いはしません) https://github.com/material-components/material-components-android/issues/530#issu ecomment-533597823
None
対処法①~気長に待つ~ - Fixされるのを待つ - Android10はリリースされたばかりなのでご愛嬌
対処法②~リフレクションを使う~ https://github.com/material-components/material-components-android/issues/530#issu ecomment-534331153
対処法②~リフレクションを使う~ lateinit var binding: ActivityMainBinding override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState) ... binding = DataBindingUtil.setContentView(this, R.layout.activity_main) binding.bottomNav.fixBlinking() // 初期化時に下記の拡張関数を呼んであげれば OK } private fun BottomNavigationView.fixBlinking() { val menuView = getChildAt(0) as BottomNavigationMenuView with(menuView::class.java.getDeclaredField("set")) { isAccessible = true val transitionSet = (get(menuView) as androidx.transition.AutoTransition).apply { for (i in transitionCount downTo 0) { val transition = getTransitionAt(i) as? Fade ?: continue removeTransition(transition) } } set(menuView, transitionSet) } } リフレクションでmenuViewに アタッチされているFadeTransitionを removeする BottomNavigationMenuViewの transitionSetのプロパティを取得 TransitionSetをセットし 直す
対処法②~proguardの修正も必要~ - releaseビルド時に難読化されてしまうとリフレクション時にプロパティ名を正しく参 照できなくなる - BottomNavigationMenuViewをproguard-rulesでkeepするように記述 # 以下を追記 -keep class
com.google.android.material.bottomnavigation.BottomNavigationMenuView { *; } proguard-rules.pro
まとめ - issueを出す時はすでに起票されていないかちゃんとチェックしよう - compileSdkVersionが29では、現状material-components-androidの BottomNavigationが点滅してしまう - できれば修正されるのを待つ。 対応が待てなければリフレクションを使って、無理やり対応することになりそう (他に対処方法ご存知の方がいれば教えていただけると助かります。。)