GithubHelp home page GithubHelp logo

Comments (10)

dtmilano avatar dtmilano commented on June 13, 2024

You raised an interesting point. At some point AVC is expecting emulator names starting with emulator.
It seems a bug. I'm checking it.

Is screenshot.py like the one in examples?

from androidviewclient.

knorrium avatar knorrium commented on June 13, 2024

@dtmilano it's pretty much like the one in the examples dir. It just has extra actions that are particular to my app (tapping on elements, etc).

It works fine on an actual device and on AVDs named "emulator-5554", but fails in this particular case.

from androidviewclient.

dtmilano avatar dtmilano commented on June 13, 2024

You may try specifying the serial number on the command line:

$ ./screenshot.py ~/tmp/sc7.png localhost:54266
__connect()
checkVersion(reconnect=True)
__send(host:version, checkok=True, reconnect=False)
checkConnected()
    checkConnected: returning True
__checkOk()
checkConnected()
    checkConnected: returning True
setAlarm(15)
    __checkOk: recv= 'OKAY'
setAlarm(0)
    __checkOk: returning True
__connect()
__setTransport()
checkConnected()
    checkConnected: returning True
getDevices()
__send(host:devices-l, checkok=False, reconnect=False)
checkConnected()
    checkConnected: returning True
__checkOk()
checkConnected()
    checkConnected: returning True
setAlarm(15)
    __checkOk: recv= 'OKAY'
setAlarm(0)
    __checkOk: returning True
__receive()
checkConnected()
    checkConnected: returning True
    __receive: receiving 97 bytes
    __receive: returning len= 97
Device.factory( localhost:54266        device product:sdk_x86 model:Android_SDK_built_for_x86 device:generic_x86 )
values= ['localhost:54266', 'device', 'product:sdk_x86 model:Android_SDK_built_for_x86 device:generic_x86']
__connect()
    __setTransport: msg= host:transport:localhost:54266
__send(host:transport:localhost:54266, checkok=True, reconnect=False)
checkConnected()
    checkConnected: returning True
__checkOk()
checkConnected()
    checkConnected: returning True
setAlarm(15)
    __checkOk: recv= 'OKAY'
setAlarm(0)
    __checkOk: returning True
shell(cmd=getprop ro.secure)
__send(shell:getprop ro.secure, checkok=True, reconnect=False)
__checkOk()
checkConnected()
    checkConnected: returning True
setAlarm(15)
    __checkOk: recv= 'OKAY'
setAlarm(0)
    __checkOk: returning True
Reconnecting...
Closing socket... <socket._socketobject object at 0x10052d9f0>
__connect()
__setTransport()
checkConnected()
    checkConnected: returning True
getDevices()
__send(host:devices-l, checkok=False, reconnect=False)
checkConnected()
    checkConnected: returning True
__checkOk()
checkConnected()
    checkConnected: returning True
setAlarm(15)
    __checkOk: recv= 'OKAY'
setAlarm(0)
    __checkOk: returning True
__receive()
checkConnected()
    checkConnected: returning True
    __receive: receiving 97 bytes
    __receive: returning len= 97
Device.factory( localhost:54266        device product:sdk_x86 model:Android_SDK_built_for_x86 device:generic_x86 )
values= ['localhost:54266', 'device', 'product:sdk_x86 model:Android_SDK_built_for_x86 device:generic_x86']
__connect()
    __setTransport: msg= host:transport:localhost:54266
__send(host:transport:localhost:54266, checkok=True, reconnect=False)
checkConnected()
    checkConnected: returning True
__checkOk()
checkConnected()
    checkConnected: returning True
setAlarm(15)
    __checkOk: recv= 'OKAY'
setAlarm(0)
    __checkOk: returning True
shell(cmd=getprop ro.debuggable)
__send(shell:getprop ro.debuggable, checkok=True, reconnect=False)
__checkOk()
checkConnected()
    checkConnected: returning True
setAlarm(15)
    __checkOk: recv= 'OKAY'
setAlarm(0)
    __checkOk: returning True
Reconnecting...
Closing socket... <socket._socketobject object at 0x10052d9f0>
__connect()
__setTransport()
checkConnected()
    checkConnected: returning True
getDevices()
__send(host:devices-l, checkok=False, reconnect=False)
checkConnected()
    checkConnected: returning True
__checkOk()
checkConnected()
    checkConnected: returning True
setAlarm(15)
    __checkOk: recv= 'OKAY'
setAlarm(0)
    __checkOk: returning True
__receive()
checkConnected()
    checkConnected: returning True
    __receive: receiving 97 bytes
    __receive: returning len= 97
Device.factory( localhost:54266        device product:sdk_x86 model:Android_SDK_built_for_x86 device:generic_x86 )
values= ['localhost:54266', 'device', 'product:sdk_x86 model:Android_SDK_built_for_x86 device:generic_x86']
__connect()
    __setTransport: msg= host:transport:localhost:54266
