Unable to create a new remote session in appium as org.openqa.selenium.WebDriverException error coming

Please help me learn how to identify problems in Appium mobile automation: I don’t know where to look to identify the error.

I built a test app with android-sdk on my physical mobile phone.

I took a little Appium test in java just to launch the test app on a connected physical Android device - a Galaxy A10

  • this test is from a good tutorial with no errors in eclipse. It sure should be fine, the pom.xml too.
  • Appium server v1.22.3 is running in one instance
  • in Eclipse, I press the test Button Run as Testng Test
  • the server window starts writing many lines like it’s working

Problem is:

1.) The Server writes many lines when working (is this the Server log (What/where is a stack trace?))

But suddenly comes the last line:

[HTTP] <-- POST /wd/hub/session 500 4111 ms - 637
[HTTP]

1.b) at this moment the Eclipse console writes:

Server-side error occurred while processing Appium-server
Driver info: driver.version: AppiumDriver
org.openqa.selenium.SessionNotCreatedException: Unable to create a new remote session. Please check the server log for more details.
Original error: An unknown server-side error occurred while processing the command. Original error: 'app' option is required for reinstall
... 12 more

2.) The Test-App is not launching at mobile device But I have Android-Notification from Appium Settings ‘Keep this service running, so Appium for Android can work with system APIs’

My question is:

How can I find why <-- POST /wd/hub/session has State=500

Please tell how can I rectify this error

The server is running
[HTTP] Waiting until the server is closed

[HTTP] Received server close event

[Appium] Welcome to Appium v1.22.3

[Appium] Non-default server args:

[Appium] sessionOverride: true

[Appium] relaxedSecurityEnabled: true

[Appium] allowInsecure: {

[Appium] }

[Appium] denyInsecure: {

[Appium] }

[Appium] Appium REST http interface listener started on 0.0.0.0:4723

[HTTP] --> POST /wd/hub/session

[HTTP] {“desiredCapabilities”:{“app”:“C:\Users\User\git\knoxdrive\src\EFSS-debug.apk”,“automationName”:“uiautomator2”,“noReset”:“True”,“platformName”:“Android”,“deviceName”:“Appium”},“capabilities”:{“firstMatch”:[{“appium:app”:“C:\Users\User\git\knoxdrive\src\EFSS-debug.apk”,“appium:automationName”:“uiautomator2”,“appium:deviceName”:“Appium”,“appium:noReset”:“True”,“platformName”:“android”}]}}

[W3C] Calling AppiumDriver.createSession() with args: [{“app”:“C:\Users\User\git\knoxdrive\src\EFSS-debug.apk”,“automationName”:“uiautomator2”,“noReset”:“True”,“platformName”:“Android”,“deviceName”:“Appium”},null,{“firstMatch”:[{“appium:app”:“C:\Users\User\git\knoxdrive\src\EFSS-debug.apk”,“appium:automationName”:“uiautomator2”,“appium:deviceName”:“Appium”,“appium:noReset”:“True”,“platformName”:“android”}]}]

[BaseDriver] Event ‘newSessionRequested’ logged at 1669486884357 (23:51:24 GMT+0530 (India Standard Time))

[Appium] Could not parse W3C capabilities: ‘noReset’ must be of type boolean

[Appium] Trying to fix W3C capabilities by merging them with JSONWP caps

[BaseDriver] The following capabilities are not standard capabilities and should have an extension prefix:

[BaseDriver] app

[BaseDriver] automationName

[BaseDriver] deviceName

[BaseDriver] noReset

[Appium] Could not parse fixed W3C capabilities: ‘noReset’ must be of type boolean. Falling back to JSONWP protocol

[Appium] Appium v1.22.3 creating new AndroidUiautomator2Driver (v1.70.1) session

[Appium] There are no active sessions for cleanup

[Appium] Applying relaxed security to ‘AndroidUiautomator2Driver’ as per server command line argument. All insecure features will be enabled unless explicitly disabled by --deny-insecure

[BaseDriver] Creating session with MJSONWP desired capabilities: {

[BaseDriver] “app”: “C:\Users\User\git\knoxdrive\src\EFSS-debug.apk”,

[BaseDriver] “automationName”: “uiautomator2”,

[BaseDriver] “noReset”: “True”,

[BaseDriver] “platformName”: “Android”,

[BaseDriver] “deviceName”: “Appium”

[BaseDriver] }

