Please share more details. Are you launching the appium desktop before running your method? what are the desired capabilities you have set? Try to run the below sample code and share the log if it did not run.
public static void androidDevice()throws MalformedURLException {
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability("deviceName", "xxxxxxxxx"); //ID of the device connected locally
capabilities.setCapability("platformName", "xxxx"); // iOS or Android
capabilities.setCapability("app", "/Users/xxx/xxx/app.apk"); //Local Path of the .apk file
wd = new AndroidDriver(new URL("http://0.0.0.0:4723/wd/hub"), capabilities); // Appium local Server
wd.manage().timeouts().implicitlyWait(60, TimeUnit.SECONDS);
}