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
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
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
なぜ型を書くのか? TSKaigi2026で改めて考える #tskaigi_smarthr
kajitack
0
140
Even G2とAWSで推しのエージェントを召喚しよう!
har1101
1
120
AI駆動開発を妨げる技術的負債の解消アプローチ / ai-refactoring-approach
minodriven
12
6.6k
Javaの型とAI時代に型が大事な理由 / java types and type in AI era
kishida
2
150
RTSPクライアントを自作してみた話
simotin13
0
630
jQueryをバージョンアップする前に使いたいjQuery Migrate
matsuo_atsushi
0
590
ランチタイムLT会3周年!ランチタイムLT会を3年間続けられたお話
y0hgi
1
100
Go1.27で導入されるジェネリクスメソッドでできること
mackee
0
170
生成AI時代にこそ効くGo | Why Go Works in the Age of Generative AI
mom0tomo
8
3.3k
トークンをケチるな、設計しろ:GitHub Copilotを賢く使うコンテキスト戦略
ochtum
0
160
決定論的オーケストレーションの設計と実装 / Design and Implementation of Deterministic Orchestration
nrslib
4
1.5k
気づいたらRubyで100作品 ー クリエイティブコーディングが生活の一部になるまで / 100 Ruby Sketches Later: How Creative Coding Became Part of My Life
chobishiba
3
610
Featured
See All Featured
Reality Check: Gamification 10 Years Later
codingconduct
0
2.2k
Public Speaking Without Barfing On Your Shoes - THAT 2023
reverentgeek
1
430
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
333
23k
What the history of the web can teach us about the future of AI
inesmontani
PRO
1
620
Lightning Talk: Beautiful Slides for Beginners
inesmontani
PRO
2
580
Information Architects: The Missing Link in Design Systems
soysaucechin
0
980
The Power of CSS Pseudo Elements
geoffreycrofte
82
6.3k
Ecommerce SEO: The Keys for Success Now & Beyond - #SERPConf2024
aleyda
1
2k
The Invisible Side of Design
smashingmag
301
52k
Building Adaptive Systems
keathley
44
3.1k
Why Mistakes Are the Best Teachers: Turning Failure into a Pathway for Growth
auna
0
170
The innovator’s Mindset - Leading Through an Era of Exponential Change - McGill University 2025
jdejongh
PRO
1
210
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が点滅してしまう - できれば修正されるのを待つ。 対応が待てなければリフレクションを使って、無理やり対応することになりそう (他に対処方法ご存知の方がいれば教えていただけると助かります。。)