Scripts getting launched in emulator when real device is connected

Hi Team,
I’m new to this appium development.

When i launch my scripts, my scripts were running in emulator even though real device is connected.

Also when my script runs in emulator it is not launching the scripts. It is waiting for a long time and getting error as “Emulator not ready.” screen with font “andorid” still remains in the emulator.

This is my code

File classpathRoot = new File(System.getProperty(“user.dir”));
File appDir = new File(classpathRoot, “/Apps/Amazon/”);
File app = new File(appDir, “com.amazon.mShop.android.shopping-5.2.3-502030-minAPI9.apk”);

	DesiredCapabilities capabilities = new DesiredCapabilities();
	capabilities.setCapability(CapabilityType.BROWSER_NAME, "Android");
	capabilities.setCapability("deviceName", "Emulator");
	capabilities.setCapability("platformVersion", "5.1.1");
	capabilities.setCapability("platformName", "Android");
	capabilities.setCapability("app", app.getAbsolutePath());
	
	capabilities.setCapability("appPackage", "com.amazon.mShop.android.shopping-5.2.3-502030-minAPI9");
	capabilities.setCapability("appActivity", "com.amazon.mShop.home.HomeActivity");

	driver = new AndroidDriver(new URL("http://127.0.0.1:4723/wd/hub"), capabilities);
	driver.manage().timeouts().implicitlyWait(80, TimeUnit.SECONDS);
	Thread.sleep(10000);
	driver.quit();

I have the app apk in my local machine.I don’t why this issue is occurring and i don’t where to change the settings to make it run in real device.

Please help me in resolving this issue.

Thanks in Advance.

the first thing i see is the deviceName … ‘Emulator’ only will not work
watch in cmd the command :
adb devices
it will show you all devices and emulator connected and their names.