Appium on Android Simulator. error: Failed to start an Appium session, err was: Error: Device android not configured yet

HI ALL,

I am new to Appium , try to run Appium testcase on Android Simulator and got below error. tried with both App and Chrome but could’t got any success. Also when run Appium Inspector same issue Occur.

Below is the code Used and Appium Log:

Code:

public class AndroidSimulator {
WebDriver driver;

@BeforeClass
public void setUp() throws MalformedURLException{

DesiredCapabilities capabilities = new DesiredCapabilities(); 



capabilities.setCapability(MobileCapabilityType.PLATFORM_NAME, "Android");
capabilities.setCapability(MobileCapabilityType.PLATFORM_VERSION, "6.0");
capabilities.setCapability(MobileCapabilityType.DEVICE_NAME, "AppiumAndroid");
capabilities.setCapability(MobileCapabilityType.APP, "com.android.calculator2");

driver = new RemoteWebDriver(new URL(“http://127.0.0.1:4723/wd/hub”), capabilities);
}

@Test
public void testCal() throws Exception {

WebElement three=driver.findElement(By.name(“3”));
three.click();
WebElement five=driver.findElement(By.name(“5”));
five.click();
WebElement plus=driver.findElement(By.name("+"));
plus.click();
WebElement four=driver.findElement(By.name(“4”));
four.click();
WebElement zero=driver.findElement(By.name(“0”));
zero.click();
WebElement equalTo=driver.findElement(By.name("="));
equalTo.click();

WebElement results=driver.findElement(By.tagName(“EditText”));

assert results.getText().equals(“75”):“Actual value is : “+results.getText()+” did not match with expected value: 75”;

}

@AfterClass
public void teardown(){

driver.quit(); 

}
}

Appium Error:
error: Failed to start an Appium session, err was: Error: Device android not configured yet

Hi asjadtariq,

Above statement is not correct.
For MobileCapabilityType.APP, you should provide the path of the apk file in your system.
But from above code I can see that you are trying to automate in-built android app, So for that you should provide following capabilities instead of MobileCapabilityType.APP:

capabilities.setCapability(MobileCapabilityType.APP_PACKAGE, “com.android.calculator2”);
capabilities.setCapability(MobileCapabilityType.APP_ACTIVITY,“com.android.calculator2.Calculator”);

Hope this will resolve your issue :yum:

Regards
@Abdul_Sathar_Beigh

Hi Abdul
Thanx for replying. I have developed a sample Android App as well then gave local path but no luck. I am unable to switch inspector ON.

When I try to run chrome to open any website error changed to.

Chrome is not configured yet.

Do u think there is something went wrong during installation.