Could not take a screenshot - com.android.ddmlib.TimeoutException

1,150 views
Skip to first unread message

Ajinkya Suryawanshi

unread,
Jul 24, 2014, 2:44:19 PM7/24/14
to calabash...@googlegroups.com


Hi everyone,

I was using calabash-android on windows and everything was perfect but recently I had to change the setup to Mac and I ran into following problem while executing predefined step : "Then take picture"

I am getting following error:

Could not take screenshot
com.android.ddmlib.TimeoutException
    at com.android.ddmlib.AdbHelper.read(AdbHelper.java:648)
    at com.android.ddmlib.AdbHelper.read(AdbHelper.java:616)
    at com.android.ddmlib.AdbHelper.getFrameBuffer(AdbHelper.java:296)
    at com.android.ddmlib.CalabashAdbHelper.getFrameBuffer(Unknown Source)
    at com.android.ddmlib.CalabashDevice.getScreenshot(Unknown Source)
    at sh.calaba.screenshot.ScreenshotTaker.takeScreenshot(Unknown Source)
    at sh.calaba.screenshot.ScreenshotTaker.main(Unknown Source)


My environment variables -
export PATH=/Users/ajin0000/Documents/adt-bundle-mac-x86_64-20140702/sdk/platform-tools:/Users/ajin0000/Documents/adt-bundle-mac-x86_64-20140702/sdk/tools:/Users/ajin0000/Documents/apache-ant-1.9.4/bin:/Library/Java/Home/bin:/Users/ajin0000/Documents/adt-bundle-mac-x86_64-20140702/sdk/platforms:/usr/bin:$PATH
export JAVA_HOME=/Library/Java/Home
export ANDROID_HOME=/Users/ajin0000/Documents/adt-bundle-mac-x86_64-20140702/sdk

I went through a lot of blogs and I read that this same issue was faced by someone trying to take a screenshot on Jenkins but I haven't integrated my application to Jenkins yet.
I am just executing on native - android emulator - Nexus 10.


Please help me solve this issue.


Thanks



Ajinkya Suryawanshi

unread,
Jul 25, 2014, 4:13:17 PM7/25/14
to calabash...@googlegroups.com

Is anyone facing the same issue as this? 
Any help would be appreciated. 

Thank you..  

Shubham Saxena

unread,
Jul 28, 2014, 1:20:57 AM7/28/14
to calabash...@googlegroups.com
Hi Ajinkya,
Did you find any solution for this?



--
You received this message because you are subscribed to the Google Groups "calabash-android" group.
To unsubscribe from this group and stop receiving emails from it, send an email to calabash-andro...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--


______
Regards:

Shubham Saxena
09910071463
.
Message has been deleted

Ajinkya Suryawanshi

unread,
Jul 28, 2014, 2:04:44 AM7/28/14
to calabash...@googlegroups.com
Hi Shubham,

thanks for getting back to me.
No I did not find any solution for this, but I found out something interesting, it seems that screenshot functionality works for Physical devices where as it doesn't work on Virtual devices/Emulators.

Will you be able to help me with this issue? Or you are facing the same issue as this?

Thanks..

Shubham Saxena

unread,
Jul 28, 2014, 11:06:26 AM7/28/14
to calabash...@googlegroups.com

Hi Ajinkya,
I am also running with this Issue. The thing you found about real devices and Emulator is also applicable for me. The only thing which I found while navigating is that this issue was first observed when Calabash-android's 5th or 6th version was available. I am not sure if only we are facing this Issue or other Calabash users too But this is ridiculous and annoying.

I got this Issue when I updated the JDK & Android SDK (tools, platform tools, and Other APIs).
Before updating the JDK when only SDK was updated, I was able to get the Screen shots but there was nothing in them except Black Screen and after jdk1.8.0 this error encountered.

S
​hubham​

​​


Ajinkya Suryawanshi

unread,
Jul 29, 2014, 1:32:12 PM7/29/14
to calabash...@googlegroups.com

Hi Shubham,

I changed my Java to:
export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.7.0_60.jdk/Contents/Home

cause I thought that yours wasn't working on 1.8 and I was earlier using Java 1.6 but unfortunately, even this does not solve the issue for me.

I am still getting the same error on the emulator.
Please let me know if u find a solution for this.

Also, I wonder if this has something to do with the latest calabash android release 0.5

Ajinkya

Shubham Saxena

unread,
Jul 31, 2014, 6:49:38 AM7/31/14
to calabash...@googlegroups.com
HI Ajinkya,
I think the Problem is not with JDK, it seems to be with SDK. I have another setup working fine without updating the SDK.

For this setup I could not find a solution yet.


--
You received this message because you are subscribed to the Google Groups "calabash-android" group.
To unsubscribe from this group and stop receiving emails from it, send an email to calabash-andro...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Kasper Rugård Thomsen

unread,
Aug 4, 2014, 8:50:16 AM8/4/14
to calabash...@googlegroups.com
Hi Shubham,

what SDK version are you using? And what SDK version are you using to get it to work?

I have the except same error and it works fine on a "real" device, but I need to be able to change my locale on my device from the command-line, I can't use a real device (unless I want to change the locale manually... and I don't ;-)).

Cheers,
Kasper Rugård Thomsen

Shubham Saxena

unread,
Aug 5, 2014, 2:03:14 AM8/5/14
to calabash...@googlegroups.com
Hi Kasper,

On SDK 22.3 and JDK 1.7.51 it is working perfect
On SDK 23.0.2 and JKD 1.8.0 it is working with real devices only.

Shubham

Ajinkya Suryawanshi

unread,
Aug 5, 2014, 4:03:45 PM8/5/14
to calabash...@googlegroups.com
Hi  Shubham,

I absolutely second your findings.

As issue is with latest Android SDK, it would be really helpful for someone from Calabash-android dev team to look into this matter and help escalate the issue.
I request Jonas to look into this issue.

Note:
com.android.ddmlib.CalabashAdbHelper.getFrameBuffer(Unknown Source)
at com.android.ddmlib.CalabashDevice.getScreenshot(Unknown Source)

It seems from these statements that latest SDK did not carry forward the Calabash wrapper that was originally used as a solution to this problem.
Jonas, it would be helpful if you could get back to us. We will really appreciate it.


Thanks and Regards,
Ajinkya S


Kasper Rugård Thomsen

unread,
Aug 5, 2014, 6:40:55 PM8/5/14
to calabash...@googlegroups.com
Hi Shubham and Ajinkya S,

I worked around this issue by installing the Genymotion emulator (http://www.genymotion.com/) - I'm using the newest SDK as well, but JDK7 (you shouldn't be able to build Android apps against JDK8?).

I know my fix is just a work-around, but then I could carry on with my testing :-)

Taking a screenshot through ADB with the normal emulators, causes an exception and an empty (zero bytes) screenshot file will be created.

As it seems that it lies beyond Calabash I think it would be more appropriate to create an issue https://code.google.com/p/android/issues/list instead?

Cheers,
Kasper

Barry Perez

unread,
Jan 12, 2015, 10:20:29 PM1/12/15
to calabash...@googlegroups.com
Hi all,

I ran into the same problem when attempting to get up and running on OSX. I have managed to get it working and wanted to share my solution for anyone else who might run into this in future...

- I ran "adb logcat" in order to view the logcat output on the virtual device. This showed the following error:

E/gralloc_goldfish(  937): gralloc_alloc: Mismatched usage flags: 1080 x 1920, usage 333
W/GraphicBufferAllocator(  937): alloc(1080, 1920, 1, 00000333, ...) failed -22 (Invalid argument)
E/        (  937): GraphicBufferAlloc::createGraphicBuffer(w=1080, h=1920) failed (Invalid argument), handle=0x0
E/BufferQueue( 1864): [ScreenshotClient] dequeueBuffer: SurfaceComposer::createGraphicBuffer failed

After some further digging, I read about a different issue where someone suggested making the emulator is not using host GPU. Unticked this option in my emulator settings (Virtual Device Manager... Emulation options - uncheck "Use Host GPU") and restarted. I was then able to take screenshots from the virtual device.

Hope this is of use to someone!

Kind regards,
Barry.

Rodrigo Alvarez

unread,
Apr 15, 2015, 6:07:13 AM4/15/15
to calabash...@googlegroups.com


On Tuesday, January 13, 2015 at 4:20:29 AM UTC+1, Barry Perez wrote:
Hi all,

I ran into the same problem when attempting to get up and running on OSX. I have managed to get it working and wanted to share my solution for anyone else who might run into this in future...

- I ran "adb logcat" in order to view the logcat output on the virtual device. This showed the following error:

E/gralloc_goldfish(  937): gralloc_alloc: Mismatched usage flags: 1080 x 1920, usage 333
W/GraphicBufferAllocator(  937): alloc(1080, 1920, 1, 00000333, ...) failed -22 (Invalid argument)
E/        (  937): GraphicBufferAlloc::createGraphicBuffer(w=1080, h=1920) failed (Invalid argument), handle=0x0
E/BufferQueue( 1864): [ScreenshotClient] dequeueBuffer: SurfaceComposer::createGraphicBuffer failed

After some further digging, I read about a different issue where someone suggested making the emulator is not using host GPU. Unticked this option in my emulator settings (Virtual Device Manager... Emulation options - uncheck "Use Host GPU") and restarted. I was then able to take screenshots from the virtual device.

In my case, if I disable the "Use Host GPU" option, I just get a blank screen on the emulator. Any hints?
Reply all
Reply to author
Forward
0 new messages