Issue when run test case on Android real device

880 views
Skip to first unread message

Gavin Gao

unread,
Sep 3, 2013, 10:45:31 PM9/3/13
to appium-...@googlegroups.com
Hi everyone,

Now I am running some test case on Android platform.
The Android emulator is OK for my test case, but failed on real device.

The version of Appium I used is 0.8.5.
And I open the debug mode on device and unlock the screen.

Really appreciate if you can help me.

The error log:

debug: Appium request initiated at /wd/hub/session

info: Using local app from desiredCaps: /Users/ggao/Downloads/TestApp.apk

debug: Request received with params: {"desiredCapabilities":{"platform":"Mac","app":"/Users/ggao/Downloads/TestApp.apk","browserName":"","app-package":"com.ggao.test","device-ready-timeout":"20","device":"Android","app-activity":"MainActivity","version":"4.2"}}

info: Creating new appium session d65621a9-0ab1-4d11-9a97-b0e9ade3be48
info: Starting android appium
info: Preparing device for session
info: Checking whether app is actually present
info: Checking whether adb is present
info: [ADB] Using adb from /Users/ggao/Documents/android-sdk-macosx/platform-tools/adb
info: Trying to find a connected android device
info: [ADB] Getting connected devices...

debug: Using fast reset? true

info: [ADB] 1 device(s) connected

info: [ADB] Setting device id to 9d7f6a4573fcc82fb800032a088d284a61c08f28
info: Found device, no need to retry
info: [ADB] Waiting for device 9d7f6a4573fcc82fb800032a088d284a61c08f28 to be ready and to respond to shell commands (timeout = 20)

info: Killing ADB server so it will come back online

info: [ADB] Getting connected devices...

error: Error: Command failed: error: protocol fault (no status)


info: [ADB] Waiting for device 9d7f6a4573fcc82fb800032a088d284a61c08f28 to be ready and to respond to shell commands (timeout = 20)

error: Device did not become ready in 20 secs; are you sure it's powered on?

info: [ADB] Waiting for device 9d7f6a4573fcc82fb800032a088d284a61c08f28 to be ready and to respond to shell commands (timeout = 20)

error: Above error isn't fatal, maybe relaunching adb will help....

info: Killing ADB server so it will come back online

info: [ADB] Getting connected devices...

info: [ADB] 1 device(s) connected

info: [ADB] Setting device id to 9d7f6a4573fcc82fb800032a088d284a61c08f28
info: [ADB] Waiting for device 9d7f6a4573fcc82fb800032a088d284a61c08f28 to be ready and to respond to shell commands (timeout = 20)

error: Failed to start an Appium session, err was: Device did not become ready in 20 secs; are you sure it's powered on?

info: Responding to client with error: {"status":6,"value":{"message":"A session is either terminated or not started","origValue":"Device did not become ready in 20 secs; are you sure it's powered on?"},"sessionId":"d65621a9-0ab1-4d11-9a97-b0e9ade3be48"}

POST /wd/hub/session 500 83357ms - 243
info: Clearing out appium devices

Jonathan Lipps

unread,
Sep 3, 2013, 10:52:49 PM9/3/13
to Gavin Gao, appium-...@googlegroups.com
It looks like your device isn't responding properly.

What happens if you do `adb wait-for-device`? Does it return immediately or does it hang?

--
http://appium.io
---
You received this message because you are subscribed to the Google Groups "Appium-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to appium-discus...@googlegroups.com.
Visit this group at http://groups.google.com/group/appium-discuss.
For more options, visit https://groups.google.com/groups/opt_out.

Gavin Gao

unread,
Sep 3, 2013, 11:08:44 PM9/3/13
to appium-...@googlegroups.com, Gavin Gao
I have tried this command and it return immediately.

when i do 'adb devices', it shows the right result:

chn-ggao:~ ggao$ adb devices
List of devices attached
HC34VW101262    device


