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
430
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
【やさしく解説 設計編 #0】DDDのコード、読めるのに分からない人へ
panda728
PRO
2
250
symfony/aiとlaravel/boost
77web
0
120
Semantic Version 単位で戦略を柔軟に変えて、パッケージアップデートを自動化する
daitasu
1
350
Hunting Vulnerabilities in Symfony with LLMs
vinceamstoutz
0
580
TSKaigi Night Talks 2026_TypeScriptでサプライチェーンの整合性を型に閉じ込める
geekplus_tech
0
440
ランチタイムLT会3周年!ランチタイムLT会を3年間続けられたお話
y0hgi
1
140
そのテスト、説明できますか?~LWテスト戦略FW~のご紹介
nakahara
0
200
例外の正しい扱い方 そのエラー try-catchして大丈夫?
jinwatanabe
0
360
ローカルLLMでどこまでコードが書けるか -縮小版 / How much code can be written on a local LLM Shortened
kishida
2
180
1B+ /day規模のログを管理する技術
broadleaf
0
130
初めてのKubernetes 本番運用でハマった話
oku053
0
120
Even G2とAWSで推しのエージェントを召喚しよう!
har1101
1
160
Featured
See All Featured
Sam Torres - BigQuery for SEOs
techseoconnect
PRO
0
300
DBのスキルで生き残る技術 - AI時代におけるテーブル設計の勘所
soudai
PRO
67
56k
Stop Working from a Prison Cell
hatefulcrawdad
274
21k
Efficient Content Optimization with Google Search Console & Apps Script
katarinadahlin
PRO
1
680
Tips & Tricks on How to Get Your First Job In Tech
honzajavorek
1
560
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
25
2k
Being A Developer After 40
akosma
91
590k
Joys of Absence: A Defence of Solitary Play
codingconduct
1
410
Documentation Writing (for coders)
carmenintech
77
5.4k
The untapped power of vector embeddings
frankvandijk
2
1.8k
For a Future-Friendly Web
brad_frost
183
10k
ラッコキーワード サービス紹介資料
rakko
1
3.9M
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が点滅してしまう - できれば修正されるのを待つ。 対応が待てなければリフレクションを使って、無理やり対応することになりそう (他に対処方法ご存知の方がいれば教えていただけると助かります。。)