0



    Now, i'm studying how to use the MonkeyRunner to test android devices in the win7, now i have downloaded the latest android sdk, and configured all of the env

    There is an android4.4.2 tv set that enabled adbd, no usb debug port, but network is available. I can use a following commend to connect this device with adb in my pc:

adb connect 172.30.198.240.

Then i saw following print in my command window:

List of devices attached
172.30.198.240:5555    device


Checked this connection that was successful. we can use "adb shell" command to login the tv system shell.
i wrote a python script(called test.py) to test the MonkeyRunner.
from com.android.monkeyrunner import MonkeyRunner, MonkeyDevice
device = MonkeyRunner.waitForConnection() # <---can't connect device
if device is not None:
    device.takeSnapshot()

after aboves done, i input the "monkeyrunner.bat test.py" in the win7 command window.

the codes blocked at the MonkeyRunner.waitForConnection() for ever, and adb server was killed.

I have tried many ways, but all of them were failed.
Try1: input monkeyrunner.bat -s 172.30.198.240 test.py, but failed again.
Try2: i googled this issue, someone said we must set the adb port to 12345, so, i changed the adb default port from 5555 to 12345 by using adb tcpip 12345, failed again.
Try3:modify the script, add parameters for the waitForConnection method

device = MonkeyRunner.waitForConnection(5, "172.30.198.240:5555")

i got a nullpointer error for the device.

But if i use a phone with a usb debug port to connect my pc, above script ran ok.
I don't know why, could you help me?
thanks a lot

Harris Huang
  • 83
  • 1
  • 10

1 Answers1

0

Try AndroidViewClient/culebra that could connect to devices connected over the network (i.e. TV) with no problems.

If you want to just take screenshots dump -f (one of the tools included in the package) does just that.

NOTE:

There's also a typo in your snippet: MokeyRunner (missing n), but I guess you don't have it in your real code or you'll be receiving an exception.

Diego Torres Milano
  • 65,697
  • 9
  • 111
  • 134
  • Thanks for your suggestion, but i don't want to use other tools to replace the monkeyrunner. So, i want to know the root cause why the monkeyrunner can't work in network environment. if monkeyrunner doesn't support the network connection, i will give up this tool and choose another tool. – Harris Huang Feb 19 '16 at 05:52
  • I mentioned it because is almost a *drop-in* replacement – Diego Torres Milano Feb 19 '16 at 06:14
  • I have submitted this question to the google android group. Till now, no one reply to me... This tool is developed by google, there should be no such obvious problem. – Harris Huang Feb 20 '16 at 02:58