Getting error while executing script on real android device

I am trying to run java sript on real androi device(marshmallow) appium ( i am getting error “org.openqa.selenium.SessionNotCreatedException: A new session could not be created. (Original error: No app set; either start appium with --app or pass in an ‘app’ value in desired capabilities, or set androidPackage to launch pre-existing app on device) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 361 milliseconds”

can anyone please help me on this.

@alwayspriti, this is a common question. Have you tried searching through the past questions yet?

Also, it’s helpful if you provide information concerning your problem other than the error message. For example, did you verify your capabilities were properly set? If not, what happened when you set them? What does the appium server log show?

Thank you willosser. Please find below screenshot of appium & code below:

public class StartAppp {
WebDriver Driver;
public void setUp() throws MalformedURLException {
DesiredCapabilities Capabilities = new DesiredCapabilities();
Capabilities.setCapability(“deviceName”, “ZY2239K2CL”);
Capabilities.setCapability(“BROWSER_NAME”, “Android”);
Capabilities.setCapability(“VERSION”, “6.0.1”);
Capabilities.setCapability(“platformName”, “Android”);
System.out.print(“In Test1”);
Capabilities.setCapability(“apppackage”, “”);
System.out.print(“In Test2”);
Driver = new RemoteWebDriver(new URL(“”),Capabilities );
System.out.print(“In Test3”);
Driver.manage().timeouts().implicitlyWait(15, TimeUnit.SECONDS);
System.out.print(“In Test4”);


It looks like it can’t find the apk file. I think you need a line like:

capabilities.setCapability(“app”, “{path to apk}”);

@leppo i am trying to run script on real device how can i give apk path ?

@alwayspriti, the path is the absolute path to the apk file on the host that’s running the appium client. For example,


@willosser thank u for reply can you please help me how to find absolute path for apk installed on device

The APK path is for the .apk file located on the computer where your real device is connected. You may be able to launch the version of the application installed on the device by passing in the appPackage and appActivity in your appium capabilities (only on android), though I haven’t tested that myself.