Development record of developer who study hard everyday.

레이블이 adb인 게시물을 표시합니다. 모든 게시물 표시
레이블이 adb인 게시물을 표시합니다. 모든 게시물 표시
, ,

How to watch CPU usage using adb in android

 How to watch CPU usage using adb in android


1. Show CPU usage respectively in apps.

adb shell top -n 1 -s cpu


->details about top options

-m num : Maximum number of processes to display

-n num : Updates to show before exiting

-d num : Seconds to wait between updates

-s col : Column to sort by (cpu, vss, rss, thr)

-H : Show threads instead of prcesses

-h : Display this help screen


2. Show CPU usage in specific app

adb shell top -n 60 -d 1 | FINDSTR <package name>

This command shows CPU usages during 60 seconds by 1 second.





Share:
Read More
,

Useful ADB shortkeys

Useful ADB shortkeys



Android Debug Bridge(ADB) is CLI tool which communicate with device.
Android SDK Platform includes ADB package.


- Move directory

adb shell cd "path"


- Reboot device

adb reboot


- Show connected devices

adb devices


- Start server

adb start-server


- Kill server

adb kill-server


- Exectue command to specific device

adb -s "example device name" "example command"


- Connect wifi (Available Under Android 10)

adb connect "example device ip address"


- Move file to device

adb push "example local file" "example device directory"


- Take device file to local

adb pull "example device file" "example local directory"


- Get writing and reading permission

adb shell mount -o remount,rw /system


- Turn on wifi

adb shell svc wifi enable


-Turn off wifi

adb shell svc wifi disable


- Turn on mobile data

adb shell svc data enable


- Turn off mobile data

adb shell svc data disable


- Change device's date

1) adb shell "su 0 toybox date 042523592021.59"
(toybox date use MMDDhhmm[[CC]YY][.ss] format)

2) adb shell "su 0 toolbox date -s 20210425.235959"
(toolbox date use YYYYMMDD.HHmmss format)


- Symbolic link

adb shell ln -sf "example original file" "example target file"


- Show system property list

adb shell getprop


- Start activity

adb shell am start -a android.intent.action.MAIN -n "example/package/activity_name"


- Start service

adb shell am startservice -n "example/package/service_name"


- Start broadcast

adb shell am broadcast -a "example broadcast name"


- Start Broadcast extra

1) adb shell am broadcast -a $(example_action_name) -es ${example_extra_key} ${example_extra_string_value}

2) adb shell am broadcast -a $(example_action_name) -ez ${example_extra_key} $(extra_boolean_value)

3) adb shell am broadcast -a $(example_action_name) -ei $(example_extra_key) $(example_extra_int_value)


- Verify specific package's PID

adb shell pidof "example package name"


-Kill Process

adb shell am force-stop "example package name"
adb shell kill -9 PID (Available only if root)


- Show installed packages

adb shell cmd package list packages


- Find package's path

adb shell pm path "example package name"


- Screen capture

adb shell screencap -p /sdcard/Download/"example file name"
adb pull /sdcard/Download/"example file name" "local directory"


- Remove file

adb shell rm "example file"


- Remove directory

adb shell -r "example file"





Share:
Read More
, ,

Sloved "command not found:adb" on M1

 How to solve "command not found:adb" error on M1

Android develop blog

I am using M1 when developing android app.

But when I execute adb command, I encounter error message, "command not found: adb".

This is because you did not set environmental variable.


The Solution is...

1. Open terminal

2. Open the vi editor

Command is "vi ~/.zshrc"

3. enter environmental variables

export PATH=$PATH:~/Library/Android/sdk/platform-tools
export ANDROID_HOME=~/Library/Android/sdk
export PATH="$HOME/.bin:$PATH"
export PATH="~/Library/Android/sdk/platform-tools":$PATH

4. Run .zshrc

Command is "source ~/.zshrc"









Share:
Read More