Created
June 29, 2020 08:03
-
-
Save iniyanmurugavel/d1fe48b6bb0f654c690d5c13b8371687 to your computer and use it in GitHub Desktop.
Android Debug Bridge (adb) Useful things
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Android Debug Bridge (adb) is a versatile command-line tool that lets you communicate with a device. The adb command facilitates a variety of device actions, such as installing and debugging apps, and it provides access to a Unix shell that you can use to run a variety of commands on a device. It is a client-server program that includes three components: | |
| adb is included in the Android SDK Platform-Tools package. You can download this package with the SDK Manager, which installs it at android_sdk/platform-tools/ | |
| apkanalyzer -h apk file-size myapk.apk --human-readable | |
| apkanalyzer is included in the Android SDK Tools package and located at android_sdk/tools/bin/apkanalyzer. | |
| dmtracedump | |
| dumpsys | |
| dumpsys is a tool that runs on Android devices and provides information about system services. You can call dumpsys from the command line using the Android Debug Bridge (ADB) to get diagnostic output for all system services running on a connected device. This output is typically more verbose than you may want, so use the command line options | |
| adb shell dumpsys [-t timeout] | |
| adb shell dumpsys -l | |
| adb shell dumpsys -l --skipservices | |
| In Android, application responsiveness is monitored by the Activity Manager and Window Manager system services. Android will display the ANR dialog for a particular application when it detects one of the following conditions: | |
| No response to an input event (such as key press or screen touch events) within 5 seconds. | |
| A BroadcastReceiver hasn't finished executing within 10 seconds. | |
| What triggers ANR? | |
| Generally, the system displays an ANR if an application cannot respond to user input. For example, if an application blocks on some I/O operation (frequently a network access) on the UI thread so the system can't process incoming user input events. Or perhaps the app spends too much time building an elaborate in-memory structure or computing the next move in a game on the UI thread. It's always important to make sure these computations are efficient, but even the most efficient code still takes time to run. | |
| Generally, 100 to 200ms is the threshold beyond which users will perceive slowness in an application. | |
| If your application is doing work in the background in response to user input, show that progress is being made (such as with a ProgressBar in your UI). | |
| If your application has a time-consuming initial setup phase, consider showing a splash screen or rendering the main view as quickly as possible, indicate that loading is in progress and fill the information asynchronously. In either case, you should indicate somehow that progress is being made, lest the user perceive that the application is frozen. | |
| Use performance tools such as Systrace and Traceview to determine bottlenecks in your app's responsiveness. | |
| Traceview is deprecated. If you're using Android Studio 3.2 or later, you should instead use CPU Profiler to inspect .trace files captured by instrumenting your app with the Debug class, record new method traces, save .trace files, and inspect real-time CPU usage of your app's processes. | |
| Traceview is a tool that provides a graphical representations of trace logs. You can generate the logs by instrumenting your code with the Debug class. This method of tracing is very precise because you can specify exactly where in the code you want to start and stop logging trace data. If you haven't yet generated these trace logs and saved them from your connected device to your local machine, go to Generate trace logs by instrumenting your app. Inspecting these logs using Traceview helps you debug your app and profile its performance. | |
| Tip: You can use dmtracedump from the command-line to generate a graphical call-stack diagrams of your trace log files. | |
| Internal Storage(GT) location would be: /data/data/your.application.package.appname/someDirectory/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment