Android Performance and Monitoring
Android performance and monitoring: profiling, memory, ANR, optimization, and diagnostic tools
1What is Android Profiler and what are its 4 modules?
What is Android Profiler and what are its 4 modules?
답변
Android Profiler is a tool integrated into Android Studio that analyzes your app's real-time performance. It helps detect CPU, memory, network, and battery issues to optimize your app. Its 4 modules are: CPU Profiler (CPU usage and call traces), Memory Profiler (heap and allocations tracking), Network Profiler (network requests and bandwidth usage), and Energy Profiler (battery consumption and wake locks).
2How does LeakCanary detect and report memory leaks in Android?
How does LeakCanary detect and report memory leaks in Android?
답변
LeakCanary is a library that automatically monitors objects expected to be garbage-collected (like a destroyed Activity or Fragment). If an object remains in memory when it shouldn't, LeakCanary detects the leak, analyzes the retention chain, and displays a notification with likely causes and the stack trace.
3What is StrictMode in Android and what is it used for?
What is StrictMode in Android and what is it used for?
답변
StrictMode is a detection tool used to identify bad practices that might block the main thread, such as disk or network operations on the UI thread. It's usually enabled in development with StrictMode.setThreadPolicy() and StrictMode.setVmPolicy(), often wrapped in BuildConfig.DEBUG. When a violation is detected, it can log warnings, throw exceptions, or show alerts to help fix the issue before production.
What is the Layout Inspector in Android Studio and what is it used for?
What is Systrace in Android and what is it used for?
+10 면접 질문