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
「なぜそう決めたのか」を残し続ける仕組み ― Notion AI カスタムエージェント × Slack連携による設計判断の自動記録 - NIKKEI Tech Talk #47
niftycorp
PRO
0
120
「エンジニアインターン、どうやって取った?」準備のリアルを語るLT会 Progate BAR
akiomatic
0
130
dRuby over BLE
makicamel
2
330
その問い、本当に正しいですか?AI時代のエンジニアに必要な哲学と認知科学 / ai-philosophy-cognitive-science
minodriven
6
4.1k
「AIで開発し、AIを届ける」をEvalでつなぐ 〜AIネイティブに始めるプロダクト開発の実践〜 / Connecting "Develop with AI, deliver AI" with Eval
rkaga
4
4.9k
The NotImplementedError Problem in Ruby
koic
1
710
The Arts and Crafts of Work in the AI Era — Toward Mastery in Software Development
kuranuki
1
750
Signal Forms: Beyond the Basics @ngBaguette 2026 in Paris
manfredsteyer
PRO
0
240
LLM Plugin for Node-REDの利用方法と開発について
404background
0
170
Modding RubyKaigi for Myself
yui_knk
0
920
net-httpのHTTP/2対応について
naruse
0
470
生成AI時代にこそ効くGo | Why Go Works in the Age of Generative AI
mom0tomo
8
3.2k
Featured
See All Featured
How to make the Groovebox
asonas
2
2.2k
Why Mistakes Are the Best Teachers: Turning Failure into a Pathway for Growth
auna
0
160
Jamie Indigo - Trashchat’s Guide to Black Boxes: Technical SEO Tactics for LLMs
techseoconnect
PRO
0
160
Navigating Weather and Climate Data
rabernat
0
220
Game over? The fight for quality and originality in the time of robots
wayneb77
1
200
Navigating Algorithm Shifts & AI Overviews - #SMXNext
aleyda
1
1.3k
Money Talks: Using Revenue to Get Sh*t Done
nikkihalliwell
0
250
KATA
mclloyd
PRO
35
15k
The untapped power of vector embeddings
frankvandijk
2
1.8k
The Spectacular Lies of Maps
axbom
PRO
1
800
Un-Boring Meetings
codingconduct
0
310
Digital Ethics as a Driver of Design Innovation
axbom
PRO
1
310
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が点滅してしまう - できれば修正されるのを待つ。 対応が待てなければリフレクションを使って、無理やり対応することになりそう (他に対処方法ご存知の方がいれば教えていただけると助かります。。)