我正在尝试使用猴子测试一些 Android 应用程序。但事实证明,使用 Monkey 进行测试并不总是那么直观,因为它并不像人们所期望的那样开箱即用。我什至读到其他一些人也遇到了类似的问题,尽管遵循了这些评论并没有清楚地解决这个问题。
因此,为了运行 Monkey,我将 LAUNCHER 包含在 AndroidManifest.xml 中:
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
事实上,当我使用来自 Android 文档源的示例之一时,将 LunarLander 作为项目名称,我尝试了该命令的所有可能组合,但徒劳无功:
$ cd /home/user
$ adb shell monkey -p LunarLander -v 3
$ adb shell monkey -p lunarlander -v 3
$ adb shell monkey -p "LunarLander" -v 3
$ adb shell monkey -p "lunarlander" -v 3
然后,我还将 MONKEY 包含在 AndroidManifest 中:
<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>
在命令行中我再次尝试:
$ adb shell monkey -p lunarlander -v 3
:Monkey: seed=1398534940718 count=3
:AllowPackage: LunarLander
:IncludeCategory: android.intent.category.LAUNCHER
:IncludeCategory: android.intent.category.MONKEY
** No activities found to run, monkey aborted.
同样,我尝试了其他建议,结果相同:
$ adb shell monkey -p lunarlander.client -v 3
:Monkey: seed=1398537535683 count=3
:AllowPackage: lunarlander.client
:IncludeCategory: android.intent.category.LAUNCHER
:IncludeCategory: android.intent.category.MONKEY
** No activities found to run, monkey aborted.
但它仍然不起作用。有什么想法或建议可能会丢失吗?