安卓猴子 : "No activities found to run, monkey aborted"

标签 android android-monkey

我的包名为 com.mywebsite.banana。

  • 我想要一个种子,所以测试是可重复的:-s 13
  • 我想要相当低的冗长程度:-v
  • 我想运行 500 个伪随机命令:500

我这样称呼猴子:

adb shell monkey -s 13 -p com.mywebsite.banana -v 500

我的输出:

:Monkey: seed=13 count=500
:IncludeCategory: android.intent.category.LAUNCHER
:IncludeCategory: android.intent.category.MONKEY
No activities found to run, monkey aborted

我的 AndroidManifest.xml 中有这个:

<categoy android:name="android.intent.category.LAUNCHER"/>

我做错了什么?在运行猴子之前,我需要在我的应用程序中添加什么吗?主要 Activity 位于 com.mywebsite.banana - 是要传递的正确路径,还是应该像这样一直到 Activity :com.mywebsite.banana.activityName?

从我读到的内容来看,我似乎做对了:


编辑

尝试 1:

adb shell monkey -p com.mywebsite.banana -c intent.CATEGORY_LAUNCHER -v 500

结果 1:

:Monkey: seed=13 count=500
:AllowPackage: com.mywebsite.banana
:IncludeCategory: intent.CATEGORY_LAUNCHER  
// Warning: no activities found for category intent.CATEGORY_LAUNCHER
** No activities found to run, monkey aborted

尝试 2:

adb shell monkey -p com.mywebsite.banana -c android.intent.category.MONKEY -v 500

结果 2:

:Monkey: seed=13 count=500
:AllowPackage: com.mywebsite.banana
:IncludeCategory: android.intent.category.MONKEY 
No activities found to run, monkey aborted

尝试 3:

adb shell monkey -p com.mywebsite.banana -c android.intent.category.LAUNCHER -c android.intent.category.MONKEY -v 500

结果 3:

:Monkey: seed=13 count=500
:AllowPackage: com.mywebsite.banana
:IncludeCategory: android.intent.category.LAUNCHER
:IncludeCategory: android.intent.category.MONKEY 
No activities found to run, monkey aborted

一些 list :

<activity
        android:name="com.mywebsite.banana.FRCActivity"
        android:launchMode="singleTask"
        android:configChanges="orientation|screenSize"
        android:label="@string/app_name" >
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
        <intent-filter>
            <action android:name="none" />
            <category android:name="android.intent.category.MONKEY"/>
        </intent-filter>
</activity>

还尝试了这个版本的 list ,没有任何变化:

    <activity
        android:name="com.mywebsite.banana.FRCActivity"
        android:launchMode="singleTask"
        android:configChanges="orientation|screenSize"
        android:label="@string/app_name" >
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
            <category android:name="android.intent.category.MONKEY"/>
        </intent-filter>
</activity>

最佳答案

好的!我想通了。显示的错误确实是正确的:

** No activities found to run, monkey aborted

这意味着我使用的包名称不正确。我盯着看啊盯着,最后我的同事提到我们的构建系统在将包推送到设备之前更改了包的名称

因此,如果您遇到此错误,请确保您确实知道您的包的名称

所以,最后一个有效的命令是这样的:

$ adb shell monkey -p com.mywebsite.banana.newname -v 5

顺便说一下,这个 monkey 命令的正确输出如下所示:

:Monkey: seed=1418671144561 count=5
:AllowPackage: com.mywebsite.banana.newname
:IncludeCategory: android.intent.category.LAUNCHER
:IncludeCategory: android.intent.category.MONKEY
// Event percentages:
//   0: 15.0%
//   1: 10.0%
//   2: 2.0%
//   3: 15.0%
//   4: -0.0%
//   5: 25.0%
//   6: 15.0%
//   7: 2.0%
//   8: 2.0%
//   9: 1.0%
//   10: 13.0%
:Switch: #Intent;action=android.intent.action.MAIN;category=android.intent.category.LAUNCHER;launchFlags=0x10200000;component=com.mywebsite.banana.newname/com.mywebsite.banana.MyActivity;end
// Allowing start of Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=com.mywebsite.banana.newname/com.mywebsite.banana.MyActivity } in package com.mywebsite.banana.newname
Events injected: 5
:Sending rotation degree=0, persist=false
:Dropped: keys=0 pointers=0 trackballs=0 flips=0 rotations=0
## Network stats: elapsed time=175ms (0ms mobile, 0ms wifi, 175ms not connected)
// Monkey finished

最后一点:我不需要将 android.intent.category.MONKEY 添加到我的 AndroidManifest.xml 文件中!

关于安卓猴子 : "No activities found to run, monkey aborted",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27137905/

相关文章:

android - 错误: Program type already present: com.fasterxml.jackson.core.Base64Variant

android - Intellij android studio 新手,无法打开示例项目而没有 Gradle 错误

android - 如何使用 android.intent.category 过滤要由猴子测试的特定 Activity ?

Android Exerciser Monkey 开始随机播放音频文件

android - java.lang.IllegalStateException : Could not execute method for android:onClick 错误

Android Room - 插入密封类列表..或任何东西

android - React Native RCTNetworking.sendRequest 有 6 个参数,预期为 7

Android 猴子在 Spinner 中触发 NullPointerException

android - 在多个设备上启动 monkeyrunner 脚本

android - 如何从 Android 应用程序运行猴子