Xpath not working on emulator or device, but working on cloud


I’m running a simple test just to test out my framework config.

When I run this simple test on a remote connection with browserstack, it works correctly.
When I execute this test on a real device, or emulator, it can’t find the element.

The element I’m trying to find is:

@AndroidFindBy(xpath = “//*[@text=“Some text”]”)

The DCs are:

File classpathRoot = new File(System.getProperty(“user.dir”));
File appDir = new File(classpathRoot, “/apppath”);
File app = new File (appDir, “appname.apk”);
capabilities.setCapability(“platformName”, “Android”);
capabilities.setCapability(“deviceName”, “NotUsed”);
//This is the device I created on the AVD manager
capabilities.setCapability(“app”, app.getAbsolutePath());
capabilities.setCapability(“appPackage”, “com.xxxxxxx”);
capabilities.setCapability(“appActivity”, “com.xxxxxx.xxxxxxxx”);
driver = new AndroidDriver(new URL(“”), capabilities);

And for execution on real device same but I added the UDID instead of the AVD capability.

The app opens in both cases, goes to the activity, and then just stays there doing nothing…
The appium server log shows:

[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Finding ‘//*[@text=“Some text”]’ using ‘XPATH’ with the contextId: ‘’ multiple: false

And stays there forever…nothing else happens.

This is working correctly on browserstack.
Failing on device and emulator.

What could be the issue?