You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

小米设备执行Monkey命令报错:未找到可运行活动,Monkey终止

解决小米设备Monkey命令报错「No activities found to run, monkey aborted」的问题

问题场景

在小米设备上执行以下Monkey命令时,出现「No activities found to run, monkey aborted」错误,但相同命令在三星设备可正常运行:

C:\Users\naresh>adb -s <deviceID> shell monkey -p com.an.biometric.sample -c android.intent.category.LAUNCHER 1
  bash arg: -p
  bash arg: com.an.biometric.sample
  bash arg: -c
  bash arg: android.intent.category.LAUNCHER
  bash arg: 1
args: [-p, com.an.biometric.sample, -c, android.intent.category.LAUNCHER, 1]
 arg: "-p"
 arg: "com.an.biometric.sample"
 arg: "-c"
 arg: "android.intent.category.LAUNCHER"
 arg: "1"
data="com.an.biometric.sample"
data="android.intent.category.LAUNCHER"
** No activities found to run, monkey aborted.

解决方案

  • 确认应用已正确安装
    先检查目标包是否存在于小米设备中,执行命令:

    adb -s <deviceID> shell pm list packages | findstr com.an.biometric.sample
    

    若无输出,说明应用未安装,重新安装后再尝试。

  • 校验LAUNCHER Activity配置
    MIUI对应用的Intent Filter校验更严格,需确保AndroidManifest.xml中主Activity同时配置android.intent.action.MAIN和android.intent.category.LAUNCHER,且Android 12+需设置android:exported="true":

    <activity
        android:name=".MainActivity"
        android:exported="true">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
    
  • 临时跳过LAUNCHER类别限制
    去掉-c android.intent.category.LAUNCHER参数,执行命令:

    adb -s <deviceID> shell monkey -p com.an.biometric.sample 1
    

    若能正常运行,说明问题出在LAUNCHER类别的匹配上,需重新检查Activity配置。

  • 关闭MIUI应用管控权限
    进入小米设备「设置」-「隐私保护」-「权限管理」,找到目标应用,开启「显示在其他应用上层」「后台弹出界面」权限,或暂时关闭应用管控开关后重试。

  • 直接指定主Activity运行
    若已知主Activity路径,可直接指定运行:

    adb -s <deviceID> shell monkey -p com.an.biometric.sample -c android.intent.category.LAUNCHER -f com.an.biometric.sample.MainActivity 1
    

    或先启动Activity再执行Monkey:

    adb -s <deviceID> shell am start -n com.an.biometric.sample/.MainActivity
    adb -s <deviceID> shell monkey -p com.an.biometric.sample 1
    

内容的提问来源于stack exchange,提问作者naresh

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.16 07:10:33