Error : org.openqa.selenium.SessionNotCreatedException: A new session could not be created. (Original error: spawn OK) (WARNING: The server did not provide any stacktrace information) Command duration or timeout: 14.73 seconds

I am trying to launch an application using appium, I am seeing the following error while executing

org.openqa.selenium.SessionNotCreatedException: A new session could not be created. (Original error: spawn OK) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 14.73 seconds

Here are my code and detailed error

import static org.junit.Assert.*;

import java.net.MalformedURLException;
import java.net.URL;
import java.util.concurrent.TimeUnit;

import io.appium.java_client.android.AndroidDriver;
import io.appium.java_client.remote.MobileCapabilityType;

import org.junit.Test;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.remote.DesiredCapabilities;

public class FirstCase {

WebDriver driver;

@Test
public void test() throws MalformedURLException {
	
	//Set up desired capabilities
	  DesiredCapabilities caps = new DesiredCapabilities();
	  //File app=new File("D:\Apps\EriBank\eribank.apk");
	  //caps.setCapability(MobileCapabilityType.APP,app);
	  caps.setCapability(MobileCapabilityType.PLATFORM_VERSION, "4.4.2");
	  caps.setCapability(MobileCapabilityType.PLATFORM_NAME, "Android");
	  caps.setCapability(MobileCapabilityType.DEVICE_NAME, "3208645b4d6f614d");
	  //caps.setCapability("avd","Name of the AVD to launch");
	  caps.setCapability(MobileCapabilityType.APP_PACKAGE, "com.experitest.ExperiBank");
	  caps.setCapability(MobileCapabilityType.APP_ACTIVITY, "com.experitest.ExperiBank.LoginActivity");
	  caps.setCapability(MobileCapabilityType.BROWSER_NAME, "");// In case of web apps
	  driver = new AndroidDriver (new URL("http://127.0.0.1:4723/wd/hub"), caps);
	  driver.manage().timeouts().implicitlyWait(10,TimeUnit.SECONDS);  
	//fail("Not yet implemented");
	
}

}

Error Detail

at Process.ChildProcess._handle.onexit (child_process.js:779:34)

info: [debug] Responding to client with error: {ā€œstatusā€:33,ā€œvalueā€:{ā€œmessageā€:ā€œA new session could not be created. (Original error: spawn OK)ā€,ā€œcodeā€:ā€œOKā€,ā€œerrnoā€:ā€œOKā€,ā€œsyscallā€:ā€œspawnā€,ā€œorigValueā€:ā€œspawn OKā€},ā€œsessionIdā€:null}
info: ← POST /wd/hub/session 500 14472.118 ms - 181

Please help me to resolve this.

Not enough info. Although you’ve posted what you think is the error, the real error is probably in the log before it, please post it.

For example, I did a quick Google search on your error and found someone with the real error:

info: [debug] executing cmd: D:\adt-bundle-windows-x86-20140702\sdk\platform-tools\adb.exe -s adb server is out of date. killing...

And then your error afterwards:

If this is your issue, then you need to update adb server. Otherwise post the log & I’m sure someone can help. Also, you should post the version of Appium that you are trying to use–it really does help to get a quicker resolution.

Please find the logs

Checking if an update is available
Starting Node Server
info: Welcome to Appium v1.3.4 (REV c8c79a85fbd6870cd6fc3d66d038a115ebe22efe)
info: Appium REST http interface listener started on 127.0.0.1:4723
info: [debug] Non-default server args: {ā€œaddressā€:ā€œ127.0.0.1ā€,ā€œlogNoColorsā€:true,ā€œplatformNameā€:ā€œAndroidā€,ā€œplatformVersionā€:ā€œ18ā€,ā€œautomationNameā€:ā€œAppiumā€}
info: Console LogLevel: debug
info: → POST /wd/hub/session {ā€œdesiredCapabilitiesā€:{ā€œappPackageā€:ā€œcom.experitest.ExperiBankā€,ā€œappActivityā€:ā€œcom.experitest.ExperiBank.LoginActivityā€,ā€œplatformVersionā€:ā€œ4.4.2ā€,ā€œbrowserNameā€:ā€œā€,ā€œplatformNameā€:ā€œAndroidā€,ā€œdeviceNameā€:ā€œ3208645b4d6f614dā€}}
info: Client User-Agent string: Apache-HttpClient/4.4.1 (Java/1.8.0_25)
info: [debug] Didn’t get app but did get Android package, will attempt to launch it on the device
info: [debug] Creating new appium session 01595626-506c-48cb-bacb-9947df9724f0
info: Starting android appium
info: [debug] Getting Java version
info: Java version is: 1.8.0_25
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: [debug] Checking whether adb is present
info: [debug] Using adb from D:\adt-bundle-windows-x86-20130717\sdk\platform-tools\adb.exe
info: Retrieving device
info: [debug] Trying to find a connected android device
info: [debug] Getting connected devices…
info: [debug] executing cmd: D:\adt-bundle-windows-x86-20130717\sdk\platform-tools\adb.exe 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: D:\adt-bundle-windows-x86-20130717\sdk\platform-tools\adb.exe -s adb server is out of date. killing…
wait-for-device
info: [debug] Retrying restartAdb
error: Error running wait-for-device
info: [debug] executing cmd: D:\adt-bundle-windows-x86-20130717\sdk\platform-tools\adb.exe -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: D:\adt-bundle-windows-x86-20130717\sdk\platform-tools\adb.exe -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: D:\adt-bundle-windows-x86-20130717\sdk\platform-tools\adb.exe -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: D:\adt-bundle-windows-x86-20130717\sdk\platform-tools\adb.exe -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: D:\adt-bundle-windows-x86-20130717\sdk\platform-tools\adb.exe -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: D:\adt-bundle-windows-x86-20130717\sdk\platform-tools\adb.exe -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: D:\adt-bundle-windows-x86-20130717\sdk\platform-tools\adb.exe -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: D:\adt-bundle-windows-x86-20130717\sdk\platform-tools\adb.exe -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: D:\adt-bundle-windows-x86-20130717\sdk\platform-tools\adb.exe -s adb server is out of date. killing…
wait-for-device
error: Error running wait-for-device
info: [debug] executing cmd: D:\adt-bundle-windows-x86-20130717\sdk\platform-tools\adb.exe -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: D:\adt-bundle-windows-x86-20130717\sdk\platform-tools\adb.exe -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: D:\adt-bundle-windows-x86-20130717\sdk\platform-tools\adb.exe -s adb server is out of date. 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
error: Failed to start an Appium session, err was: Error: spawn OK
info: [debug] Cleaning up android objects
info: [debug] Cleaning up appium session
info: [debug] Error: spawn OK
at errnoException (child_process.js:988:11)
at Process.ChildProcess._handle.onexit (child_process.js:779:34)
info: [debug] Responding to client with error: {ā€œstatusā€:33,ā€œvalueā€:{ā€œmessageā€:ā€œA new session could not be created. (Original error: spawn OK)ā€,ā€œcodeā€:ā€œOKā€,ā€œerrnoā€:ā€œOKā€,ā€œsyscallā€:ā€œspawnā€,ā€œorigValueā€:ā€œspawn OKā€},ā€œsessionIdā€:null}
info: ← POST /wd/hub/session 500 13175.370 ms - 181

Thanks for the confirmation. I can’t believe I got it without seeing the log!

1 Like