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
致命傷を避けるための例外実例集
Search
Keishin Yokomaku
November 09, 2016
Technology
0
220
致命傷を避けるための例外実例集
Keishin Yokomaku
November 09, 2016
Tweet
Share
More Decks by Keishin Yokomaku
See All by Keishin Yokomaku
One screen, many BottomSheets
keithyokoma
0
300
LazyColumnのitemがViewPortの中で占める領域の割合を知りたい
keithyokoma
0
530
Build apps for Cars
keithyokoma
0
450
Save the state
keithyokoma
0
500
Either in Kotlin
keithyokoma
0
510
持続的なアプリ開発のためのDXを支える技術
keithyokoma
2
4.9k
Make the objects serializable with kotlinx.serialization
keithyokoma
0
4.8k
Kotlin で書く Gradle Custom Tasks
keithyokoma
0
490
DX Improvements
keithyokoma
3
380
Other Decks in Technology
See All in Technology
オープンソースAIとは何か? --「オープンソースAIの定義 v1.0」詳細解説
shujisado
6
670
Lambda10周年!Lambdaは何をもたらしたか
smt7174
2
110
OCI Network Firewall 概要
oracle4engineer
PRO
0
4.1k
[FOSS4G 2024 Japan LT] LLMを使ってGISデータ解析を自動化したい!
nssv
1
210
B2B SaaSから見た最近のC#/.NETの進化
sansantech
PRO
0
720
スクラム成熟度セルフチェックツールを作って得た学びとその活用法
coincheck_recruit
1
140
iOS/Androidで同じUI体験をネ イティブで作成する際に気をつ けたい落とし穴
fumiyasac0921
1
110
サイバーセキュリティと認知バイアス:対策の隙を埋める心理学的アプローチ
shumei_ito
0
380
これまでの計測・開発・デプロイ方法全部見せます! / Findy ISUCON 2024-11-14
tohutohu
3
370
Security-JAWS【第35回】勉強会クラウドにおけるマルウェアやコンテンツ改ざんへの対策
4su_para
0
170
Terraform Stacks入門 #HashiTalks
msato
0
350
OCI Security サービス 概要
oracle4engineer
PRO
0
6.5k
Featured
See All Featured
Done Done
chrislema
181
16k
Code Review Best Practice
trishagee
64
17k
A Tale of Four Properties
chriscoyier
156
23k
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
25
1.8k
BBQ
matthewcrist
85
9.3k
Fontdeck: Realign not Redesign
paulrobertlloyd
82
5.2k
Git: the NoSQL Database
bkeepers
PRO
427
64k
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
44
2.2k
Fashionably flexible responsive web design (full day workshop)
malarkey
405
65k
GraphQLの誤解/rethinking-graphql
sonatard
67
10k
Building Your Own Lightsaber
phodgson
103
6.1k
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
44
6.8k
Transcript
க໋ইΛආ͚ΔͨΊͷ ྫ֎࣮ྫू Keishin Yokomaku / Startup Android #1
க໋ইΛආ͚ΔͨΊͷྫ֎࣮ྫू About Me ▸ Keishin Yokomaku ▸ Drivemode, Inc. /
Principal Engineer ▸ KeithYokoma: GitHub / Twitter / Qiita / Tumblr / Stack Overflow ▸ Books: Mobile App Dev Guide / Android Academia / Grimoire of Android ▸ Fun: Gymnastics / Cycling / Photography / Motorsport ▸ Today’s Quote: “࣌ے” 2
ྫ֎ 3
4
5 ˒ˑˑˑˑ This app keeps crashing. Uninstalled.
க໋ইΛආ͚ΔͨΊͷྫ֎࣮ྫू ইઙ͍͏ͪʹ࠹͙ ▸ ϦϦʔεઓུͱΫϥογϡݕͷΈඞਢςΫχοΫ ▸ Fabric(Crashlytics) ͰΫϥογϡϩάͷऩू ▸ Google Play
Developer Console Ͱஈ֊తϦϦʔε ▸ ϢʔβϑΟʔυόοΫͷมԽʹؾ͘ ▸ ʮ࠷ۙ͜ΜͳϑΟʔυόοΫ͕Α͘དྷͯΔʯ ▸ ʮ͋ͷϑΟʔυόοΫݮͬͨʯ 6
க໋ইΛආ͚ΔͨΊͷྫ֎࣮ྫू ෆཧͱઓ͏ ▸ ໌Β͔ʹΫϥογϡ͢Δͱ͔Δͷ͚͕ͩݪҼͰͳ͍ ▸ Ϣʔβͷ༻ঢ়گʹΑͬͯΫϥογϡͨ͠Γ͠ͳ͔ͬͨΓ͢Δͷ͋Δ ▸ ͷҧ͍ɺ͍ํͷҧ͍ɺଞʹΠϯετʔϧ͍ͯ͠ΔΞϓϦͷҧ͍ ▸ ༷ʑͳཁҼ͕༧֎ͷΫϥογϡΛ༠ൃ͢Δ
▸ ͱ͖ʹݟΒ͵ྫ֎͕ݪҼͰ͋Δ͜ͱ͋Δ ▸ ྫ֎ͷ໊લϝοηʔδ͔Βঢ়گཧ༝ΛಡΈऔΔεΩϧΛʹண͚Α͏ 7
க໋ইΛආ͚ΔͨΊͷྫ֎࣮ྫू Let’s get started! ▸ ຊͷྫ֎Ϩγϐ ▸ ༗໊Ͳ͜Ζ͔ΒͲϚΠφʔͳͷ·ͰϞϦϞϦίʔε 8 NullPointerException
OutOfMemoryError StackOverflowError Illegal**Exception CursorWindowAllocationException TransactionTooLargeException DeadObjectException
NullPointerException 9
க໋ইΛආ͚ΔͨΊͷྫ֎࣮ྫू NullPointerException ▸ Ұ൪Α͋͘ΔΫϥογϡͷݪҼ ▸ ى͖Δཧ༝༷ʑ ▸ ίʔυ্Ͱͷݕࠪ࿙Ε ▸ Nullable
Ͱͳ͍ॴʹ null Λೖ ▸ ΦϒδΣΫτͷϥΠϑαΠΫϧʹର͢Δߟྀ࿙Ε 10
க໋ইΛආ͚ΔͨΊͷྫ֎࣮ྫू NullPointerException ▸ ΉΈʹରࡦΛऔ͍͚ͬͯͳ͍ ▸ e.g. ͋ΒΏΔϝιουͰ null νΣοΫΛೖΕΔ ▸
ޚతʹͳΓ͗͢ΔͱޙʑͷϝϯςφϯεͰΛҾͬுͬͯ͠·͏ 11
க໋ইΛආ͚ΔͨΊͷྫ֎࣮ྫू NullPointerException ▸ ରࡦͷํ๏ ▸ ઃܭʹΑΔରࡦ ▸ ϝιου͕ null Λڐ༰͢Δ͔Ͳ͏͔ද໌͢Δ͜ͱͰɺ
୭͕null νΣοΫͷΛෛ͏͔ܾΊΔ ▸ NullObject ύλʔϯΛͬͯɺԿى͖ͳ͍Α͏ʹ͢Δ 12
க໋ইΛආ͚ΔͨΊͷྫ֎࣮ྫू NullPointerException ▸ ରࡦͷํ๏ ▸ ϑϨʔϜϫʔΫͷίʔυͷѲ ▸ Ͳ͏͍͏ঢ়گͰϝιου͕ null Λฦ͔͓ͬͯ͘͢
▸ Support Library ͷ࣮ଶΛ͓ͬͯ͘ ▸ ۭ࣮ͷ··ϦϦʔε͞Ε͍ͯΔ͕࣌͋Δ ▸ ϑϨʔϜϫʔΫͷ࡞๏ʹ४ͨ͡࡞ΓํΛ֮͑Δ 13
OutOfMemoryError 14
க໋ইΛආ͚ΔͨΊͷྫ֎࣮ྫू OutOfMemoryError ▸ ը૾ಈըͳͲେ͖ͳσʔλΛѻ͏ͱඞͣʹ͢Δྫ֎ ▸ จࣈ௨Γɺۭ͖ͷͳ͍ώʔϓʹΦϒδΣΫτΛ࡞Ζ͏ͱ͍ͯ͠Δͱ͖ʹى͖Δ ▸ ରࡦํ๏ΘΓͱ໌շ ▸ େ͖ͳΦϒδΣΫτΛখ͘͢͞Δ
▸ ಉ࣌ʹͨ͘͞ΜͷΦϒδΣΫτΛώʔϓʹೖΕͳ͍ ▸ ϝϞϦϦʔΫΛͳ͘͢ 15
StackOverflowError 16
க໋ইΛආ͚ΔͨΊͷྫ֎࣮ྫू StackOverflowError ▸ ελοΫΛ͍௵ͨ͠ͱ͖ʹى͖Δྫ֎ ▸ e.g. ແݶ࠶ؼݺͼग़͠ ▸ ݟམͱ͕ͪ͠ͳՕॴ ▸
ਂ͗͢ΔϨΠΞτͷωετ: ϨΠΞτ݁ہ Java ͷΦϒδΣΫτʹͳΔ ▸ ਂ͗͢Δґଘؔ: աͳϨΠϠԽͰϝιουͷίʔϧελοΫʹݶք͕͘Δ 17
க໋ইΛආ͚ΔͨΊͷྫ֎࣮ྫू StackOverflowError ▸ ରࡦํ๏ ▸ ϨΠΞτͷ֊ߏΛݮΒ͢ ▸ RelativeLayout ConstraintLayout
ͳͲͰϑϥοτͳߏʹ͢Δ ▸ దͳཻͰઃܭΛ͢Δ ▸ Clean Architecture DDD ͳͲΛࢀߟʹ 18
Illegal**Exception 19
க໋ইΛආ͚ΔͨΊͷྫ֎࣮ྫू Illegal**Exception ▸ छྨ৭ʑ ▸ IllegalStateException, IllegalArgumentException, etc… ▸ ݺͼग़͞ΕΔଆ͕ఆ͍ͯ͠ͳ͍ঢ়ଶɾҾʹ໘ͨ͠ͱ͖ʹى͖Δ
▸ ݺͼग़͢ଆ͕ҾνΣοΫঢ়ଶνΣοΫΛ͢Δ͜ͱΛཁٻ͍ͯ͠Δ ▸ ґଘͰެࣜͷ Javadoc ʹॻ͍ͯͳ͍ͱ͖ʹඈΜͰ͘Δ͜ͱ͕͋Δ ▸ ո͍͠ͳʁͱࢥͬͨΒ͙͢ʹঢ়ଶҾΛϩάʹͭΊͯूΊΒΕΔΈΛ 20
க໋ইΛආ͚ΔͨΊͷྫ֎࣮ྫू Illegal**Exception ▸ ରࡦํ๏ ▸ ͙͢ʹͤΔͷ͔ΓͰͳ͍͜ͱʹཹҙ͢Δ ▸ ඞཁͳใΛूΊɺରࡦΛ࿅͔ͬͯΒ͢͜ͱ ▸ Crashlytics
ͷϩάऩूػೳͰࣄલ݅ΛνΣοΫ͢ΔͱΑ͍ 21
CursorWindowAllocation Exception 22
க໋ইΛආ͚ΔͨΊͷྫ֎࣮ྫू CursorWindowAllocationException ▸ σʔλϕʔεΛѻ͏ͱʹ͢Δྫ֎ ▸ Cursor ͕ͭσʔλ͕ڐ༰ൣғΛ͑ͨͱ͖ʹى͖Δ ▸ ϦϑΝϨϯεʹ Javadoc
͕ແ͍ྫ֎͕ͩɺࡶʹ࡞Δͱܸ͢Δϋϝʹ ▸ CursorWindow ΫϥεͷதͰϋϯυϦϯά͍ͯ͠Δ ▸ CursorWindow.java: http://bit.ly/2eKlL5y 23
க໋ইΛආ͚ΔͨΊͷྫ֎࣮ྫू CursorWindowAllocationException ▸ ରࡦํ๏ ▸ ҰؾʹେྔͷσʔλΛऔಘ͍ͯ͠Δ෦ΛࡉΕʹ͢Δ ▸ σʔλϕʔεʹڊେͳσʔλΛอ͠ͳ͍ ▸ ͍ऴΘͬͨ
Cursor close ͢Δ 24
TransactionTooLarge Exception 25
க໋ইΛආ͚ΔͨΊͷྫ֎࣮ྫू TransactionTooLargeException ▸ ϓϩηεؒ௨৴ͰϝϞϦΛ͍͗ͨ͢ͱ͖ʹى͖Δྫ֎ ▸ 1ͭͷϓϩηεʹରׂͯ͠ΓͯΒΕΔϓϩηεؒ௨৴༻ͷྖҬ1mB ▸ ҙ֎ͳͱ͜ΖͰϓϩηεؒ௨৴ΘΕ͍ͯΔ ▸ Context#startActivity
▸ PackageManager#queryIntentActivities ▸ ଞଟ 26
க໋ইΛආ͚ΔͨΊͷྫ֎࣮ྫू TransactionTooLargeException ▸ Intent ͷ extra ʹ 1mB Λ͑Δ String
Λ͢͜ͱͰى͖Δఔʹۙͳͱ ͜ΖʹՄೳੑ͕͋Δ ▸ ରࡦํ๏ ▸ ڊେͳσʔλΛѻΘͳ͍ ▸ ϓϩηεؒ௨৴ͷ࣌ؒΛ͘͢Δ ▸ ϓϩηεؒ௨৴ͷճͦͷͷΛݮΒ͢ 27
DeadObjectException 28
க໋ইΛආ͚ΔͨΊͷྫ֎࣮ྫू DeadObjectException ▸ ࢮΜͩϓϩηεʹ͔͚ͨ͠ͱ͖ʹى͖Δྫ֎ ▸ ௨৴૬खͷϓϩηε͕͍ͭੜ͖͍ͯΔͱݶΒͳ͍ ▸ ରࡦํ๏ ▸ ServiceConnection
IBinder.DeathRecipient Ͱࢮ׆ࢹ ▸ ڊେͳσʔλΛ௨৴ʹͷͤͳ͍ ▸ System Service ࢮ׆ࢹͰ͖ͳͦ͞͏…… 29
·ͱΊ 30
31
க໋ইΛආ͚ΔͨΊͷྫ֎࣮ྫू ·ͱΊ ▸ ରࡦํ๏ͦͷͷʹֵ৽తͳ͜ͱ΄ͱΜͲແ͍ ▸ Α͋͘Δ࣮ྫΛͦͷ··ద༻Ͱ͖Δ͜ͱଟ͍ ▸ ߟ͑ํͷجຊ ▸ ॲཧͷ୯ҐσʔλΛখ͘͞ࡉ͔͘͢Δ
▸ ઃܭͱද໌ͰΛ໌Β͔ʹ͢Δ 32
க໋ইΛආ͚ΔͨΊͷྫ֎࣮ྫू ·ͱΊ ▸ ͍͔ʹૣ͘ใΛूΊͯରࡦ͕औΕΔ͔͕ॏཁ ▸ ஈ֊తϦϦʔε ▸ Ϋϥογϡϩάͷऩू ▸ ϢʔβϑΟʔυόοΫͷղੳ
33
க໋ইΛආ͚ΔͨΊͷ ྫ֎࣮ྫू Keishin Yokomaku / Startup Android #1
DroidKaigi Registration starts from mid-November! 35