0
votes

Please help to solve my problem

  1. Genymotion with VirtualBox download from genymotion site and install properly
  2. Add Genymotion pluging on eclipse and set Genymotion directory
  3. Add virtual device Nexus9 os version 5.1.0 API 22
  4. Add Selenium and Appium java client jar files under project
  5. Use Genymotion Android Tool and Custom Android SDK tool as Genymotion ADB tool connection setting
  6. Configure Appium Setting and run appium
  7. Run below source code

    import java.io.IOException;
    import org.apache.commons.exec.CommandLine;
    import org.apache.commons.exec.DefaultExecuteResultHandler;
    import org.apache.commons.exec.DefaultExecutor;
    import org.apache.commons.exec.ExecuteException;
    import org.openqa.selenium.WebDriver;
    import org.openqa.selenium.remote.DesiredCapabilities;
    import org.openqa.selenium.remote.RemoteWebDriver;
    import java.net.URL;
    import io.appium.java_client.android.AndroidDriver;
    
    public class Firstappium {
    
        static String deviceName = "Nexus9-6.0.0-API23";
        static  WebDriver driver;;
    
        public static void main(String[] args) throws InterruptedException, ExecuteException, IOException {
    
            DesiredCapabilities capabilities = new DesiredCapabilities();        
            DefaultExecutor executor = new DefaultExecutor();
            DefaultExecuteResultHandler resultHandler = new DefaultExecuteResultHandler();
                    capabilities.setCapability("deviceName","Nexus9-5.1.0API22");   
            capabilities.setCapability("platformVersion", "5.1");
            capabilities.setCapability("platformName", "Android");
            capabilities.setCapability("app","G:/appium/apk/cz.hipercalc.apk");
    
            driver = new AndroidDriver(new URL("http://127.0.0.1:4720/wd/hub"),capabilities);
            System.out.println("SetUp is successful and Appium Driver is launched successfully");        
        }
    }
    
  8. Show below log in Appium

info: [debug] 1 device(s) connected info: Found device adb server version (32) doesn't match this client (36); killing... info: [debug] Setting device id to adb server version (32) doesn't match this client (36); killing... info: [debug] Waiting for device to be ready and to respond to shell commands (timeout = 5) info: [debug] executing cmd: G:\Android\sdk\platform-tools\adb.exe -s adb server version (32) doesn't match this client (36); killing... wait-for-device info: [debug] Retrying restartAdb error: Error running wait-for-device info: [debug] executing cmd: G:\Android\sdk\platform-tools\adb.exe -s adb server version (32) doesn't match this client (36); killing... kill-server error: Error killing ADB server, going to see if it's online anyway info: [debug] Getting connected devices... info: [debug] executing cmd: G:\Android\sdk\platform-tools\adb.exe -s adb server version (32) doesn't match this client (36); killing... devices info: [debug] Waiting for device to be ready and to respond to shell commands (timeout = 5) info: [debug] executing cmd: G:\Android\sdk\platform-tools\adb.exe -s adb server version (32) doesn't match this client (36); killing... wait-for-device error: Error running wait-for-device info: [debug] Retrying restartAdb info: [debug] executing cmd: G:\Android\sdk\platform-tools\adb.exe -s adb server version (32) doesn't match this client (36); killing... error: Error running wait-for-device info: [debug] executing cmd: G:\Android\sdk\platform-tools\adb.exe -s adb server version (32) doesn't match this client (36); killing... kill-server error: Error killing ADB server, going to see if it's online anyway info: [debug] Getting connected devices... info: [debug] executing cmd: G:\Android\sdk\platform-tools\adb.exe -s adb server version (32) doesn't match this client (36); killing... devices info: [debug] Waiting for device to be ready and to respond to shell commands (timeout = 5) info: [debug] executing cmd: G:\Android\sdk\platform-tools\adb.exe -s adb server version (32) doesn't match this client (36); killing... wait-for-device error: Error running wait-for-device info: [debug] Sent shutdown command, waiting for UiAutomator to stop... warn: UiAutomator did not shut down fast enough, calling it gone info: [debug] Cleaning up android objects info: [debug] Cleaning up appium session error: Failed to start an Appium session, err was: Error: Command failed: C:\WINDOWS\system32\cmd.exe /s /c "G:\Android\sdk\platform-tools\adb.exe -s adb server version (32) doesn't match this client (36); killing... wait-for-device" error: could not install smartsocket listener: cannot bind to 127.0.0.1:5037: Only one usage of each socket address (protocol/network address/port) is normally permitted. (10048) could not read ok from ADB Server * could not start server *

info: [debug] Error: Command failed: C:\WINDOWS\system32\cmd.exe /s /c "G:\Android\sdk\platform-tools\adb.exe -s adb server version (32) doesn't match this client (36); killing... wait-for-device" error: could not install smartsocket listener: cannot bind to 127.0.0.1:5037: Only one usage of each socket address (protocol/network address/port) is normally permitted. (10048) could not read ok from ADB Server * could not start server *

at ChildProcess.exithandler (child_process.js:751:12)
at ChildProcess.emit (events.js:110:17)
at maybeClose (child_process.js:1016:16)
at Process.ChildProcess._handle.onexit (child_process.js:1088:5)

info: [debug] Responding to client with error: {"status":33,"value":{"message":"A new session could not be created. (Original error: Command failed: C:\WINDOWS\system32\cmd.exe /s /c \"G:\Android\sdk\platform-tools\adb.exe -s adb server version (32) doesn't match this client (36); killing...\r wait-for-device\"\nerror: could not install smartsocket listener: cannot bind to 127.0.0.1:5037: Only one usage of each socket address (protocol/network address/port) is normally permitted. (10048)\r\ncould not read ok from ADB Server\r\n* could not start server *\r\n)","killed":false,"code":4294967295,"signal":null,"cmd":"C:\WINDOWS\system32\cmd.exe /s /c \"G:\Android\sdk\platform-tools\adb.exe -s adb server version (32) doesn't match this client (36); killing...\r wait-for-device\"","origValue":"Command failed: C:\WINDOWS\system32\cmd.exe /s /c \"G:\Android\sdk\platform-tools\adb.exe -s adb server version (32) doesn't match this client (36); killing...\r wait-for-device\"\nerror: could not install smartsocket listener: cannot bind to 127.0.0.1:5037: Only one usage of each socket address (protocol/network address/port) is normally permitted. (10048)\r\ncould not read ok from ADB Server\r\n* could not start server *\r\n"},"sessionId":null} info: <-- POST /wd/hub/session 500 30628.747 ms - 1226

1

1 Answers

1
votes

From the logs what I can is "adb server version does not match".

Try updating your Android SDK first through ANDROID SDK MANAGER.

And you need to start appium server before you try to initialise the driver.

When you start appium server, by default it starts with port number 4723.

If you are not mentioning any port number while starting appium server then the url should be http://127.0.0.1:4723/wd/hub