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
230
致命傷を避けるための例外実例集
Keishin Yokomaku
November 09, 2016
Tweet
Share
More Decks by Keishin Yokomaku
See All by Keishin Yokomaku
Base64 in Android
keithyokoma
0
18
One screen, many BottomSheets
keithyokoma
0
390
LazyColumnのitemがViewPortの中で占める領域の割合を知りたい
keithyokoma
0
660
Build apps for Cars
keithyokoma
0
530
Save the state
keithyokoma
0
570
Either in Kotlin
keithyokoma
0
590
持続的なアプリ開発のためのDXを支える技術
keithyokoma
2
5.2k
Make the objects serializable with kotlinx.serialization
keithyokoma
0
5.1k
Kotlin で書く Gradle Custom Tasks
keithyokoma
0
550
Other Decks in Technology
See All in Technology
小さなチーム 大きな仕事 - 個人開発でAIをフル活用する
himaratsu
0
130
そのコンポーネント、サーバー?クライアント?App Router開発のモヤモヤを可視化する補助輪
makotot
4
600
RAID6 を楔形文字で組んで現代人を怖がらせましょう(実装編)
mimifuwa
1
310
kintone開発チームの紹介
cybozuinsideout
PRO
0
73k
VPC Latticeのサービスエンドポイント機能を使用した複数VPCアクセス
duelist2020jp
0
260
実践アプリケーション設計 ①データモデルとドメインモデル
recruitengineers
PRO
3
310
現場が抱える様々な問題は “組織設計上” の問題によって生じていることがある / Team-oriented Organization Design 20250827
mtx2s
5
1.3k
.NET開発者のためのAzureの概要
tomokusaba
0
230
7月のガバクラ利用料が高かったので調べてみた
techniczna
3
530
人と組織に偏重したEMへのアンチテーゼ──なぜ、EMに設計力が必要なのか/An antithesis to the overemphasis of people and organizations in EM
dskst
6
620
JavaScript 研修
recruitengineers
PRO
3
240
Claude Code x Androidアプリ 開発
kgmyshin
1
590
Featured
See All Featured
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
33
2.4k
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
32
1.4k
For a Future-Friendly Web
brad_frost
179
9.9k
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
358
30k
Learning to Love Humans: Emotional Interface Design
aarron
273
40k
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
46
7.6k
Building Better People: How to give real-time feedback that sticks.
wjessup
367
19k
A better future with KSS
kneath
239
17k
Visualization
eitanlees
147
16k
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
31
2.5k
How to Think Like a Performance Engineer
csswizardry
25
1.8k
Fantastic passwords and where to find them - at NoRuKo
philnash
51
3.4k
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