Locator Strategy 'css selector' is not supported for this session

Hi,
I am new to Appium and facing issue while performing the action of mobile native app.
i am able to perform action with xpath. However, whenever i tried to use id or classname i am facing error
Locator Strategy ‘css selector’ is not supported for this session
please help me to resolve this
Java version- 1.8
Appium Version- 1.15.1

@vijay_kumar1
‘css selector’ locator will be available with hybrid app or web application when you use ‘webview’ context using Appium.

Hi @kesav4u,
But i am working on native app for now and want to use id or className ( which are available for the desired element) i am not using any css selector
How can i use id and className for my native app?

Please provide the code snippet and failure logs.

public class basics extends base {

public static void main(String[] args) throws MalformedURLException {
	// TODO Auto-generated method stub
	AndroidDriver<AndroidElement> driver= Capabilities();
	driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
	//xpath,id,className
	//tagName[@attribute="value"]
	driver.findElementByXPath("//android.widget.TextView[@text='Preference']").click();
	driver.findElementByXPath("//android.widget.TextView[@text='3. Preference dependencies']").click();
	driver.findElementById("android:id/checkbox").click();

// driver.findElementByXPath(“//android.widget.TextView[@text=‘WiFi settings’]”).click();
}

}

Error

Jan 29, 2020 10:05:12 AM org.openqa.selenium.remote.ProtocolHandshake createSession
INFO: Detected dialect: W3C
Exception in thread “main” org.openqa.selenium.InvalidSelectorException: Locator Strategy ‘css selector’ is not supported for this session
For documentation on this error, please visit: Selenium
Build info: version: ‘3.11.0’, revision: ‘e59cfb3’, time: ‘2018-03-11T20:26:55.152Z’

@kesav4u

error is in this line

I have the Same Issue Once I upgraded with Appium Dotnet. Did you figure out how to fix it?