My package is named com.mywebsite.banana.
I'm calling monkey like this:
adb shell monkey -s 13 -p com.mywebsite.banana -v 500
My output:
:Monkey: seed=13 count=500
:IncludeCategory: android.intent.category.LAUNCHER
:IncludeCategory: android.intent.category.MONKEY
No activities found to run, monkey aborted
My AndroidManifest.xml has this in it:
<categoy android:name="android.intent.category.LAUNCHER"/>
What am I doing wrong? Is there something I need to add to my app before running the monkey? The main activity is located in com.mywebsite.banana - is that the correct path to be passed in, or should it go all the way to the activity like this: com.mywebsite.banana.activityName?
From what I've read, it seems as though I'm doing this correctly:
Edit
Attempt 1:
adb shell monkey -p com.mywebsite.banana -c intent.CATEGORY_LAUNCHER -v 500
Result 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
Attempt 2:
adb shell monkey -p com.mywebsite.banana -c android.intent.category.MONKEY -v 500
Result 2:
:Monkey: seed=13 count=500
:AllowPackage: com.mywebsite.banana
:IncludeCategory: android.intent.category.MONKEY
No activities found to run, monkey aborted
Attempt 3:
adb shell monkey -p com.mywebsite.banana -c android.intent.category.LAUNCHER -c android.intent.category.MONKEY -v 500
Result 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
Some of the manifest:
<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>
Also tried this version of the manifest, with no change:
<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>
OK! I figured this out. The error that is shown is indeed correct:
** No activities found to run, monkey aborted
This means that the package name I was using was incorrect. I stared and stared and stared, and finally my colleague mentioned that our build system changes the name of the package before pushing it to the device
So, if you are getting this error, make sure you actually know what the name of your package is.
So, the final command that worked was this:
$ adb shell monkey -p com.mywebsite.banana.newname -v 5
By the way, correct output from this monkey command looks like this:
: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
One final note: I did NOT need to add android.intent.category.MONKEY
to my AndroidManifest.xml file!