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
320
LazyColumnのitemがViewPortの中で占める領域の割合を知りたい
keithyokoma
0
560
Build apps for Cars
keithyokoma
0
460
Save the state
keithyokoma
0
510
Either in Kotlin
keithyokoma
0
520
持続的なアプリ開発のためのDXを支える技術
keithyokoma
2
5k
Make the objects serializable with kotlinx.serialization
keithyokoma
0
4.9k
Kotlin で書く Gradle Custom Tasks
keithyokoma
0
490
DX Improvements
keithyokoma
3
380
Other Decks in Technology
See All in Technology
大幅アップデートされたRagas v0.2をキャッチアップ
os1ma
2
520
マルチプロダクト開発の現場でAWS Security Hubを1年以上運用して得た教訓
muziyoshiz
2
2.2k
多領域インシデントマネジメントへの挑戦:ハードウェアとソフトウェアの融合が生む課題/Challenge to multidisciplinary incident management: Issues created by the fusion of hardware and software
bitkey
PRO
2
100
PHPからGoへのマイグレーション for DMMアフィリエイト
yabakokobayashi
1
170
C++26 エラー性動作
faithandbrave
2
700
サイバー攻撃を想定したセキュリティガイドライン 策定とASM及びCNAPPの活用方法
syoshie
3
1.2k
UI State設計とテスト方針
rmakiyama
2
440
日本版とグローバル版のモバイルアプリ統合の開発の裏側と今後の展望
miichan
1
130
サイボウズフロントエンドエキスパートチームについて / FrontendExpert Team
cybozuinsideout
PRO
5
38k
私なりのAIのご紹介 [2024年版]
qt_luigi
1
120
Amazon SageMaker Unified Studio(Preview)、Lakehouse と Amazon S3 Tables
ishikawa_satoru
0
150
NilAway による静的解析で「10 億ドル」を節約する #kyotogo / Kyoto Go 56th
ytaka23
3
370
Featured
See All Featured
Optimizing for Happiness
mojombo
376
70k
Designing for Performance
lara
604
68k
Building Applications with DynamoDB
mza
91
6.1k
Building an army of robots
kneath
302
44k
It's Worth the Effort
3n
183
28k
The Invisible Side of Design
smashingmag
298
50k
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
232
17k
Java REST API Framework Comparison - PWX 2021
mraible
PRO
28
8.3k
Facilitating Awesome Meetings
lara
50
6.1k
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
38
1.9k
4 Signs Your Business is Dying
shpigford
181
21k
What's in a price? How to price your products and services
michaelherold
243
12k
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