安卓:使用关键词猴 [英] Android: Using Categories in Monkey

查看:563
本文介绍了安卓:使用关键词猴的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我如何使用猴子的类别选项工具?

我的清单文件的有关部分是这样的:

The relevant portion of my manifest file looks like this:

   <application android:icon="@drawable/icon" android:label="@string/app_name" android:name="MyApp" android:debuggable="true" android:allowBackup="false" android:testOnly="false">
        <activity android:name="MyLauncherActivity" android:label="@string/app_name" android:screenOrientation="portrait">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <activity android:name="MyMainActivity" android:label="@string/app_name" android:screenOrientation="portrait">
            <intent-filter>
                <action android:name="none" />
                <category android:name="android.intent.category.MONKEY" />
            </intent-filter>
        </activity>

我在我的手机上运行的应用程序,以确保其工作正常,然后我进入这个在命令行:

I run the application on my phone to make sure it is working then I enter this at the command line:

adb shell monkey -p my.full.package.path -vvv 3

它工作得很好。

It works just fine.

但是,这并不工作:​​

But this doesn't work:

adb shell monkey -p my.full.package.path -c intent.CATEGORY_LAUNCHER -vvv 3

和产生以下的输出:

:Monkey: seed=0 count=3

:AllowPackage: myapp.full.package.path

:IncludeCategory: intent.CATEGORY_LAUNCHER

// Warning: no activities found for category intent.CATEGORY_LAUNCHER

** No activities found to run, monkey aborted.

和尝试一些变体还没有工作:

And trying some variants also didn't work:

    :Monkey: seed=0 count=3

:AllowPackage: my.full.package.path

:IncludeCategory: CATEGORY_MONKEY

:IncludeCategory: intent.CATEGORY_MONKEY

:IncludeCategory: android.intent.MONKEY

:IncludeCategory: android.intent.category.MONKEY

:IncludeCategory: MONKEY

// Warning: no activities found for category CATEGORY_MONKEY

// Warning: no activities found for category intent.CATEGORY_MONKEY

// Warning: no activities found for category android.intent.MONKEY

// Warning: no activities found for category MONKEY

** No activities found to run, monkey aborted.

如何指定类别

How do I specify categories

推荐答案

您真的很接近。这为我工作:

You're really close. This worked for me:

adb shell monkey -p com.JamesBecwar.test -c android.intent.category.LAUNCHER -vvv 3

我认为这个问题是你需要包括启动过,因为如果不这样做的猴子无法启动该程序。别担心,你可以把更多然后一个-c参数。例如,你可以这样做:

I think the problem is that you need to include the Launcher too, because if you don't monkey can't start the program. Don't worry you can put more then one -c param. For example you could do:

adb shell monkey -p com.JamesBecwar.test -c android.intent.category.LAUNCHER -c android.intent.category.MONKEY -vvv 3

和它应该工作。

这篇关于安卓:使用关键词猴的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