On Wednesday, September 4, 2013 10:52:49 AM UTC+8, Jonathan Lipps wrote:
It looks like your device isn't responding properly.

What happens if you do `adb wait-for-device`? Does it return immediately or does it hang?
On Sep 3, 2013, at 7:45 PM, Gavin Gao <blu...@gmail.com> wrote:

Hi everyone,

Now I am running some test case on Android platform.
The Android emulator is OK for my test case, but failed on real device.

The version of Appium I used is 0.8.5.
And I open the debug mode on device and unlock the screen.

Really appreciate if you can help me.

The error log:



Jonathan Lipps

unread,
Sep 3, 2013, 11:10:40 PM9/3/13
to Gavin Gao, appium-...@googlegroups.com
what happens if you run `adb kill-server && adb devices` right before launching appium and your test?

Gavin Gao

unread,
Sep 3, 2013, 11:18:04 PM9/3/13
to appium-...@googlegroups.com, Gavin Gao
I close the appium firstly.
Then i run the command, it shows:
ggao$ adb kill-server && adb devices
* daemon not running. starting it now on port 5037 *
* daemon started successfully *

List of devices attached
HC34VW101262    device

After that I start Appium and run my test case, the result and the log are the same with before.

BTW, I use Appium app on my Mac, and doesn't start it in command line.

Jonathan Lipps

unread,
Sep 3, 2013, 11:24:47 PM9/3/13
to Gavin Gao, appium-...@googlegroups.com
Is your device in developer mode? What version of Android is your device running? Can you run other commands against it, like `adb shell ls` or things like that?

Gavin Gao

unread,
Sep 3, 2013, 11:29:50 PM9/3/13
to appium-...@googlegroups.com, Gavin Gao
Yes, I open the developer mode on my test device.
The Android version is 4.0.4.

`adb shell ls` can return the right result after the device is connected.

So need I upgrade the Android version on my device?

Jonathan Lipps

unread,
Sep 3, 2013, 11:38:01 PM9/3/13
to Gavin Gao, appium-...@googlegroups.com
You shouldn't have to. You'd be getting a different error if that was the issue. I can't think of what else could be going on. I'm also confused why the device ID appium comes up with is not the same as the ID of the device that is actually there. Are you sure you don't, for example, have the UDID box checked in the "iOS" section of Appium.app? That would make Appium try to find a device with that ID, which of course wouldn't be connected.

Gavin Gao

unread,
Sep 4, 2013, 12:13:33 AM9/4/13
to appium-...@googlegroups.com, Gavin Gao
Thanks very much!
You are right. I input UDID and make the checkbox checked on iOS tab.
Now my app can be installed on device after uncheck the checkbox.

But I encounter another problem:
info: [ADB] Forwarding system:4724 to device:4724

info: [ADB] Pushing appium bootstrap to device...

info: Running bootstrap

info: "/Users/ggao/Documents/android-sdk-macosx/platform-tools/adb" -s HC34VW101262 shell uiautomator runtest AppiumBootstrap.jar -c io.appium.android.bootstrap.Bootstrap

info: [ADB STDOUT] /system/bin/sh: uiautomator: not found

error: ADB quit before it successfully launched

info: Responding to client with error: {"status":6,"value":{"message":"A session is either terminated or not started","origValue":"ADB quit unexpectedly before successfully launching"},"sessionId":"9467bd3b-3dff-406d-a852-ab357b8d0ca7"}

error: Failed to start an Appium session, err was: ADB quit unexpectedly before successfully launching

POST /wd/hub/session 500 5487ms - 225

info: Clearing out appium devices
info: [ADB] Not uninstalling app since server started with --full-reset or --no-reset

info: Clearing out appium devices

Jonathan Lipps

unread,
Sep 4, 2013, 12:42:14 AM9/4/13
to Gavin Gao, appium-...@googlegroups.com
Yeah, I think UDID should be automatically unchecked when you switch over to the Android section. Dan?

Reply all
Reply to author
Forward
0 new messages