[BaseDriver] Capability ‘noReset’ changed from string to boolean. This may cause unexpected behavior

[BaseDriver] Session created with session id: ad56c7ec-d5a5-44fc-bb6e-c67473173d19

[BaseDriver] Using local app ‘C:\Users\User\git\knoxdrive\src\EFSS-debug.apk’

[UiAutomator2] Checking whether app is actually present

[ADB] Using ‘adb.exe’ from ‘C:\Users\User\AppData\Local\Android\Sdk\platform-tools\adb.exe’

[ADB] Running ‘C:\Users\User\AppData\Local\Android\Sdk\platform-tools\adb.exe -P 5037 start-server’

[AndroidDriver] Retrieving device list

[ADB] Trying to find a connected android device

[ADB] Getting connected devices

[ADB] Connected devices: [{“udid”:“R9EM80C0D3J”,“state”:“device”}]

[AndroidDriver] Using device: R9EM80C0D3J

[ADB] Using ‘adb.exe’ from ‘C:\Users\User\AppData\Local\Android\Sdk\platform-tools\adb.exe’

[ADB] Running ‘C:\Users\User\AppData\Local\Android\Sdk\platform-tools\adb.exe -P 5037 start-server’

[ADB] Setting device id to R9EM80C0D3J

[ADB] Running ‘C:\Users\User\AppData\Local\Android\Sdk\platform-tools\adb.exe -P 5037 -s R9EM80C0D3J shell getprop ro.build.version.sdk’

[ADB] Current device property ‘ro.build.version.sdk’: 28

[ADB] Getting device platform version

[ADB] Running ‘C:\Users\User\AppData\Local\Android\Sdk\platform-tools\adb.exe -P 5037 -s R9EM80C0D3J shell getprop ro.build.version.release’

[ADB] Current device property ‘ro.build.version.release’: 9

[ADB] Device API level: 28

[UiAutomator2] Relaxing hidden api policy

[ADB] Running ‘C:\Users\User\AppData\Local\Android\Sdk\platform-tools\adb.exe -P 5037 -s R9EM80C0D3J shell ‘settings put global hidden_api_policy_pre_p_apps 1;settings put global hidden_api_policy_p_apps 1;settings put global hidden_api_policy 1’’

[AndroidDriver] Parsing package and activity from app manifest

[ADB] Package name: ‘com.sds.efss.drive’

[ADB] Main activity name: ‘com.sds.efss.drive.activity.BaseIntroActivity’

[AndroidDriver] Parsed package and activity are: com.sds.efss.drive/com.sds.efss.drive.activity.BaseIntroActivity

[ADB] Running ‘C:\Users\User\AppData\Local\Android\Sdk\platform-tools\adb.exe -P 5037 -s R9EM80C0D3J wait-for-device’

[ADB] Running ‘C:\Users\User\AppData\Local\Android\Sdk\platform-tools\adb.exe -P 5037 -s R9EM80C0D3J shell echo ping’

[AndroidDriver] Pushing settings apk to device…

[ADB] Getting install status for io.appium.settings

[ADB] Running ‘C:\Users\User\AppData\Local\Android\Sdk\platform-tools\adb.exe -P 5037 -s R9EM80C0D3J shell dumpsys package io.appium.settings’

[ADB] ‘io.appium.settings’ is not installed

[ADB] App ‘C:\Program Files\Appium Server GUI\resources\app\node_modules\appium\node_modules\io.appium.settings\apks\settings_apk-debug.apk’ is not installed

[ADB] Installing ‘C:\Program Files\Appium Server GUI\resources\app\node_modules\appium\node_modules\io.appium.settings\apks\settings_apk-debug.apk’

[ADB] Running ‘C:\Users\User\AppData\Local\Android\Sdk\platform-tools\adb.exe -P 5037 -s R9EM80C0D3J features’

[ADB] The application at ‘C:\Program Files\Appium Server GUI\resources\app\node_modules\appium\node_modules\io.appium.settings\apks\settings_apk-debug.apk’ will not be cached, because the device under test has confirmed the support of streamed installs

[ADB] Running ‘C:\Users\User\AppData\Local\Android\Sdk\platform-tools\adb.exe -P 5037 -s R9EM80C0D3J install -g ‘C:\Program Files\Appium Server GUI\resources\app\node_modules\appium\node_modules\io.appium.settings\apks\settings_apk-debug.apk’’

[ADB] Getting install status for io.appium.settings

[ADB] Running ‘C:\Users\User\AppData\Local\Android\Sdk\platform-tools\adb.exe -P 5037 -s R9EM80C0D3J shell dumpsys package io.appium.settings’

[ADB] ‘io.appium.settings’ is not installed

[ADB] App ‘C:\Program Files\Appium Server GUI\resources\app\node_modules\appium\node_modules\io.appium.settings\apks\settings_apk-debug.apk’ is not installed

[ADB] Installing ‘C:\Program Files\Appium Server GUI\resources\app\node_modules\appium\node_modules\io.appium.settings\apks\settings_apk-debug.apk’

[ADB] The application at ‘C:\Program Files\Appium Server GUI\resources\app\node_modules\appium\node_modules\io.appium.settings\apks\settings_apk-debug.apk’ will not be cached, because the device under test has confirmed the support of streamed installs

[ADB] Running ‘C:\Users\User\AppData\Local\Android\Sdk\platform-tools\adb.exe -P 5037 -s R9EM80C0D3J install -g ‘C:\Program Files\Appium Server GUI\resources\app\node_modules\appium\node_modules\io.appium.settings\apks\settings_apk-debug.apk’’

[UiAutomator2] Deleting UiAutomator2 session

[ADB] Running ‘C:\Users\User\AppData\Local\Android\Sdk\platform-tools\adb.exe -P 5037 -s R9EM80C0D3J shell am force-stop com.sds.efss.drive’

[UiAutomator2] Restoring hidden api policy to the device default configuration

[ADB] Running ‘C:\Users\User\AppData\Local\Android\Sdk\platform-tools\adb.exe -P 5037 -s R9EM80C0D3J shell ‘settings delete global hidden_api_policy_pre_p_apps;settings delete global hidden_api_policy_p_apps;settings delete global hidden_api_policy’’

[BaseDriver] Event ‘newSessionStarted’ logged at 1669486909880 (23:51:49 GMT+0530 (India Standard Time))

[MJSONWP] Encountered internal error running command: Error executing adbExec. Original error: ‘Command ‘C:\Users\User\AppData\Local\Android\Sdk\platform-tools\adb.exe -P 5037 -s R9EM80C0D3J install -g ‘C:\Program Files\Appium Server GUI\resources\app\node_modules\appium\node_modules\io.appium.settings\apks\settings_apk-debug.apk’’ exited with code 1’; Command output: adb: failed to install C:\Program Files\Appium Server GUI\resources\app\node_modules\appium\node_modules\io.appium.settings\apks\settings_apk-debug.apk:

[MJSONWP] Error: Command ‘C:\Users\User\AppData\Local\Android\Sdk\platform-tools\adb.exe -P 5037 -s R9EM80C0D3J install -g ‘C:\Program Files\Appium Server GUI\resources\app\node_modules\appium\node_modules\io.appium.settings\apks\settings_apk-debug.apk’’ exited with code 1

[MJSONWP] at ChildProcess. (C:\Program Files\Appium Server GUI\resources\app\node_modules\appium\node_modules\teen_process\lib\exec.js:113:19)

[MJSONWP] at ChildProcess.emit (events.js:310:20)

[MJSONWP] at maybeClose (internal/child_process.js:1021:16)

[MJSONWP] at Process.ChildProcess._handle.onexit (internal/child_process.js:286:5)

[HTTP] <-- POST /wd/hub/session 500 25525 ms - 671

[HTTP]

it looks like you need to add an “app” capability.
when you create an appium session you must specify the .apk path on your file system so appium will know where to take it from

and you don’t have to look at all the server logs… just try to look at the error it prints and in general, it is a good practice to look at the logs. very beneficial.

I tried adding app capability but error still exists and the appium server invokes but is not able to install the app on device