Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
More Android Studio Debugger
Search
Yoshihiro WADA
October 31, 2018
Programming
420
8
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
More Android Studio Debugger
2018/10/31に開催された Shibuya.apk #29 にて発表した「More Android Studio Debugger」のスライドです。
Yoshihiro WADA
October 31, 2018
More Decks by Yoshihiro WADA
See All by Yoshihiro WADA
AndroidデバイスにFTPサーバを建立する
e10dokup
0
1.7k
Gradleの実行環境設定を見直す
e10dokup
0
1.4k
Firebase App Distributionのテストアプリ配信を試しやすくする
e10dokup
1
750
アプリに署名する 〜GitHub ActionsでのCIも見据えて〜
e10dokup
0
1.4k
Profileable buildでより正確なパフォーマンスを掴む
e10dokup
0
810
[DroidKaigi 2021] メディアアクセス古今東西 / Now and Future of Media Access
e10dokup
0
4.1k
今更「dp」を考える / Let's think about "dp" now
e10dokup
0
6k
1から学ぶAndroidアプリデバッグ - アプリの動作を追いかけよう / Learn Android application debugging from the scratch - track apps' behaviors
e10dokup
10
3.7k
Guide to background processingを読んでみる / Reading "Guide to background processing"
e10dokup
0
330
Other Decks in Programming
See All in Programming
Are APIs Still Relevant in the AI Era?
soyuka
0
290
AWS Step Functions 大規模並列の壁を越える / jaws-sonic-2026-niigata-step-functions
kasacchiful
PRO
1
500
App Intentsのビルドプロセスを支える技術
kntkymt
0
420
GraphRAGのKnowledge Graphを 直接!見る/View-GraphRAG's-KnowledgeGraph-directly!
tyumugi1113
1
370
モデルのリファクタリングが難しいと思ったら、そもそも複雑だったのはビジネス仕様だった ? / is-the-business-domain-the-real-complexity
hatsu38
0
380
20260914 AIエージェント時代のPlatform Engineering LLM基盤とプロダクトの責務境界線
kanfab1
7
2.2k
thread_parallel_with_free-threaded_Python_and_NumPy.pdf
riku_sakamoto
0
350
テストを司るデーモンに会いに行く 〜隔離した仮想マシンでテストを通すまで〜
h1d3mun3
1
550
Omarchy Tokyo やると聞いて UMPC 買ってセットアップしてきた
mtsmfm
0
150
仕様駆動開発による爆速プロダクト開発 / Bakusoku Spec Driven Development
kobakei
0
120
The Past, Present, and Future of Enterprise Java
ivargrimstad
0
500
FreeBSDでZabbixを動かす
kenkino
0
320
Featured
See All Featured
The innovator’s Mindset - Leading Through an Era of Exponential Change - McGill University 2025
jdejongh
PRO
1
340
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
25
2.1k
Stewardship and Sustainability of Urban and Community Forests
pwiseman
0
530
Bioeconomy Workshop: Dr. Julius Ecuru, Opportunities for a Bioeconomy in West Africa
akademiya2063
PRO
1
360
Hiding What from Whom? A Critical Review of the History of Programming languages for Music
tomoyanonymous
3
1.3k
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
12
1.3k
Design of three-dimensional binary manipulators for pick-and-place task avoiding obstacles (IECON2024)
konakalab
0
600
Imperfection Machines: The Place of Print at Facebook
scottboms
270
14k
The Curse of the Amulet
leimatthew05
3
15k
Conquering PDFs: document understanding beyond plain text
inesmontani
PRO
4
3.1k
VelocityConf: Rendering Performance Case Studies
addyosmani
331
25k
Digital Projects Gone Horribly Wrong (And the UX Pros Who Still Save the Day) - Dean Schuster
uxyall
1
3k
Transcript
More Android Studio Debugger 〜あんなことできたんかお前〜 Cyber Agent Inc. Yoshihiro Wada
a.k.a. @e10dokup 2018/10/31 Shibuya.apk at Yahoo! LODGE
自己紹介 • Yoshihiro Wada a.k.a. @e10dokup • 大体左のアイコンで息をしています • CyberAgant
Inc. / Ameba • つい最近Ameba Blogを作ることになりました • カメラ沼 • 財布の透過率が高いのが最近の悩み
Android Studioのデバッガー、 ちゃんと扱えていますか
知っているとちょっと楽になるかもしれない デバッガーの使い方を見ていきましょう
「んなもん知ってるわい」 って方ごめんなさい。
まずはじめに
デバッガーの起動 • Debug ‘<module>’ でデバッグ用にアプリを実行する • Ctrl + D •
Attach Debugger to Android Processで起動中のアプリに デバッガーをアタッチする • デバッグ用に実行していなくても通常のRunでアタッチできる
いわゆるみんな知ってるBreakpoint • 普通のBreakpoint • コードの左をクリックして設定するやつ。Cmd + F8でも設定できる • デバッガーがアタッチされているアプリがBreakpointまで たどり着いたらそこでアプリが一時停止する
自分で設定したBreakpointの確認 • デバッガーからBreakpointsを呼び出すことで 自分の設定したBreakpointを一覧で確認できる • ここから一括ですべて消すことも可能 • Shift + Cmd
+ F8でも開けます • 一旦ブレークさせたくないときはミュートもできます
ブレークしたら • スタックトレースを確認したり、変数の状態を見たり変更したりできる
ステップオーバー・ステップイン・ステップアウト • 左から… • ステップオーバー:次の行に進む • ステップイン:指定しているメソッド・関数に入る • 強制ステップイン:ステップインで無視されているメソッド・関数に無理やり入る •
Android StudioのBuild, Execution, Deployment > Debugger > Stepping から無視するパッケージを設定できる。デフォルトはJDK由来のものとか • ステップオーバー:ステップインしたメソッド・関数から出る
式評価 • ブレーク時点で様々な式を実行して評価させることが できる • 実行時点のthisとかを呼ぶとブレークした瞬間の メソッド・関数を実行しているオブジェクトが 返ってくるので適当なメソッドでどうなるか試せる • 「このタイミングであの判定って成り立つんだっけ?」
みたいな確認ができて便利
流石にこの辺はみんな使ってそうですね
何もわからないが 「この画面で例外吐いてクラッシュした」 みたいな情報があるとき
Exception Breakpoint • 任意、ないしは指定のExceptionが発生した瞬間にブレークできる • 任意のExceptionでブレークするとき • Breakpoints画面から「Java Exception Breakpoints
> Any exception」を有効にする • 指定のExceptionでブレークするとき • Breakpoints画面から + ボタンで「Java Exception Breakpoints」を選んでException クラスを選択する
「とある条件下で意図しない挙動をしている」 とき
Condition Breakpoint • 設定した式の演算結果がtrueだったときにブレークする • 異常に長い文字列を入れたら挙動が変になった、とかリストに表示する要素数が大きくなった ら挙動が変になった、みたいなケースで有効
「起動後の画面でだけ変、 一回遷移すると大丈夫」 みたいなとき
Temporary Line Breakpoint • 最初にBreakpointに達したときのみブレークする • 一度通過したらそのBreakpointは無効になる • Remove once
hitを有効にすることで設定できる • Cmd + Opt + Shift + F8でも設定できる
「3回しか呼ばれないはずの処理が 不正に4回呼ばれている」 みたいなとき
PassCount Breakpoint • Breakpointに指定した回数到達したらブレークする • Pass Countが4なら4,8,12,…回目にブレークし、それ以外はブレークしない • APIの処理タイミングなどの都合で不正に仕様以上の回数実行される等のデバッグに便利
Breakpointでなにか処理を入れたいとき
Evaluation/Logging Breakpoint • Breakpointの実行直前に指定した処理を実行する • 文字列を入力するとデバッガー上にログが出力される • ブレークしているオブジェクトに適当な処理を実行させられる
Non-Suspend Breakpoint • 到達しても停止しないBreakpoint • Suspendを無効にすると到達時に停止しなくなる • 単体だと意味がない • Evaluation/Logging
Breakpointと組み合わせると自動で ログを出したり強制的に値を設定したりできる • 入力テキストや入力値を固定したり • 強制的にAPIの値を書き換えたり
最後に • 知っていると便利かもしれないデバッガの機能でした • Android ProfilerもAndroid Studio 3.2でまともになったのでAndroid Studioだけでも全然 デバッグに苦労しなくなってきた
• 以前はEditTextにフォーカスを当てた後に画面遷移するとAndroid Profilerのキー入力の ロガーが原因で無条件でクラッシュする不具合が… • Evaluate + Non-suspend Breakpointを思い出せるようにしておくとデバッグ時の入力がそ れなりに楽になるので個人的にはおすすめです