Could not connect to server Are you sure it is running

Hi, while trying to inspect an installed application in android,
Appium inspector is saying “Could not connect to server”, While it is running on 4723 and automatic server option is also selected
Appium version: 1.20.2
List of caps:
“automationName”: “UIAutomator2”,
“platformName”: “android”,
“platformVersion”: “9.0”,
“deviceName”: “emulator”,
“appPackage”: “package”,
“appActivity”: “activity”

Even i’ve tried with the app capability by passing the app path but still getting getting same error