Unable to launch app

Getting following error while trying to launch the app
[AppiumDriver@9369] Encountered internal error running command: Error: Error getting device API level. Original error: Error executing adbExec. Original error: ‘Command ‘/Users/zop7625/Library/Android/sdk/platform-tools/adb -P 5037 -s emulator-5554 shell getprop ro.build.version.sdk’ timed out after 20000ms’. Try to increase the 20000ms adb execution timeout represented by ‘adbExecTimeout’ capability

Using following script
AppiumDriverLocalService service = new AppiumServiceBuilder().withAppiumJS(new File("//usr//local//lib//node_modules//appium//build//lib//main.js"))
.withIPAddress(“127.0.0.1”).usingPort(4723).build();

	//service.start();
	UiAutomator2Options options = new UiAutomator2Options();
	options.setDeviceName("Charan");
	options.setApp("//Users//zop7625//Documents//Web Automation//MobileApp//AppiumAuto//src//test//java//resources//ApiDemos-debug.apk");
	//options.setCapability("appWaitForLaunch", true);
	
	
	AndroidDriver ad = new AndroidDriver(new URL("http://127.0.0.1:4723"), options);
	
	//xpath,androidUIAutomator, id, classname, accessbilityId
	ad.quit();
	
	//service.stop();

Appreciate the help and am new to this

This the complete log :
[debug] [AppiumDriver@9369] Calling AppiumDriver.createSession() with args: [null,null,{“firstMatch”:[{}],“alwaysMatch”:{“appium:app”:"//Users//zop7625//Documents//Web Automation//MobileApp//AppiumAuto//src//test//java//resources//ApiDemos-debug.apk",“appium:automationName”:“UIAutomator2”,“appium:deviceName”:“Charan”,“platformName”:“android”}}]

[debug] [AppiumDriver@9369] Event ‘newSessionRequested’ logged at 1666077751522 (12:52:31 GMT+0530 (India Standard Time))

[Appium] Attempting to find matching driver for automationName ‘UIAutomator2’ and platformName ‘android’

[Appium] The ‘uiautomator2’ driver was installed and matched caps.

[Appium] Will require it at /Users/zop7625/.appium/node_modules/appium-uiautomator2-driver

[debug] [Appium] Requiring driver at /Users/zop7625/.appium/node_modules/appium-uiautomator2-driver

[AppiumDriver@9369] Appium v2.0.0-beta.46 creating new AndroidUiautomator2Driver (v2.8.0) session

[AppiumDriver@9369] Checking BaseDriver versions for Appium and AndroidUiautomator2Driver

[AppiumDriver@9369] Appium’s BaseDriver version is 8.7.3

[AppiumDriver@9369] AndroidUiautomator2Driver’s BaseDriver version is 8.7.3

[debug] [AndroidUiautomator2Driver@f9c4] Creating session with W3C capabilities: {

[debug] [AndroidUiautomator2Driver@f9c4] “alwaysMatch”: {

[debug] [AndroidUiautomator2Driver@f9c4] “platformName”: “android”,

[debug] [AndroidUiautomator2Driver@f9c4] “appium:app”: “//Users//zop7625//Documents//Web Automation//MobileApp//AppiumAuto//src//test//java//resources//ApiDemos-debug.apk”,

[debug] [AndroidUiautomator2Driver@f9c4] “appium:automationName”: “UIAutomator2”,

[debug] [AndroidUiautomator2Driver@f9c4] “appium:deviceName”: “Charan”

[debug] [AndroidUiautomator2Driver@f9c4] },

[debug] [AndroidUiautomator2Driver@f9c4] “firstMatch”: [

[debug] [AndroidUiautomator2Driver@f9c4] {}

[debug] [AndroidUiautomator2Driver@f9c4] ]

[debug] [AndroidUiautomator2Driver@f9c4] }

[AndroidUiautomator2Driver@f9c4 (e9b34494)] Session created with session id: e9b34494-f81c-4867-bd64-65a755d86851

[BaseDriver] Using local app ‘//Users//zop7625//Documents//Web Automation//MobileApp//AppiumAuto//src//test//java//resources//ApiDemos-debug.apk’

[debug] [AndroidUiautomator2Driver@f9c4 (e9b34494)] Checking whether app is actually present

[ADB] Using ‘adb’ from ‘/Users/zop7625/Library/Android/sdk/platform-tools/adb’

[debug] [ADB] Running ‘/Users/zop7625/Library/Android/sdk/platform-tools/adb -P 5037 start-server’

[ADB] Error executing adbExec. Original error: ‘Command ‘/Users/zop7625/Library/Android/sdk/platform-tools/adb -P 5037 start-server’ timed out after 20000ms’. Try to increase the 20000ms adb execution timeout represented by ‘adbExecTimeout’ capability

[AndroidDriver] Retrieving device list

[debug] [ADB] Trying to find a connected android device

[debug] [ADB] Getting connected devices

[debug] [ADB] Connected devices: [{“udid”:“emulator-5554”,“state”:“device”}]

[AndroidDriver] Using device: emulator-5554

[ADB] Using ‘adb’ from ‘/Users/zop7625/Library/Android/sdk/platform-tools/adb’

[debug] [ADB] Running ‘/Users/zop7625/Library/Android/sdk/platform-tools/adb -P 5037 start-server’

[ADB] Error executing adbExec. Original error: ‘Command ‘/Users/zop7625/Library/Android/sdk/platform-tools/adb -P 5037 start-server’ timed out after 20000ms’. Try to increase the 20000ms adb execution timeout represented by ‘adbExecTimeout’ capability

[debug] [ADB] Setting device id to emulator-5554

[debug] [ADB] Running ‘/Users/zop7625/Library/Android/sdk/platform-tools/adb -P 5037 -s emulator-5554 shell getprop ro.build.version.sdk’

[debug] [AndroidUiautomator2Driver@f9c4 (e9b34494)] Deleting UiAutomator2 session

[debug] [ADB] Running ‘/Users/zop7625/Library/Android/sdk/platform-tools/adb -P 5037 -s emulator-5554 shell getprop ro.build.version.sdk’

[debug] [ADB] Running ‘/Users/zop7625/Library/Android/sdk/platform-tools/adb -P 5037 -s emulator-5554 shell getprop ro.build.version.sdk’

[debug] [AppiumDriver@9369] Event ‘newSessionStarted’ logged at 1666077909637 (12:55:09 GMT+0530 (India Standard Time))

[debug] [AppiumDriver@9369] Encountered internal error running command: Error: Error getting device API level. Original error: Error executing adbExec. Original error: ‘Command ‘/Users/zop7625/Library/Android/sdk/platform-tools/adb -P 5037 -s emulator-5554 shell getprop ro.build.version.sdk’ timed out after 20000ms’. Try to increase the 20000ms adb execution timeout represented by ‘adbExecTimeout’ capability

[debug] [AppiumDriver@9369] at ADB.getApiLevel (/Users/zop7625/.appium/node_modules/appium-uiautomator2-driver/node_modules/appium-adb/lib/tools/adb-commands.js:159:13)

[debug] [AppiumDriver@9369] at AndroidUiautomator2Driver.deleteSession (/Users/zop7625/.appium/node_modules/appium-uiautomator2-driver/lib/driver.js:706:11)

[debug] [AppiumDriver@9369] at AndroidUiautomator2Driver.createSession (/Users/zop7625/.appium/node_modules/appium-uiautomator2-driver/lib/driver.js:248:7)

[debug] [AppiumDriver@9369] at AppiumDriver.createSession (/usr/local/lib/node_modules/appium/lib/appium.js:336:35)

[HTTP] <-- POST /session 500 158115 ms - 1163

[HTTP]

try to increase adbExecTimeout capability as suggested in the error message.
see here: https://appium.io/docs/en/writing-running-appium/caps/#:~:text=e.g.%2C%20true-,adbExecTimeout,-Timeout%20in%20milliseconds

you can launch the avd manually and run the same command as mentioned in the error message and see how much time it will take to response with the device api.

Hi thanks for the replay but it worked for some instance and now again it has stopped working is there any issue with appium on mac system