I am not getting option to use driver.findElementByUiAutomator

I always used my driver as AppiumDriver. You are using as RemoteWebDriver.

I’m not sure why you are using that, but if you cast it, it will work:

((AndroidDriver)driver).findElementByAndroidUIAutomator("...");

Look here also for more info on drivers: