Question

When running monkeyrunner.bat from the windows Android SDK, it throws an exception looking for a MonkeyServer with an IP address and port number supposedly entered as parameters to the bat script. I have scoured the internet with Google searches and looked at the Android developer documentation on monkeyrunner and can't find any reference to this mystery server.

Here is the exception thrown:

130830 00:24:51.664:I [main] [com.android.chimpchat.ChimpManager] Monkey Command: wake.
130830 00:24:54.703:I [pool-1-thread-1] [com.android.chimpchat.adb.AdbChimpDevice] Error starting command: monkey --port 12345
130830 00:24:54.703:I [pool-1-thread-1] [com.android.chimpchat.adb.AdbChimpDevice]com.android.ddmlib.ShellCommandUnresponsiveException
130830 00:24:54.703:I [pool-1-thread-1] [com.android.chimpchat.adb.AdbChimpDevice]  at com.android.ddmlib.AdbHelper.executeRemoteCommand(AdbHelper.java:408)
130830 00:24:54.703:I [pool-1-thread-1] [com.android.chimpchat.adb.AdbChimpDevice]  at com.android.ddmlib.Device.executeShellCommand(Device.java:435)
130830 00:24:54.703:I [pool-1-thread-1] [com.android.chimpchat.adb.AdbChimpDevice]  at com.android.chimpchat.adb.AdbChimpDevice$1.run(AdbChimpDevice.java:104)
130830 00:24:54.703:I [pool-1-thread-1] [com.android.chimpchat.adb.AdbChimpDevice]  at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:439)
130830 00:24:54.703:I [pool-1-thread-1] [com.android.chimpchat.adb.AdbChimpDevice]  at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
130830 00:24:54.703:I [pool-1-thread-1] [com.android.chimpchat.adb.AdbChimpDevice]  at java.util.concurrent.FutureTask.run(FutureTask.java:138)
130830 00:24:54.703:I [pool-1-thread-1] [com.android.chimpchat.adb.AdbChimpDevice]  at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)
130830 00:24:54.703:I [pool-1-thread-1] [com.android.chimpchat.adb.AdbChimpDevice]  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)
130830 00:24:54.703:I [pool-1-thread-1] [com.android.chimpchat.adb.AdbChimpDevice]  at java.lang.Thread.run(Thread.java:662)

monkeyrunner.bat usage shows this:

Usage: monkeyrunner [options] SCRIPT_FILE

    -s      MonkeyServer IP Address.
    -p      MonkeyServer TCP Port.
    -v      MonkeyServer Logging level (ALL, FINEST, FINER, FINE, CONFIG, INFO, WARNING, SEVERE, OFF)

Anyone know about the mystery server and the mystery IP address/TCP Port??? In particular, I'd like to know what the MonkeyServer is, what purpose it serves and, if I want to run one, what I would run, where I would run it and how to run it. Any enlightenment about the logging level would be useful too, but the possible level parameters are mostly self-evident although I do find FINEST, FINER and FINE fascinating.

Was it helpful?

Solution

After much mild aggravation looking at this problem and not seeing it except rarely, I discovered that the so-called MonkeyServer is actually the ADB (Android Debugging Bridge) daemon which, for some totally unexplained reason, didn't start when monkeyrunner threw the exception.

The ADB daemon is supposed to automatically start when monkeyrunner starts. It can also be started manually. Also, you can move the ADB's address and port number to whatever you would like from its defaults and then supply the address/port and logging level programatically to monkeyrunner when you start monkeyrunner.

Ah, the joys of mildly deficient documentation.

OTHER TIPS

monkeyrunner brings a flavour of python to your android :)

To solve your problem: monkeyrunner.bat itself will not work - you need to provide a python script, for example:

monkeyrunner.bat test.py

more specific example: if your test.py file contains the following lines:

import os
print os.environ['OS']

the the execution of monkeyrunner.bat test.py will get you an output similar to this:

C:\programs\adt\sdk\tools>monkeyrunner.bat test.py
Windows_NT

If you look at chimpchat code you see

this.manager = createManager("127.0.0.1", 12345);

while in monkeyrunner code

static int monkeyPort = 1080;

I tried with cmd to connect with 12345 and 1080 on my PC and 12345 does not work. so from what I understand you need to change the port to 1080.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top