Code
public void FirstTestCase() throws Exception { softAssert = new SoftAssert(); DesiredCapabilities capabilities = new DesiredCapabilities(); capabilities.setCapability("deviceName", "Nilesh2"); capabilities.setCapability("platformName", "Android"); capabilities.setCapability("app","C:\\NileshData\\Automation\\MobileAutomationCSG\\src\\test\\java\\utils\\ApiDemos-debug.apk" ); capabilities.setCapability("noReset", true); capabilities.setCapability("appWaitForLaunch", false); AppiumDriver driver; try { driver = new AndroidDriver(new URL("http://localhost:4723/wd/hub"), capabilities); } catch (Exception e) { e.printStackTrace(); return; }}
ERROR : org.openqa.selenium.SessionNotCreatedException: Could not start a new session. Response code 404. Message: The requested resource could not be found, or a request was received using an HTTP method that is not supported by the mapped resource Host info: host: 'INGAWALENILESH', Build info: version: '4.9.0', revision: 'd7057100a6'System info: os.name: 'Windows 11', os.arch: 'amd64', os.version: '10.0', java.version: '11.0.17'Driver info: io.appium.java_client.android.AndroidDriverCommand: [null, newSession {capabilities=[{appium:app=C:\NileshData\Automation\MobileAutomationCSG\src\test\java\utils\ApiDemos-debug.apk, appium:appWaitForLaunch=false, appium:deviceName=Nilesh2, appium:noReset=true, platformName=ANDROID}], desiredCapabilities=Capabilities {app: C:\NileshData\Automation\Mo..., appWaitForLaunch: false, deviceName: Nilesh2, noReset: true, platformName: ANDROID}}]Capabilities {app: C:\NileshData\Automation\Mo..., appWaitForLaunch: false, deviceName: Nilesh2, noReset: true, platformName: ANDROID} at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:136)
or even some times getting below
Could not start a new session. Response code 500. Message: An unknown server-side error occurred while processing the command. Original error: Cannot verify the signature of 'C:\Users\ingawalenilesh\AppData\Local\Programs\Appium Server GUI\resources\app\node_modules\appium\node_modules\appium-uiautomator2-server\apks\appium-uiautomator2-server-v4.27.0.apk'. Original error: The 'java.exe' binary could not be found neither in PATH nor under JAVA_HOME (C:\Program Files\Amazon Corretto\jdk11.0.17_8\bin\bin)
Can we resolve above