Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Got [0 device connected] when running script on another machine #3

Open
TuHuynhVan opened this issue Mar 2, 2017 · 10 comments
Open

Comments

@TuHuynhVan
Copy link

Thank you for creating this sample project. It's amazing!
I tested on the host where devices plugged and the test was successfully.

But when I run script from another PC. I could see it reserved the device [saw "Stop Using status"] but there was no device connected (even tried with adb devices command manually).

Could you possibly help me to point out where I need to do to narrow down the issue.

Thank you so much!

@email2vimalraj
Copy link
Owner

I would love to help you. But not sure what causes this issue. If you can remote, we can debug.

@TuHuynhVan
Copy link
Author

Thanks @email2vimalraj

I think you can see the issue when you run the code from another PC and replace the localhost:7100... To the target IP address host.

So sad that I have no way to provide you to access to my company network. ;(

@joostwestra
Copy link

I have the same issue. The devices is reserved in the STF web interface. But adb states 0 device connected.

@joostwestra
Copy link

T E S T S

Running com.vimalselvam.stf.AndroidTest
Configuring TestNG with: org.apache.maven.surefire.testng.conf.TestNG652Configurator@2401f4c3
Jul 12, 2017 9:48:49 AM com.vimalselvam.DeviceApi addDeviceToUser
INFO: The device is locked successfully
[Appium] Welcome to Appium v1.6.5
[Appium] Appium REST http interface listener started on 0.0.0.0:4723
[HTTP] --> GET /wd/hub/status {}
[debug] [MJSONWP] Calling AppiumDriver.getStatus() with args: []
[debug] [MJSONWP] Responding to client with driver.getStatus() result: {"build":{"version":"1.6.5","revision":null}}
[HTTP] <-- GET /wd/hub/status 200 17 ms - 83
[HTTP] --> POST /wd/hub/session {"desiredCapabilities":{"app":"/Users/phnl310030549/appium-stf-example/src/test/resources/ApiDemos-debug.apk","platformName":"Android","udid":"ZY222W632P","deviceName":"ANDROID"}}
[debug] [MJSONWP] Calling AppiumDriver.createSession() with args: [{"app":"/Users/phnl310030549/appium-stf-example/src/test/resources/ApiDemos-debug.apk","platformName":"Android","udid":"ZY222W632P","deviceName":"ANDROID"},null,null]
[debug] [BaseDriver] Event 'newSessionRequested' logged at 1499845732792 (09:48:52 GMT+0200 (CEST))
[Appium] Creating new AndroidDriver (v1.20.0) session
[Appium] Capabilities:
[Appium] app: '/Users/phnl310030549/appium-stf-example/src/test/resources/ApiDemos-debug.apk'
[Appium] platformName: 'Android'
[Appium] udid: 'ZY222W632P'
[Appium] deviceName: 'ANDROID'
[debug] [AndroidDriver] AndroidDriver version: 1.20.0
[BaseDriver] Session created with session id: 9b3bc658-15b4-4561-8160-2c5aee664031
[debug] [AndroidDriver] Getting Java version
[AndroidDriver] Java version is: 1.8.0_131
[ADB] Checking whether adb is present
[ADB] Using adb from /Users/phnl310030549/Library/Android/sdk/platform-tools/adb
[AndroidDriver] Retrieving device list
[debug] [ADB] Trying to find a connected android device
[debug] [ADB] Getting connected devices...
[debug] [ADB] 0 device(s) connected
[debug] [ADB] Could not find devices, restarting adb server...
[debug] [ADB] Restarting adb
[debug] [ADB] Getting connected devices...
[debug] [ADB] 0 device(s) connected
[debug] [ADB] Could not find devices,

@TuHuynhVan
Copy link
Author

I think you need to add Adb keys to you stf

@joostwestra
Copy link

I can connect to the device by using adb connect ipaddress:port in the command line. And after that it also shows up in the connected

(The ip address I get for the ADB connect is different then ip address of the web server.)

@joostwestra
Copy link

I if do this by hand:

MACC02NT0WVG3QP:~ phnl310030549$ adb connect 161.85.22.95:15033

  • daemon not running. starting it now at tcp:5037 *
  • daemon started successfully *
    connected to 161.85.22.95:15033
    MACC02NT0WVG3QP:~ phnl310030549$ adb connect 161.85.22.167:15021
    connected to 161.85.22.167:15021
    MACC02NT0WVG3QP:~ phnl310030549$ adb devices
    List of devices attached
    161.85.22.167:15021 device
    161.85.22.95:15033 device

Then I get this error:

[Appium] Creating new AndroidDriver (v1.20.0) session
[Appium] Capabilities:
[Appium] app: '/Users/phnl310030549/appium-stf-example/src/test/resources/ApiDemos-debug.apk'
[Appium] platformName: 'Android'
[Appium] udid: 'ZY222W632P'
[Appium] deviceName: 'ANDROID'
[debug] [AndroidDriver] AndroidDriver version: 1.20.0
[BaseDriver] Session created with session id: 95c91960-77fa-4de2-9fa0-f3a03e7217eb
[debug] [AndroidDriver] Getting Java version
[AndroidDriver] Java version is: 1.8.0_131
[ADB] Checking whether adb is present
[ADB] Using adb from /Users/phnl310030549/Library/Android/sdk/platform-tools/adb
[AndroidDriver] Retrieving device list
[debug] [ADB] Trying to find a connected android device
[debug] [ADB] Getting connected devices...
[debug] [ADB] 2 device(s) connected
[AndroidDriver] Error: Device ZY222W632P was not in the list of connected devices

@xchgaur
Copy link

xchgaur commented Dec 5, 2017

any solution to this issue? I get same error when running from other server.

@andradewagner
Copy link

I have the same problem here. It locks the device successfully but the adb commands doesn't works

Running com.vimalselvam.stf.AndroidTest
Configuring TestNG with: org.apache.maven.surefire.testng.conf.TestNG652Configurator@182decdb
Jan 25, 2018 7:49:30 PM com.vimalselvam.DeviceApi addDeviceToUser
INFO: The device <75de147b> is locked successfully
[Appium] Welcome to Appium v1.7.1
[HTTP] Could not start REST http interface listener. The requested port may already be in use. Please make sure there is no other instance of this server running already.
Error: listen EADDRINUSE 0.0.0.0:4723
at Object._errnoException (util.js:999:13)
at _exceptionWithHostPort (util.js:1020:20)
at Server.setupListenHandle [as _listen2] (net.js:1379:14)
at listenInCluster (net.js:1420:12)
at doListen (net.js:1535:7)
at process._tickCallback (internal/process/next_tick.js:152:19)
org.openqa.selenium.WebDriverException: An unknown server-side error occurred while processing the command. Original error: Could not find a connected Android device. (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 24.49 seconds
Build info: version: '2.53.0', revision: '35ae25b1534ae328c771e0856c93e187490ca824', time: '2016-03-15 10:43:46'
System info: host: 'wagner-Inspiron-7460', ip: '127.0.1.1', os.name: 'Linux', os.arch: 'amd64', os.version: '4.13.0-26-generic', java.version: '1.8.0_151'
Driver info: io.appium.java_client.android.AndroidDriver
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:206)
at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:158)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:678)
at io.appium.java_client.DefaultGenericMobileDriver.execute(DefaultGenericMobileDriver.java:51)
at io.appium.java_client.AppiumDriver.execute(AppiumDriver.java:1)
at io.appium.java_client.android.AndroidDriver.execute(AndroidDriver.java:1)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:249)
at org.openqa.selenium.remote.RemoteWebDriver.(RemoteWebDriver.java:131)
at org.openqa.selenium.remote.RemoteWebDriver.(RemoteWebDriver.java:144)
at io.appium.java_client.DefaultGenericMobileDriver.(DefaultGenericMobileDriver.java:47)
at io.appium.java_client.AppiumDriver.(AppiumDriver.java:114)
at io.appium.java_client.AppiumDriver.(AppiumDriver.java:132)
at io.appium.java_client.android.AndroidDriver.(AndroidDriver.java:97)
at com.vimalselvam.stf.AndroidTest.setup(AndroidTest.java:60)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:86)
at org.testng.internal.Invoker.invokeConfigurationMethod(Invoker.java:514)
at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:215)
at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:142)
at org.testng.internal.TestMethodWorker.invokeBeforeClassMethods(TestMethodWorker.java:178)
at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:108)
at org.testng.TestRunner.privateRun(TestRunner.java:782)
at org.testng.TestRunner.run(TestRunner.java:632)
at org.testng.SuiteRunner.runTest(SuiteRunner.java:366)
at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:361)
at org.testng.SuiteRunner.privateRun(SuiteRunner.java:319)
at org.testng.SuiteRunner.run(SuiteRunner.java:268)
at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
at org.testng.TestNG.runSuitesSequentially(TestNG.java:1244)
at org.testng.TestNG.runSuitesLocally(TestNG.java:1169)
at org.testng.TestNG.run(TestNG.java:1064)
at org.apache.maven.surefire.testng.TestNGExecutor.run(TestNGExecutor.java:77)
at org.apache.maven.surefire.testng.TestNGDirectoryTestSuite.execute(TestNGDirectoryTestSuite.java:110)
at org.apache.maven.surefire.testng.TestNGProvider.invoke(TestNGProvider.java:106)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:189)
at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:165)
at org.apache.maven.surefire.booter.ProviderFactory.invokeProvider(ProviderFactory.java:85)
at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:115)
at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:75)
Tests run: 4, Failures: 1, Errors: 0, Skipped: 3, Time elapsed: 26.333 sec <<< FAILURE!
setup(com.vimalselvam.stf.AndroidTest) Time elapsed: 26.276 sec <<< FAILURE!
java.lang.NullPointerException
at com.vimalselvam.stf.AndroidTest.setup(AndroidTest.java:64)

Results :

Failed tests: setup(com.vimalselvam.stf.AndroidTest)

Tests run: 4, Failures: 1, Errors: 0, Skipped: 3

[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 28.507 s
[INFO] Finished at: 2018-01-25T19:49:56-02:00
[INFO] Final Memory: 20M/300M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12.4:test (default-test) on project appium-stf-example: There are test failures.
[ERROR]
[ERROR] Please refer to /home/wagner/Documentos/Projetos/stf-java2/target/surefire-reports for the individual test results.
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException

@deolas
Copy link

deolas commented Dec 18, 2019

I am also getting same issue (Could not find a connected Android device) whe running scripts from another machine.
Any solution for this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants