SessionNotCreatedException: adb server is out of date killing... wait-for-device

Hi,

I am new to Appium and i am trying to open Google in chrome browser in an emulator.

Specs:
Ubuntu: 14.04
Appium : 1.4.13

Process:

  1. Started Appium server
    info: Welcome to Appium v1.4.13 (REV c75d8adcb66a75818a542fe1891a34260c21f76a)
    info: Appium REST http interface listener started on 0.0.0.0:4723
    info: Console LogLevel: debug

  2. Started Android SDK > started an existing emulator named “AVD_for_Nexus_4”
    Note:
    Emulator showing “Process system isn’t responding” > i clicked “wait”
    When we click search button inside emulator it shows: No Internet connection

  3. Installed chrome.apk using adb install /path/Chrome.apk
    adb install /home/xxx/Documents/qa/appium/apkdir/Chrome.apk
    632 KB/s (30170246 bytes in 46.569s)
    pkg: /data/local/tmp/Chrome.apk
    Failure [INSTALL_FAILED_ALREADY_EXISTS]

  4. Started code using testng:

5) Eclipse Exception:
FAILED CONFIGURATION: @BeforeMethod setUp
org.openqa.selenium.SessionNotCreatedException: A new session could not be created. (Original error: Command failed: /bin/sh -c /home/xxx/Documents/qa/appium/android-sdk-linux/platform-tools/adb -s adb server is out of date. killing… wait-for-device
ADB server didn’t ACK

  • could not start server *
    ) (WARNING: The server did not provide any stacktrace information)
    Command duration or timeout: 5.83 seconds
    Build info: version: ‘2.46.0’, revision: ‘61506a4624b13675f24581e453592342b7485d71’, time: ‘2015-06-04 10:22:50’
    System info: host: ‘xe-tu-sheetal’, ip: ‘127.0.1.1’, os.name: ‘Linux’, os.arch: ‘amd64’, os.version: ‘3.13.0-66-generic’, java.version: ‘1.7.0_80’
    Driver info: io.appium.java_client.android.AndroidDriver
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
    at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:204)
    at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:156)
    at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:605)
    at io.appium.java_client.DefaultGenericMobileDriver.execute(DefaultGenericMobileDriver.java:27)
    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:242)
    at org.openqa.selenium.remote.RemoteWebDriver.(RemoteWebDriver.java:128)
    at org.openqa.selenium.remote.RemoteWebDriver.(RemoteWebDriver.java:155)
    at io.appium.java_client.DefaultGenericMobileDriver.(DefaultGenericMobileDriver.java:22)
    at io.appium.java_client.AppiumDriver.(AppiumDriver.java:202)
    at io.appium.java_client.android.AndroidDriver.(AndroidDriver.java:50)
    at appium.AppiumWebApp.setUp(AppiumWebApp.java:43)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:85)
    at org.testng.internal.Invoker.invokeConfigurationMethod(Invoker.java:517)
    at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:213)
    at org.testng.internal.Invoker.invokeMethod(Invoker.java:601)
    at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:845)
    at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1153)
    at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:125)
    at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:108)
    at org.testng.TestRunner.privateRun(TestRunner.java:771)
    at org.testng.TestRunner.run(TestRunner.java:621)
    at org.testng.SuiteRunner.runTest(SuiteRunner.java:357)
    at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:352)
    at org.testng.SuiteRunner.privateRun(SuiteRunner.java:310)
    at org.testng.SuiteRunner.run(SuiteRunner.java:259)
    at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
    at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
    at org.testng.TestNG.runSuitesSequentially(TestNG.java:1199)
    at org.testng.TestNG.runSuitesLocally(TestNG.java:1124)
    at org.testng.TestNG.run(TestNG.java:1032)
    at org.testng.remote.RemoteTestNG.run(RemoteTestNG.java:111)
    at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:204)
    at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:175)

6) Appium server exception:
info: --> POST /wd/hub/session {“desiredCapabilities”:{“platformVersion”:“6.0”,“app”:"/home/xxx/Documents/qa/appium/apkdir/Chrome.apk",“deviceName”:“emulator-5554”,“platformName”:“Android”,“browserName”:“Chrome”,“appActivity”:“com.google.android.apps.chrome.Main”,“device”:“android”,“appPackage”:“com.android.chrome”}}
info: Client User-Agent string: Apache-HttpClient/4.3.3 (java 1.5)
info: [debug] The following desired capabilities were provided, but not recognized by appium. They will be passed on to any other services running on this server. : device
info: Set mode: Proxying straight through to Chromedriver
info: [debug] Looks like we want chrome on android
info: [debug] Creating new appium session ca47ac06-7419-4f06-b071-3d6aa276ef34
info: [debug] Checking whether adb is present
info: [debug] Using adb from /home/xxx/Documents/qa/appium/android-sdk-linux/platform-tools/adb
info: [debug] Using fast reset? true
info: [debug] Preparing device for session
info: [debug] Not checking whether app is present since we are assuming it’s already on the device
info: Retrieving device
info: [debug] Trying to find a connected android device
info: [debug] Getting connected devices…
info: [debug] executing cmd: /home/xxx/Documents/qa/appium/android-sdk-linux/platform-tools/adb devices
info: [debug] 2 device(s) connected
info: Found device adb server is out of date. killing…
info: [debug] Setting device id to adb server is out of date. killing…
info: [debug] Waiting for device to be ready and to respond to shell commands (timeout = 5)
info: [debug] executing cmd: /home/xxx/Documents/qa/appium/android-sdk-linux/platform-tools/adb -s adb server is out of date. killing… wait-for-device
error: Error running wait-for-device
info: [debug] Retrying restartAdb
info: [debug] executing cmd: /home/xxx/Documents/qa/appium/android-sdk-linux/platform-tools/adb -s adb server is out of date. 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: /home/xxx/Documents/qa/appium/android-sdk-linux/platform-tools/adb -s adb server is out of date. killing… devices
info: [debug] Waiting for device to be ready and to respond to shell commands (timeout = 5)
info: [debug] executing cmd: /home/xxx/Documents/qa/appium/android-sdk-linux/platform-tools/adb -s adb server is out of date. killing… wait-for-device
error: Error running wait-for-device
info: [debug] Retrying restartAdb
info: [debug] executing cmd: /home/xxx/Documents/qa/appium/android-sdk-linux/platform-tools/adb -s adb server is out of date. 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: /home/xxx/Documents/qa/appium/android-sdk-linux/platform-tools/adb -s adb server is out of date. killing… devices
info: [debug] Waiting for device to be ready and to respond to shell commands (timeout = 5)
info: [debug] executing cmd: /home/xxx/Documents/qa/appium/android-sdk-linux/platform-tools/adb -s adb server is out of date. killing… wait-for-device
error: Error running wait-for-device
info: [debug] Retrying restartAdb
info: [debug] executing cmd: /home/xxx/Documents/qa/appium/android-sdk-linux/platform-tools/adb -s adb server is out of date. 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: /home/xxx/Documents/qa/appium/android-sdk-linux/platform-tools/adb -s adb server is out of date. killing… devices
info: [debug] Waiting for device to be ready and to respond to shell commands (timeout = 5)
info: [debug] executing cmd: /home/xxx/Documents/qa/appium/android-sdk-linux/platform-tools/adb -s adb server is out of date. killing… wait-for-device
error: Error running wait-for-device
info: [debug] executing cmd: /home/xxx/Documents/qa/appium/android-sdk-linux/platform-tools/adb -s adb server is out of date. 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: /home/xxx/Documents/qa/appium/android-sdk-linux/platform-tools/adb -s adb server is out of date. killing… devices
info: [debug] Waiting for device to be ready and to respond to shell commands (timeout = 5)
info: [debug] executing cmd: /home/xxx/Documents/qa/appium/android-sdk-linux/platform-tools/adb -s adb server is out of date. killing… wait-for-device
error: Error running wait-for-device
info: [debug] Cleaning up appium session
error: Failed to start an Appium session, err was: Error: Command failed: /bin/sh -c /home/xxx/Documents/qa/appium/android-sdk-linux/platform-tools/adb -s adb server is out of date. killing… wait-for-device
ADB server didn’t ACK

  • could not start server *

info: [debug] Error: Command failed: /bin/sh -c /home/xxx/Documents/qa/appium/android-sdk-linux/platform-tools/adb -s adb server is out of date. killing… wait-for-device
ADB server didn’t ACK

  • could not start server *

    at ChildProcess.exithandler (child_process.js:203:12)
    at emitTwo (events.js:87:13)
    at ChildProcess.emit (events.js:172:7)
    at maybeClose (internal/child_process.js:817:16)
    at Socket. (internal/child_process.js:319:11)
    at emitOne (events.js:77:13)
    at Socket.emit (events.js:169:7)
    at Pipe._onclose (net.js:469:12)
    info: [debug] Responding to client with error: {“status”:33,“value”:{“message”:“A new session could not be created. (Original error: Command failed: /bin/sh -c /home/xxx/Documents/qa/appium/android-sdk-linux/platform-tools/adb -s adb server is out of date. killing… wait-for-device\nADB server didn’t ACK\n* could not start server \n)",“killed”:false,“code”:255,“signal”:null,“cmd”:"/bin/sh -c /home/xxx/Documents/qa/appium/android-sdk-linux/platform-tools/adb -s adb server is out of date. killing… wait-for-device",“origValue”:"Command failed: /bin/sh -c /home/xxx/Documents/qa/appium/android-sdk-linux/platform-tools/adb -s adb server is out of date. killing… wait-for-device\nADB server didn’t ACK\n could not start server *\n”},“sessionId”:null}
    info: <-- POST /wd/hub/session 500 5595.878 ms - 720

7) Code:
public class AppiumWebApp {

AppiumDriver driver;

@BeforeMethod
public void setUp() throws MalformedURLException {
    File appDir = new File("/home/xebia/Documents/qa/appium/apkdir");
    File app = new File(appDir, "Chrome.apk");
   
    DesiredCapabilities capabilities = new DesiredCapabilities();
    capabilities.setCapability("browserName", "Chrome");
    capabilities.setCapability("device", "android");
    capabilities.setCapability("deviceName", "emulator-5554");
    capabilities.setCapability("platformVersion", "6.0");
    capabilities.setCapability("platformName", "Android");
    capabilities.setCapability("app", app.getAbsolutePath());
    capabilities.setCapability("appPackage", "com.android.chrome");
    capabilities.setCapability("appActivity","com.google.android.apps.chrome.Main");
    
    driver = new AndroidDriver(new URL("http://0.0.0.0:4723/wd/hub"),capabilities);
    driver.get("https://www.google.co.in/");
}

Please advice how to proceed