__send(host:transport:localhost:54266, checkok=True, reconnect=False)
checkConnected()
    checkConnected: returning True
__checkOk()
checkConnected()
    checkConnected: returning True
setAlarm(15)
    __checkOk: recv= 'OKAY'
setAlarm(0)
    __checkOk: returning True
shell(cmd=getprop ro.build.version.sdk)
__send(shell:getprop ro.build.version.sdk, checkok=True, reconnect=False)
__checkOk()
checkConnected()
    checkConnected: returning True
setAlarm(15)
    __checkOk: recv= 'OKAY'
setAlarm(0)
    __checkOk: returning True
Reconnecting...
Closing socket... <socket._socketobject object at 0x10052d9f0>
__connect()
__setTransport()
checkConnected()
    checkConnected: returning True
getDevices()
__send(host:devices-l, checkok=False, reconnect=False)
checkConnected()
    checkConnected: returning True
__checkOk()
checkConnected()
    checkConnected: returning True
setAlarm(15)
    __checkOk: recv= 'OKAY'
setAlarm(0)
    __checkOk: returning True
__receive()
checkConnected()
    checkConnected: returning True
    __receive: receiving 97 bytes
    __receive: returning len= 97
Device.factory( localhost:54266        device product:sdk_x86 model:Android_SDK_built_for_x86 device:generic_x86 )
values= ['localhost:54266', 'device', 'product:sdk_x86 model:Android_SDK_built_for_x86 device:generic_x86']
__connect()
    __setTransport: msg= host:transport:localhost:54266
__send(host:transport:localhost:54266, checkok=True, reconnect=False)
checkConnected()
    checkConnected: returning True
__checkOk()
checkConnected()
    checkConnected: returning True
setAlarm(15)
    __checkOk: recv= 'OKAY'
setAlarm(0)
    __checkOk: returning True
__send(framebuffer:, checkok=True, reconnect=False)
__checkOk()
checkConnected()
    checkConnected: returning True
setAlarm(15)
    __checkOk: recv= 'OKAY'
setAlarm(0)
    __checkOk: returning True
__receive()
checkConnected()
    checkConnected: returning True
    __receive: receiving 52 bytes
    __receive: returning len= 52
    takeSnapshot: (1, 16, 2048000, 1280, 800, 11, 5, 0, 5, 5, 6, 0, 0)
    takeSnapshot: (1, 16, 2048000, 1280, 800, 11, 5, 0, 5, 5, 5, 0, 0, 'BGR')
__send(, checkok=False, reconnect=False)
    takeSnapshot: reading 2048000 bytes
__receive()
checkConnected()
    checkConnected: returning True
    __receive: receiving 2048000 bytes
    __receive: returning len= 2048000
    takeSnapshot: Image.frombuffer(RGB, (1280, 800), data, raw, BGR;16, 0, 1)
Closing socket... <socket._socketobject object at 0x10052d9f0>

from androidviewclient.

knorrium avatar knorrium commented on June 13, 2024

@dtmilano I tried using your example script and it didn't work either.

After some more attempts I'm now getting a connection refused message which seems to be caused by the hardcoded 5037 port:

https://github.com/dtmilano/AndroidViewClient/blob/master/AndroidViewClient/src/com/dtmilano/android/adb/adbclient.py#L43

+ python screenshots-debug.py /Users/knorrium/test.png localhost:57276
__connect()
Traceback (most recent call last):
  File "screenshots-debug.py", line 35, in <module>
    device, serialno = ViewClient.connectToDeviceOrExit(verbose=False)
  File "/Users/knorrium/dev/AndroidViewClient/AndroidViewClient/src/com/dtmilano/android/viewclient.py", line 1383, in connectToDeviceOrExit
    device = adbclient.AdbClient(serialno)
  File "/Users/knorrium/dev/AndroidViewClient/AndroidViewClient/src/com/dtmilano/android/adb/adbclient.py", line 82, in __init__
    self.__connect()
  File "/Users/knorrium/dev/AndroidViewClient/AndroidViewClient/src/com/dtmilano/android/adb/adbclient.py", line 109, in __connect
    raise RuntimeError("ERROR: Connecting to %s:%d: %s" % (self.socket, self.port, ex))
RuntimeError: ERROR: Connecting to <socket._socketobject object at 0x1024fcd70>:5037: [Errno 61] Connection refused
Closing socket... <socket._socketobject object at 0x1024fcd70>
Build step 'Execute shell' marked build as failure
$ /Applications/adt-bundle-mac-x86_64/sdk/platform-tools/adb disconnect localhost:57276
[android] Stopping Android emulator

The Android emulator plugin assigns random ports every time it's called:

