赞
踩
目录
18.2 ro.product.cpu.abilist 和 ro.product.cpu.abi 区别
28.2 根据包名(用monkey启动应用并输出activity)
Android Studio Unable to establish a connection to adb.
注意:很多命令仅支持单设备连接,如下:2、adb shell
adb devices
scc$ adb devices
List of devices attached
X1PVWP742B device
d13d7184 device
adb shell , 如果有多台设备会报错,因为不知道进入那台设备。
scc$ adb shell
adb: more than one device/emulator
scc$ adb shell
hncnbot_health_robot:/ $ 这就进来了
adb install <path_to_apk>
scc$ adb install /Users/scc/shenhua/ximalaya_app.apk
Performing Streamed Install
Success
scc$ 安装成功
adb uninstall <package_name>
scc$ adb uninstall com.ximalaya.ting.android
Success
scc$ 卸载成功
adb shell pm uninstall --user 0 包名
scc$ adb uninstall com.dangbei.tvlauncher
Failure [DELETE_FAILED_INTERNAL_ERROR](卸载失败)
scc$ adb shell pm uninstall --user 0 com.dangbei.tvlauncher
Success
scc$ adb shell pm list packagespackage:com.mgtv.tv
......(没有了)
adb push <设备路径> <本地路径>
scc$ adb pull /storage/emulated/0/DCIM/Screenshots/23.jpg /Users/scc/ThreeSDK/2.jpg
/storage/emulated/0/DCIM/Screenshots/2...ed. 34.6 MB/s (956637 bytes in 0.026s)
scc$ 复制成功
adb pull <本地路径> <设备路径>
scc$ adb push /Users/scc/ThreeSDK/2.jpg /storage/emulated/0/DCIM/Screenshots/24.jpg
/Users/scc/ThreeSDK/2.jpg: 1 file push...d. 125.7 MB/s (956637 bytes in 0.007s
scc$ 复制成功
adb logcat
- scc$ adb logcat
- --------- beginning of crash
- 01-03 16:55:58.373 14628 14655 E AndroidRuntime: FATAL EXCEPTION: RxCachedThreadScheduler-1
- 01-03 16:55:58.373 14628 14655 E AndroidRuntime: Process: com.ecare.healthhut, PID: 14628
- 01-03 16:55:58.373 14628 14655 E AndroidRuntime: io.reactivex.exceptions.UndeliverableException: The exception could not be delivered to the consumer because it has already canceled/disposed the flow or the exception has nowhere to go to begin with. Further reading: https://github.com/ReactiveX/RxJava/wiki/What's-different-in-2.0#error-handling | java.lang.UnsatisfiedLinkError: dlopen failed: library "libarcsoft_face_engine.so" not found
- 01-03 16:55:58.373 14628 14655 E AndroidRuntime: at io.reactivex.plugins.RxJavaPlugins.onError(RxJavaPlugins.java:367)
- 01-03 16:55:58.373 14628 14655 E AndroidRuntime: at io.reactivex.internal.schedulers.ScheduledRunnable.run(ScheduledRunnable.java:69)
- 01-03 16:55:58.373 14628 14655 E AndroidRuntime: at io.reactivex.internal.schedulers.ScheduledRunnable.call(ScheduledRunnable.java:57)
- 01-03 16:55:58.373 14628 14655 E AndroidRuntime: at java.util.concurrent.FutureTask.run(FutureTask.java:264)
- 01-03 16:55:58.373 14628 14655 E AndroidRuntime: at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:307)
- 01-03 16:55:58.373 14628 14655 E AndroidRuntime: at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1137)
- 01-03 16:55:58.373 14628 14655 E AndroidRuntime: at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:637)
- 01-03 16:55:58.373 14628 14655 E AndroidRuntime: at java.lang.Thread.run(Thread.java:1012)
- 01-03 16:55:58.373 14628 14655 E AndroidRuntime: Caused by: java.lang.UnsatisfiedLinkError: dlopen failed: library "libarcsoft_face_engine.so" not found
- 01-03 16:55:58.373 14628 14655 E AndroidRuntime: at java.lang.Runtime.loadLibrary0(Runtime.java:1077)
- 01-03 16:55:58.373 14628 14655 E AndroidRuntime: at java.lang.Runtime.loadLibrary0(Runtime.java:998)
- 01-03 16:55:58.373 14628 14655 E AndroidRuntime: at java.lang.System.loadLibrary(System.java:1661)
- 01-03 16:55:58.373 14628 14655 E AndroidRuntime: at com.arcsoft.face.FaceEngine.<clinit>(FaceEngine.java:876)
- 01-03 16:55:58.373 14628 14655 E AndroidRuntime: at com.arcsoft.face.FaceEngine.getRuntimeABI(FaceEngine.java:188)
- 01-03 16:55:58.373 14628 14655 E AndroidRuntime: at com.ecare.healthhut.base.RobotApplication.lambda$initFace$0(RobotApplication.java:414)
- 01-03 16:55:58.373 14628 14655 E AndroidRuntime: at com.ecare.healthhut.base.-$$Lambda$RobotApplication$KZ4KX66pOQkpN1C4AdF7p0_gBK4.subscribe(Unknown Source:0)
- 01-03 16:55:58.373 14628 14655 E AndroidRuntime: at io.reactivex.internal.operators.observable.ObservableCreate.subscribeActual(ObservableCreate.java:40)
- 01-03 16:55:58.373 14628 14655 E AndroidRuntime: at io.reactivex.Observable.subscribe(Observable.java:12197)
- 01-03 16:55:58.373 14628 14655 E AndroidRuntime: at io.reactivex.internal.operators.observable.ObservableSubscribeOn$SubscribeTask.run(ObservableSubscribeOn.java:96)
- 01-03 16:55:58.373 14628 14655 E AndroidRuntime: at io.reactivex.Scheduler$DisposeTask.run(Scheduler.java:578)
- 01-03 16:55:58.373 14628 14655 E AndroidRuntime: at io.reactivex.internal.schedulers.ScheduledRunnable.run(ScheduledRunnable.java:66)
- 01-03 16:55:58.373 14628 14655 E AndroidRuntime: ... 6 more
- 01-03 16:57:27.947 15156 15198 E AndroidRuntime: FATAL EXCEPTION: RxCachedThreadScheduler-1
-
- .............
adb reboot
adb shell screencap <file>
scc$ adb shell screencap /storage/emulated/0/DCIM/Screenshots/25.png
scc$ 截取成功
注意:后缀需要 .png 才行, .jpg 是个损坏文件(失败)。
adb shell wm size
scc$ adb shell wm size
Physical size: 1080x2400
adb shell wm density
scc$ adb shell wm density
Physical density: 440
scc$
adb shell cat /proc/meminfo
scc$ adb shell cat /proc/meminfo
MemTotal: 11877584 kB
MemFree: 410700 kB
MemAvailable: 4044952 kB
Buffers: 2172 kB
Cached: 3426048 kB
SwapCached: 340124 kB
Active: 5482004 kB
Inactive: 2158028 kB
Active(anon): 3706288 kB
Inactive(anon): 737084 kB
Active(file): 1775716 kB
Inactive(file): 1420944 kB
Unevictable: 173480 kB
Mlocked: 173480 kB
SwapTotal: 6291452 kB
SwapFree: 3800032 kB
Dirty: 600 kB
Writeback: 0 kB
AnonPages: 4295200 kB
Mapped: 1552836 kB
Shmem: 60056 kB
KReclaimable: 673412 kB
Slab: 662508 kB
SReclaimable: 255124 kB
SUnreclaim: 407384 kB
KernelStack: 129936 kB
PageTables: 187944 kB
NFS_Unstable: 0 kB
Bounce: 0 kB
WritebackTmp: 0 kB
CommitLimit: 12230244 kB
Committed_AS: 193739488 kB
VmallocTotal: 263061440 kB
VmallocUsed: 217820 kB
VmallocChunk: 0 kB
Percpu: 11072 kB
CmaTotal: 356352 kB
CmaFree: 0 kB
scc$
MemTotal: 总物理内存,即系统总共的内存大小。在这个例子中是 11,877,584 kB。
MemFree: 未被使用的物理内存。在这个例子中是 410,700 kB。
MemAvailable: 可用物理内存,系统实际可用的内存。在这个例子中是 4,044,952 kB。
Buffers: 缓冲区使用的内存。在这个例子中是 2,172 kB。
Cached: 缓存的内存,包括文件系统缓存等。在这个例子中是 3,426,048 kB。
SwapCached: 在交换空间中的缓存。在这个例子中是 340,124 kB。
Active: 活跃的内存,正在使用或者最近被使用的内存。在这个例子中是 5,482,004 kB。
Inactive: 不活跃的内存,最近没有被使用的内存。在这个例子中是 2,158,028 kB。
AnonPages: 匿名页,被进程使用的非文件 backed 的页。在这个例子中是 4,295,200 kB。
Mapped: 映射的内存,包括文件和设备映射的页。在这个例子中是 1,552,836 kB。
Shmem: 共享内存,用于进程间通信。在这个例子中是 60,056 kB。
Slab: 内核数据结构缓存的大小。在这个例子中是 662,508 kB。
CommitLimit: 内核允许使用的最大内存。在这个例子中是 12,230,244 kB。
Committed_AS: 当前系统为分配的页面的总和,即当前系统承诺提供的内存大小。在这个例子中是 193,739,488 kB。
VmallocTotal: 虚拟内存总大小。在这个例子中是 263,061,440 kB。
VmallocUsed: 已使用的虚拟内存。在这个例子中是 217,820 kB。
CmaTotal: 连续内存分配(Contiguous Memory Allocator)总大小。在这个例子中是 356,352 kB。
CmaFree: 空闲的连续内存分配。在这个例子中是 0 kB。
adb shell dumpsys meminfo <package_name> 其中,<package_name>
是应用程序的包名
- scc$ adb shell dumpsys meminfo com.charme.starnote
- Applications Memory Usage (in Kilobytes):
- Uptime: 593900112 Realtime: 766335532
-
- ** MEMINFO in pid 1050 [com.charme.starnote] **
- Pss Private Private SwapPss Rss Heap Heap Heap
- Total Dirty Clean Dirty Total Size Alloc Free
- ------ ------ ------ ------ ------ ------ ------ ------
- Native Heap 2110 2096 0 34331 3496 50988 47656 3331
- Dalvik Heap 2756 2728 0 3071 4580 13539 5347 8192
- Dalvik Other 2291 1524 0 2904 4184
- Stack 432 432 0 1324 444
- Ashmem 9 0 0 0 836
- Gfx dev 13764 13764 0 0 13764
- Other dev 21 0 20 0 440
- .so mmap 2527 332 216 1 37740
- .jar mmap 3583 0 1508 0 46120
- .apk mmap 2377 8 968 0 7028
- .ttf mmap 581 0 0 0 8928
- .dex mmap 16258 60 15680 0 18308
- .oat mmap 29 0 0 0 2296
- .art mmap 2232 2084 0 4374 11992
- Other mmap 131 8 16 0 1272
- GL mtrack 384 384 0 0 384
- Unknown 121 116 0 673 528
- TOTAL 96284 23536 18408 46678 162340 64527 53003 11523
-
- App Summary
- Pss(KB) Rss(KB)
- ------ ------
- Java Heap: 4812 16572
- Native Heap: 2096 3496
- Code: 18788 121920
- Stack: 432 444
- Graphics: 14148 14148
- Private Other: 1668
- System: 54340
- Unknown: 5760
-
- TOTAL PSS: 96284 TOTAL RSS: 162340 TOTAL SWAP PSS: 46678
-
- Objects
- Views: 483 ViewRootImpl: 1
- AppContexts: 11 Activities: 2
- Assets: 31 AssetManagers: 0
- Local Binders: 40 Proxy Binders: 51
- Parcel memory: 18 Parcel count: 50
- Death Recipients: 3 OpenSSL Sockets: 2
- WebViews: 0
-
- SQL
- MEMORY_USED: 202
- PAGECACHE_OVERFLOW: 64 MALLOC_SIZE: 46
-
- DATABASES
- pgsz dbsz Lookaside(b) cache Dbname
- 4 60 119 21/29/14 /data/user/0/com.charme.starnote/databases/bugly_db_
- 4 56 32 1/22/2 /data/user/0/com.charme.starnote/databases/com.google.android.datatransport.events
- scc$ 结束
adb shell dumpsys meminfo
提供详细的内存信息,包括应用程序、系统进程和缓存的内存使用情况。输出会包括各个应用程序的内存使用统计,缓存和系统进程的内存信息等。
- gongtiancideMacBook-Pro:~ scc$ adb shell dumpsys meminfo
- Applications Memory Usage (in Kilobytes):
- Uptime: 591674632 Realtime: 763964690
-
-
- Total RSS by process:
- 737,104K: system (pid 2029)
- 653,604K: com.UCMobile (pid 19848 / activities)
- 618,964K: com.tencent.mm (pid 9209)
- 515,708K: com.android.systemui (pid 3227)
- 418,092K: com.miui.home (pid 3255 / activities)
- 346,024K: com.android.camera (pid 31626)
- 304,284K: com.UCMobile:privileged_process0 (pid 28869)
- 284,884K: com.UCMobile:gpu_process (pid 28923)
- 283,600K: com.UCMobile:privileged_process1 (pid 29578)
- 269,688K: com.UCMobile:MediaPlayerService (pid 32226)
- 256,704K: com.android.phone (pid 3220)
- 。。。。。。
- Total RSS by OOM adjustment:
- 1,083,408K: Native
- 140,024K: surfaceflinger (pid 1247)
- 84,732K: android.hardware.camera.provider@2.4-service_64 (pid 1028)
- 75,088K: zygote64 (pid 902)
- 45,664K: webview_zygote (pid 3116)
- 34,320K: zygote (pid 903)
- 。。。。。。
- Total RSS by category:
- 3,208,500K: .jar mmap
- 2,955,536K: .so mmap
- 1,979,384K: Native
- 1,911,004K: .art mmap
- 1,589,472K: Dalvik
- 1,292,136K: .oat mmap
- 1,206,096K: .dex mmap
- 464,020K: .apk mmap
- 442,932K: Dalvik Other
- 323,448K: EGL mtrack
- 269,356K: Unknown
- 260,440K: Other mmap
- 221,244K: .ttf mmap
- 。。。。。。
- Total PSS by process:
- 929,598K: com.UCMobile (pid 19848 / activities)
- 502,455K: com.tencent.mm (pid 9209)
- 477,049K: com.android.systemui (pid 3227)
- 446,290K: system (pid 2029)
- 428,744K: com.miui.home (pid 3255 / activities)
- 232,065K: com.android.camera (pid 31626)
- 202,087K: com.sohu.inputmethod.sogou.xiaomi (pid 8357)
- 。。。。。。
- Total PSS by OOM adjustment:
- 782,009K: Native
- 142,311K: surfaceflinger (pid 1247)
- 133,713K: android.hardware.camera.provider@2.4-service_64 (pid 1028)
- 34,375K: vendor.qti.hardware.display.composer-service (pid 1067)
- 25,425K: android.hardware.audio.service (pid 1019)
- 23,895K: zygote (pid 903)
- 。。。。。。
-
-
- Total RAM: 11,877,584K (status normal)
- Free RAM: 5,368,689K ( 958,081K cached pss + 4,028,040K cached kernel + 382,568K free)
- ION: 489,328K ( 95,960K mapped + 393,368K unmapped + 0K pools)
- GPU: 0K
- Used RAM: 8,547,100K (7,276,352K used pss + 1,270,748K kernel)
- Lost RAM: 1,028,410K
- ZRAM: 736,588K physical used for 2,491,932K in swap (6,291,452K total swap)
- Tuning: 256 (large 512), oom 1,451,520K, restore limit 107,520K (high-end-gfx)
- scc$
Total RAM: 总共的物理内存。在这个例子中是 11,877,584KB(大约 11.33 GB)。
Free RAM: 可用的物理内存。在这个例子中是 5,368,689KB(大约 5.12 GB)。
ION: ION 内存使用情况。
GPU: GPU 占用的内存,这里是 0K。
Used RAM: 已使用的物理内存,包括应用程序使用的 PSS(Proportional Set Size,按照进程占用物理内存的比例分配的内存)和内核占用的内存。在这个例子中是 8,547,100KB。
Lost RAM: 由于各种原因丢失的内存,即未能被系统正常使用的内存。
ZRAM: 压缩内存(ZRAM)的使用情况。
Tuning: 调整参数,包括内存的分配策略、OOM(Out of Memory)的阈值等。
adb shell free
显示内存使用情况。包括物理内存和交换空间的总量、已使用和空闲量。
- scc$ adb shell free
- total used free shared buffers
- Mem: 12162646016 11356925952 805720064 64028672 2347008
- -/+ buffers/cache: 11354578944 808067072
- Swap: 6442446848 3425431552 3017015296
- scc$
Mem(内存):
-/+ buffers/cache:
Swap(交换空间):
adb shell dumpsys battery
scc$ adb shell dumpsys battery
Current Battery Service state:
AC powered: true
USB powered: false
Wireless powered: false
Max charging current: 1350000
Max charging voltage: 5000000
Charge counter: 2996529
status: 2
health: 2
present: true
level: 100
scale: 100
voltage: 4456
temperature: 340
technology: Li-poly
adb shell cat /proc/cpuinfo
- scc$ adb shell cat /proc/cpuinfo
- processor : 0
- BogoMIPS : 48.00
- Features : fp asimd evtstrm aes pmull sha1 sha2 crc32 atomics fphp asimdhp cpuid asimdrdm lrcpc dcpop asimddp
- CPU implementer : 0x41
- CPU architecture: 8
- CPU variant : 0x2
- CPU part : 0xd05
- CPU revision : 0
-
- processor : 1
- BogoMIPS : 48.00
- Features : fp asimd evtstrm aes pmull sha1 sha2 crc32 atomics fphp asimdhp cpuid asimdrdm lrcpc dcpop asimddp
- CPU implementer : 0x41
- CPU architecture: 8
- CPU variant : 0x2
- CPU part : 0xd05
- CPU revision : 0
-
- processor : 2
- BogoMIPS : 48.00
- Features : fp asimd evtstrm aes pmull sha1 sha2 crc32 atomics fphp asimdhp cpuid asimdrdm lrcpc dcpop asimddp
- CPU implementer : 0x41
- CPU architecture: 8
- CPU variant : 0x2
- CPU part : 0xd05
- CPU revision : 0
-
- processor : 3
- BogoMIPS : 48.00
- Features : fp asimd evtstrm aes pmull sha1 sha2 crc32 atomics fphp asimdhp cpuid asimdrdm lrcpc dcpop asimddp
- CPU implementer : 0x41
- CPU architecture: 8
- CPU variant : 0x2
- CPU part : 0xd05
- CPU revision : 0
-
- Hardware : Rockchip RK3566 RK817 TABLET LP4X Board
- Serial : 86dfc3e7b1f23439
其中 processor 的数量代表这有几个处理器 这里是4个 也就是4核。
Hardware 表示CPU型号:
adb shell getprop <属性> ,例如 :
adb shell getprop ro.product.model
scc$ adb shell getprop ro.product.model
M2012K11AC
adb shell getprop ro.build.version.release
scc$ adb shell getprop ro.build.version.release
13
属性 | 含义 |
ro.build.version.sdk | SDK 版本 |
ro.build.version.release | Android 系统版本 |
ro.build.version.security_patch | Android 安全补丁程序级别 |
ro.product.model | 型号 |
ro.product.brand | 品牌 |
adb shell getprop ro.debuggable | 是否已 root |
persist.sys.isUsbOtgEnabled | 是否支持 OTG |
dalvik.vm.heapsize | 每个应用程序的内存上限 |
ro.sf.lcd_density | 屏幕密度 |
ro.product.cpu.abilist | CPU 支持的 abi 列表 |
ro.product.cpu.abi | CPU 支持位数(32还是64) |
ro.product.name | 设备名 |
persist.sys.locale | 设备的语言 |
ro.serialno | 序列号 |
ro.product.cpu.abi:
该命令返回的是海思芯片是32位还是64位。例如,如果设备的主要 CPU 架构是 ARM,则返回的值可能是 "arm64-v8a" 或 "armeabi-v7a"。
ro.product.cpu.abilist:
该命令返回的是设备支持的所有 CPU 架构。设备可能支持多个 CPU 架构,这些架构在一个以逗号分隔的字符串中列出。
- scc$ adb shell getprop ro.product.cpu.abi
- arm64-v8a
- scc$ adb shell getprop ro.product.cpu.abilist
- arm64-v8a,armeabi-v7a,armeabi
adb shell pm list packages -3
scc$ adb shell pm list packages -3
package:com.ecare.healthhut
package:com.tencent.qqmusiccar
package:com.ximalaya.ting.android.car
package:com.qiyi.video.speaker
package:me.chunyu.ChunyuDoctor
package:com.netease.cloudmusic
scc$
adb shell pm list packages
gongtiancideMacBook-Pro:~ scc$ adb shell pm list packages
package:com.android.cts.priv.ctsshim
package:com.android.internal.display.cutout.emulation.corner
package:com.android.internal.display.cutout.emulation.double
package:com.android.providers.telephony
package:com.android.dynsystem
package:com.android.theme.color.amethyst
package:com.android.theme.icon.pebble
package:com.android.providers.calendar
package:com.android.providers.media
package:com.android.internal.systemui.navbar.gestural_wide_back
...
package:com.android.launcher3
package:com.android.backupconfirm
package:com.android.provision
package:com.android.statementservice
package:com.ecare.healthhut
package:com.android.cndamon
package:com.android.theme.icon_pack.sam.settings
package:com.android.settings.intelligence
package:com.android.calendar
adb shell am monitor(只有在启动或退出的时候才会打印)
scc$ adb shell am monitor
Monitoring activity manager... available commands:
(q)uit: finish monitoring
** Activity starting: com.ximalaya.ting.android.car
** Activity starting: com.ximalaya.ting.android.car
** Activity resuming: com.ximalaya.ting.android.car
** Activity starting: com.iflytek.inputmethod
** Activity starting: com.iflytek.inputmethod
** Activity resuming: com.iflytek.inputmethod
** Activity starting: com.iflytek.inputmethod
** Activity resuming: com.iflytek.inputmethod
com.ximalaya.ting.android.car 和 com.iflytek.inputmethod 就是包名,输入 q 退出。
adb shell am force-stop com.iflytek.inputmethod
其中 com.iflytek.inputmethod 就是要要关闭的软件包名
(查找三方应用)scc$ adb shell pm list packages -3
package:com.sohu.inputmethod.sogou
package:com.dianshijia.newlive
package:com.ecare.healthhut
package:com.qiyi.video.speaker
package:com.ximalaya.ting.android
package:me.chunyu.ChunyuDoctor
package:com.ecare.healthhutorion
(输出路径)scc$ adb shell pm path me.chunyu.ChunyuDoctor
package:/vendor/operator/app/chunyuyisheng/chunyuyisheng.apk
(导出)scc$ adb pull /vendor/operator/app/chunyuyisheng/chunyuyisheng.apk /Users/scc/shenhua/ziyanapk
/vendor/operator/app/chunyuyisheng/chu.... 14.3 MB/s (48741246 bytes in 3.258s)
scc$
adb shell am force-stop com.android.settings
adb shell pm clear com.android.settings
adb shell top -m 3
- Tasks: 910 total, 2 running, 908 sleeping, 0 stopped, 0 zombie
- Mem: 11599M total, 10587M used, 1011M free, 2M buffers
- Swap: 6143M total, 3474M used, 2669M free, 3445M cached
- 800%cpu 108%user 1%nice 48%sys 635%idle 0%iow 7%irq 2%sirq 0%host
- PID USER PR NI VIRT RES SHR S[%CPU] %MEM TIME+ ARGS
- 2969 u0_a149 20 0 6.4G 79M 52M R 100 0.6 1457:55.2 com.miui.miwall+
- 28985 u0_a235 20 0 64G 247M 247M S 12.3 2.1 5:13.35 com.dianping.v1
- 2029 system 18 -2 12G 337M 337M S 11.3 2.9 1086:51.7 system_server
adb shell top -n 2
- Tasks: 914 total, 3 running, 911 sleeping, 0 stopped, 0 zombie
- Mem: 11599M total, 10603M used, 996M free, 2M buffers
- Tasks: 914 total, 2 running, 912 sleeping, 0 stopped, 0 zombie
- Mem: 11599M total, 10618M used, 981M free, 2M buffers
- Swap: 6143M total, 3415M used, 2728M free, 3465M cached
- 800%cpu 110%user 0%nice 36%sys 645%idle 0%iow 7%irq 2%sirq 0%host
- PID USER PR NI VIRT RES SHR S[%CPU] %MEM TIME+ ARGS
- 2969 u0_a149 20 0 6.4G 79M 52M R 99.6 0.6 1459:44.8 com.miui.miwall+
- 28985 u0_a235 20 0 64G 248M 248M S 11.6 2.1 5:33.96 com.dianping.v1
- 1247 system -2 -8 2.8G 35M 23M S 5.6 0.3 716:23.16 surfaceflinger
- 2029 system 18 -2 12G 337M 337M S 4.0 2.9 1086:58.9 system_server
- 32069 u0_a241 20 0 83G 236M 236M S 3.3 2.0 3:47.79 com.UCMobile
- 22937 root 20 0 0 0 0 I 2.6 0.0 0:02.89 [kworker/u16:16+
- 901 root 20 0 2.5G 7.3M 4.4M S 2.0 0.0 26:53.27 netd
- 24786 shell 20 0 2.2G 6.1M 5.0M S 1.6 0.0 0:03.47 adbd --root_sec+
- 14353 root 20 0 0 0 0 I 1.6 0.0 0:25.75 [kworker/u16:13+
- 28037 root 20 0 0 0 0 I 1.3 0.0 0:07.64 [kworker/u16:18+
- 4915 u0_a137 20 0 6.8G 45M 45M S 1.3 0.3 192:26.88 com.miui.voicet+
- 1067 system -3 -8 2.4G 492K 492K S 1.3 0.0 104:22.21 vendor.qti.hard+
- 1052 system 20 0 2.6G 4.1M 3.0M S 1.3 0.0 87:14.21 android.hardwar+
- 25877 shell 20 0 2.1G 5.5M 3.7M R 1.0 0.0 0:00.06 top -n 2
- 31906 root 20 0 0 0 0 I 1.0 0.0 0:08.80 [kworker/u16:4-+
- 409 root RT 0 0 0 0 D 1.0 0.0 84:15.57 [crtc_commit:12+
- 288 root -3 0 0 0 0 S 1.0 0.0 48:42.85 [kgsl_worker_th+
- 25179 root 0 -20 0 0 0 I 0.6 0.0 0:00.74 [kworker/u17:2-+
- 11473 root 0 -20 0 0 0 I 0.6 0.0 0:01.95 [kworker/u17:7-+
- scc$
adb shell dumpsys package 包名
adb shell am start 包名/绝对activity路径
- scc$ adb shell am start com.tumuyan.fixedplay/com.tumuyan.fixedplay.MainActivity
- Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=com.tumuyan.fixedplay/.MainActivity }
adb shell monkey -p 包名 -v -v -v 1 | findstr "cmp="
- scc$ adb shell monkey -p com.tumuyan.fixedplay -v -v -v 1 | findstr "cmp="
-
- -bash: findstr: command not found
-
- ^[[Aargs: [-p, com.tumuyan.fixedplay, -v, -v, -v, 1]
-
- arg: "-p"
-
- arg: "com.tumuyan.fixedplay"
-
- arg: "-v"
-
- arg: "-v"
-
- arg: "-v"
-
- arg: "1"
-
- data="com.tumuyan.fixedplay"
-
- scc$
执行 Activity Manager (AM) 命令,比如启动 Activity、广播等。
执行 Package Manager (PM) 命令,如安装、卸载、禁用应用等。
将设备端口与本地端口进行转发,用于调试和测试。
模拟用户输入,比如触摸、按键操作等。
adb shell input tap x y
其中,x
和 y
是屏幕上的坐标值。
adb shell input swipe x1 y1 x2 y2 [duration(ms)]
其中 x1
、y1
是起始点坐标,x2
、y2
是终止点坐标,可选的 duration
参数表示滑动的时间(毫秒)。
adb shell input keyevent <key_code>
其中 key_code
是按键的代码,比如 KEYCODE_BACK 表示 返回键。
adb shell input text "android"
模拟文本输入,其中 android 是你想要输入的文本。
杀死adb服务:adb kill-server
重启adb服务:adb start-server
netstat -aon|findstr "5037"
netstat -a -n -o |findstr "5037"
这两个命令都可以,且是Windows命令,它的作用是查找使用5037端口的进程ID。这个命令不适用于Linux、Mac或Unix系统,这就是为什么你看到“command not found”的错误。
5037 这是adb要的端口,有时候会被其他进程(程序)占用了(一般是会连接手机的软件),所以要查询是谁占用了,然后就可以Kill(停止)它;
根据上图然后输入taskkill /pid 12296/f (12296就是占用此端口的进程id),需要注意的是 有时候会查询到很多的进程(我一般选第一个,不行的话全部试一次),必须提示成功关闭才可行。
如果上面方法不行关闭电脑防火墙重启Android Studio试试。
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。