Appium : New session could not be created


I just started exploring Appium, I am trying to launch Amazon app in my nexus 9 and i am getting following error: “A new session could not be created. (Original error: Activity used to start app doesn’t exist or cannot be launched! Make sure it exists and is a launchable activity”

My app is already installed in nexus devie and i also tried by checking/un-checking “Full reset”/“No reset” options

Here’s my code:

File app = new File(“D:\Seleniumdownloads\apk\”);
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability(CapabilityType.BROWSER_NAME, “”);
capabilities.setCapability(“deviceName”, “Nexus 9”);
capabilities.setCapability(“platformVersion”, “5.1.1”);
capabilities.setCapability(“platformName”, “Android”);
capabilities.setCapability(“app”, app.getAbsolutePath());
capabilities.setCapability(“appPackage”, “”);
capabilities.setCapability(“appActivity”, “”);

        driver = new AndroidDriver(new URL(""), capabilities);
        driver.manage().timeouts().implicitlyWait(80, TimeUnit.SECONDS);

Please help where i am going wrong…

Thanks in advance.

Step 1: Open Appium console
Step 2: Click on settings and check the ip address and port number and make a note of it.
Step 3: click on launch in the appium console.
Step 4: open terminal/commands prompt check the device name and use the same in the code
step 5: Execute your code…

Comment this following line :smile:

capabilities.setCapability(“appActivity”, “”);

It could be causing the problem as i don’t think it is an activity

Hi @Arti_999,

If app is already installed in your device, then capabilities.setCapability(“app”, app.getAbsolutePath()); is not required. Comment the line and try to execute