Getting CONFIGURATION: @AfterClass teardown and FAILED: testCal error in appium

package Appium;

import java.net.MalformedURLException;
import java.net.URL;

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.openqa.selenium.remote.RemoteWebDriver;
import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
import org.openqa.selenium.remote.CapabilityType;

import io.appium.java_client.AppiumDriver;
import io.appium.java_client.android.AndroidDriver;
import io.appium.java_client.remote.MobileBrowserType;
import java.net.URL;

public class AppiumPOC {


        WebDriver driver;

        @BeforeClass
        public void Appium() throws MalformedURLException{

            DesiredCapabilities capabilities = new DesiredCapabilities();
            capabilities.setCapability("device", "Android");
            capabilities.setCapability(CapabilityType.BROWSER_NAME, "Chrome");
            capabilities.setCapability(CapabilityType.VERSION, "4.2.2");
            capabilities.setCapability("platformName", "Android");
            capabilities.setCapability("deviceName","4100a9102db72100");
            capabilities.setCapability(CapabilityType.PLATFORM, "WINDOWS");


            capabilities.setCapability("app", "chrome");
            WebDriver driver = new RemoteWebDriver(new URL("http://127.0.0.1:4723/wd/hub"), capabilities);



          }

        @Test
        public void testCal()
        {
            driver.get("http://google.com");

        }

        @AfterClass
        public void teardown(){
            //close the app
            driver.quit();
        }
    }

Please find below for the console message.I used my test using TestNg run method and tried in different platform still i m facing the same issue.

[TestNG] Running:
C:\Users\Manoj\AppData\Local\Temp\testng-eclipse-1668712669\testngcustomsuite.xml
FAILED CONFIGURATION: @AfterClass teardown
java.lang.NullPointerException
at Appium.AppiumPOC.teardown(AppiumPOC.java:55)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:84)
at org.testng.internal.Invoker.invokeConfigurationMethod(Invoker.java:564)
at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:213)
at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:138)
FAILED: testCal
java.lang.NullPointerException
at Appium.AppiumPOC.testCal(AppiumPOC.java:48)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:84)
at org.testng.internal.Invoker.invokeMethod(Invoker.java:714)

My observation

Remove these capabilities
capabilities.setCapability(CapabilityType.PLATFORM, “WINDOWS”); // as u already mentioned platrform as android
capabilities.setCapability(“app”, “chrome”); // as you specified u will use mobile browser

Also create driver like this it should work
AndroidDriver driver = new AndroidDriver(new URL(“http://127.0.0.1:4723/wd/hub”), capabilities);

Following is the solution.

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

Remove webdriver from here.Si it should be like,
driver = new RemoteWebDriver(new URL(“http://127.0.0.1:4723/wd/hub”), capabilities);

It solved my problem.