/Applications/adt-bundle-mac-x86_64/sdk/tools/emulator -no-boot-anim -ports 57754,57755 -prop persist.sys.language=en -prop persist.sys.country=US -avd hudson_en-US_240_QVGA_Google_Inc._Google_APIs_10 -no-snapshot-load -no-snapshot-save -wipe-data -partition-size 300

Is there any way I can override that port?

from androidviewclient.

dtmilano avatar dtmilano commented on June 13, 2024

What's the output of

$ ps -aef | grep adb

(perhaps taken while the job is running)

On Tue, Oct 1, 2013 at 5:44 PM, Felipe Knorr Kuhn
[email protected]:

@dtmilano https://github.com/dtmilano I tried using your example script
and it didn't work either.

After some more attempts I'm now getting a connection refused message
which seems to be caused by the hardcoded 5037 port:

https://github.com/dtmilano/AndroidViewClient/blob/master/AndroidViewClient/src/com/dtmilano/android/adb/adbclient.py#L43

  • python screenshots-debug.py /Users/knorrium/test.png localhost:57276
    connect()
    Traceback (most recent call last):
    File "screenshots-debug.py", line 35, in
    device, serialno = ViewClient.connectToDeviceOrExit(verbose=False)
    File "/Users/knorrium/dev/AndroidViewClient/AndroidViewClient/src/com/dtmilano/android/viewclient.py", line 1383, in connectToDeviceOrExit
    device = adbclient.AdbClient(serialno)
    File "/Users/knorrium/dev/AndroidViewClient/AndroidViewClient/src/com/dtmilano/android/adb/adbclient.py", line 82, in __init

    self.__connect()
    File "/Users/knorrium/dev/AndroidViewClient/AndroidViewClient/src/com/dtmilano/android/adb/adbclient.py", line 109, in __connect
    raise RuntimeError("ERROR: Connecting to %s:%d: %s" % (self.socket, self.port, ex))
    RuntimeError: ERROR: Connecting to <socket._socketobject object at 0x1024fcd70>:5037: [Errno 61] Connection refused
    Closing socket... <socket._socketobject object at 0x1024fcd70>
    Build step 'Execute shell' marked build as failure
    $ /Applications/adt-bundle-mac-x86_64/sdk/platform-tools/adb disconnect localhost:57276
    [android] Stopping Android emulator

The Android emulator plugin assigns random ports every time it's called:

/Applications/adt-bundle-mac-x86_64/sdk/tools/emulator -no-boot-anim
-ports 57754,57755 -prop persist.sys.language=en -prop
persist.sys.country=US -avd
hudson_en-US_240_QVGA_Google_Inc._Google_APIs_10 -no-snapshot-load
-no-snapshot-save -wipe-data -partition-size 300

Is there any way I can override that port?


Reply to this email directly or view it on GitHubhttps://github.com//issues/54#issuecomment-25494182
.

Have you read my blog ?
http://dtmilano.blogspot.com
android junit tests ui linux cult thin clients

from androidviewclient.

knorrium avatar knorrium commented on June 13, 2024

@dtmilano the adb server is running

501 59577 1 0 2:14PM ttys000 0:00.11 adb fork-server server 501 69312 1 0 3:12PM ttys000 0:00.33 adb fork-server server 501 69458 97688 0 3:13PM ttys000 0:00.02 /Applications/adt-bundle-mac-x86_64/sdk/platform-tools/adb -s localhost:59717 logcat -v time

I was able to get AVC to connect to the emulator by changing PORT = 5037 to PORT = int(os.environ['ANDROID_ADB_SERVER_PORT'])

This ANDROID_ADB_SERVER_PORT variable is exposed by the Jenkins Android Emulator plugin.

I'm thinking about the best way to handle this case, maybe connectToDeviceOrExit() could accept a new ADB port parameter?

from androidviewclient.

dtmilano avatar dtmilano commented on June 13, 2024

Should be fixed by db9a1ca.

from androidviewclient.

knorrium avatar knorrium commented on June 13, 2024

@dtmilano I'll test it out tomorrow and will close the issue, thanks again! :)

from androidviewclient.

dtmilano avatar dtmilano commented on June 13, 2024

Thanks for reporting!

On Wed, Oct 2, 2013 at 12:19 AM, Felipe Knorr Kuhn <[email protected]

wrote:

@dtmilano https://github.com/dtmilano I'll test it out tomorrow and
will close the issue, thanks again! :)


Reply to this email directly or view it on GitHubhttps://github.com//issues/54#issuecomment-25512458
.

Have you read my blog ?
http://dtmilano.blogspot.com
android junit tests ui linux cult thin clients

from androidviewclient.

knorrium avatar knorrium commented on June 13, 2024

It's working, closing the issue.

from androidviewclient.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.