Java null pointer exception

Hi

I am getting null pointer exception

That script was working fine earlier and now throwing error after update android studio.

Following is a code

@Before
public void setUp() throws MalformedURLException {

    dc.setCapability("reportDirectory", reportDirectory);
    dc.setCapability("reportFormat", reportFormat);
    dc.setCapability("testName", testName);
    dc.setCapability("deviceName", "emulator-5554");
    dc.setCapability(CapabilityType.BROWSER_NAME, "Android");
    dc.setCapability(CapabilityType.VERSION, "6.0");
    dc.setCapability("platformName", "Android");
    dc.setCapability("appPackage", "com.chalklit.learning");
    dc.setCapability("appActivity", ".GetStartedActivity");
    driver = new AndroidDriver(new URL("http://127.0.0.1:4723/wd/hub"), dc);
    driver.manage().timeouts().implicitlyWait(15, TimeUnit.SECONDS);
}

@Test
public void testLogin() throws InterruptedException{
    Thread.sleep(4000);
    System.out.print("hello");

            driver.findElement(By.xpath("//*[@text='GET STARTED']")).sendKeys("#7972633"); 

error is in last line

printing hello
Launching application
And then throwing error

INFO: Detected dialect: OSS
hello
java.lang.NullPointerException
at org.openqa.selenium.remote.RemoteWebElement.execute(RemoteWebElement.java:275)
at org.openqa.selenium.remote.RemoteWebElement.sendKeys(RemoteWebElement.java:99)
at com.example.admin.myapplication2.ExperiBank.testLogin(ExperiBank.java:72)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)
at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:51)
at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242)
at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.intellij.rt.execution.application.AppMainV2.main(AppMainV2.java:131)

Process finished with exit code -1

Please help me i am stuck here

Does your findElement method return a valid Element?
Maybe another approach for fetching the element will work?

Issue has been resolved

I have downgraded my selenium from 3.8 to 3.4 and now it’s working