Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
  • Original error: Could not find a connected Android device.

    • 0
    • 0
    • 0
    • 0
    • 2
    • 0
    • 0
    • 0
    • 2.34k
    Comment on it

    I tried to run the below piece code and getting the error Exception in thread "main" org.openqa.selenium.SessionNotCreatedException: A new session could not be created.

    public class TestCaller {
        public static AppiumDriver driver;
        public static void main(String[] args) throws MalformedURLException {
        DesiredCapabilities capabilites = new DesiredCapabilities();
        capabilites.setCapability("device", "Android");
        capabilites.setCapability("deviceName", "GT-N7100");
        capabilites.setCapability("platformVersion", "4.4.3");
        capabilites.setCapability("platformName", "Android");
        capabilites.setCapability("appPackage", "");
        capabilites.setCapability("appActivity", "");
        driver = new AndroidDriver(new URL(""),capabilites);


    Exception in thread "main" org.openqa.selenium.SessionNotCreatedException: A new session could not be created. (Original error: Could not find a connected Android device.) (WARNING: The server did not provide any stacktrace information) Command duration or timeout: 21.00 seconds Build info: version: '2.43.1', revision: '5163bce', time: '2014-09-10 16:27:33' System info: host: 'Admin-PC', ip: '', 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.8.0' Driver info: at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance( at sun.reflect.DelegatingConstructorAccessorImpl.newInstance( at java.lang.reflect.Constructor.newInstance( at org.openqa.selenium.remote.ErrorHandler.createThrowable( at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed( at org.openqa.selenium.remote.RemoteWebDriver.execute( at io.appium.java_client.AppiumDriver.execute( at org.openqa.selenium.remote.RemoteWebDriver.startSession( at org.openqa.selenium.remote.RemoteWebDriver.( at org.openqa.selenium.remote.RemoteWebDriver.( at io.appium.java_client.AppiumDriver.( at at TestContactsNativeApp.main(


    Sometimes it may happen that if we don't perform any action on our mobile device then it gets disconnected automatically and in the system tray the mobile is displayed as connected. So, the best solution of this is to disconnect your mobile first and then connect it again.

 2 Comment(s)

  • If you have connected more than one Android devices then please make sure that the device on which you are running the script is present in the connected list. You should also remove the screen unlock functionality and then try to execute the script. If the device is connected but the screen is in locked state then in the connected devices list, the device goes in offline state and you will get the above error.

  • Dear Kaushik, I am getting the same error on my Windows 10 PC. Strange thing is that all android devices are getting enlisted on writing adb devices. I have tried adb kill-server and abd start-server but of no use.

    Can you please suggest a solution.

Sign In

Sign up using

Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: