I’ve been using Appium on a virtual Android device (started from Android Studio) without issue for a while now. Yesterday morning I updated Android Studio, and since then I haven’t been able to use Appium anymore. The inspector which I try to run gives the following error message:
An unknown server-side error occurred while processing the command. Original error: Error getting device API level. Original error: Error executing adbExec. Original error: ‘Command ‘C:\Users\stefane\AppData\Local\Android\Sdk\platform-tools\adb.exe -P 5037 -s emulator-5554 shell getprop ro.build.version.sdk’ exited with code 3221226356’; Stderr: ‘’; Code: ‘3221226356’
Interestingly, when I run that command manually in a command prompt, it works without issue.
This has been occuring on a Windows 10 machine, running Android Studio 3.4.1 and using Android SDK 29.0.0, and running Appium 1.13. My AVD runs Android 8.1 (API level 27).
I have tried to reinstall both Appium and Android Studio (also deleting the Android SDK folder, so that was reinstalled as well), and I have downgraded my Android SDK to 28.0.0 and later 27.0.0, all without success. I have also created a new AVD (same Android version), but no luck there either.
The capabilities I use for the Appium inspector are as follows:
{
“platformName”: “Android”,
“deviceName”: “Pixel 2”,
“app”: “/Users/stefane/Downloads/app-qa-930-169.apk”,
“automationName”: “uiautomator2”
}
The logs show the following:
[MJSONWP] Calling AppiumDriver.createSession() with args: [{“app”:"/Users/stefane/Downloads/app-qa-930-169.apk",“automationName”:“uiautomator2”,“deviceName”:“Pixel 2”,“platformName”:“Android”,“newCommandTimeout”:0,“connectHardwareKeyboard”:true},null,null]
[BaseDriver] Event ‘newSessionRequested’ logged at 1559891899074 (09:18:19 GMT+0200 (West-Europa (zomertijd)))
[Appium] Appium v1.13.0 creating new AndroidUiautomator2Driver (v1.33.1) session
[Appium] Capabilities:
[Appium] app: /Users/stefane/Downloads/app-qa-930-169.apk
[Appium] automationName: uiautomator2
[Appium] deviceName: Pixel 2
[Appium] platformName: Android
[Appium] newCommandTimeout: 0
[Appium] connectHardwareKeyboard: true
[BaseDriver] Creating session with MJSONWP desired capabilities: {“app”:"/Users/stefane/Down…
[BaseDriver] The following capabilities were provided, but are not recognized by appium: connectHardwareKeyboard.
[BaseDriver] Session created with session id: 76d2ca20-6c7a-44bc-a16f-80313b0f8400
[BaseDriver] Using local app ‘/Users/stefane/Downloads/app-qa-930-169.apk’
[UiAutomator2] Checking whether app is actually present
[ADB] Found 1 ‘build-tools’ folders under ‘C:\Users\stefane\AppData\Local\Android\Sdk’ (newest first):
[ADB] C:/Users/stefane/AppData/Local/Android/Sdk/build-tools/29.0.0
[ADB] Using ‘adb.exe’ from ‘C:\Users\stefane\AppData\Local\Android\Sdk\platform-tools\adb.exe’
[AndroidDriver] Retrieving device list
[ADB] Trying to find a connected android device
[ADB] Getting connected devices…
[ADB] 1 device(s) connected
[AndroidDriver] Using device: emulator-5554
[ADB] Using ‘adb.exe’ from ‘C:\Users\stefane\AppData\Local\Android\Sdk\platform-tools\adb.exe’
[ADB] Setting device id to emulator-5554
[ADB] Running ‘C:\Users\stefane\AppData\Local\Android\Sdk\platform-tools\adb.exe -P 5037 -s emulator-5554 shell getprop ro.build.version.sdk’
[UiAutomator2] Deleting UiAutomator2 session
[ADB] Removing forwarded port socket connection: 8200
[ADB] Running ‘C:\Users\stefane\AppData\Local\Android\Sdk\platform-tools\adb.exe -P 5037 -s emulator-5554 forward --remove tcp:8200’
[UiAutomator2] Unable to remove port forward ‘Error executing adbExec. Original error: ‘Command ‘C:\Users\stefane\AppData\Local\Android\Sdk\platform-tools\adb.exe -P 5037 -s emulator-5554 forward --remove tcp:8200’ exited with code 1’; Stderr: ‘adb.exe: error: listener ‘tcp:8200’ not found’; Code: ‘1’’
[ADB] Running ‘C:\Users\stefane\AppData\Local\Android\Sdk\platform-tools\adb.exe -P 5037 -s emulator-5554 shell getprop ro.build.version.sdk’
[BaseDriver] Event ‘newSessionStarted’ logged at 1559891919493 (09:18:39 GMT+0200 (West-Europa (zomertijd)))
[MJSONWP] Encountered internal error running command: Error: Error getting device API level. Original error: Error executing adbExec. Original error: ‘Command ‘C:\Users\stefane\AppData\Local\Android\Sdk\platform-tools\adb.exe -P 5037 -s emulator-5554 shell getprop ro.build.version.sdk’ exited with code 3221226356’; Stderr: ‘’; Code: ‘3221226356’
[MJSONWP] at ADB. (C:\Users\stefane\AppData\Local\Programs\Appium\resources\app\node_modules\appium\node_modules\appium-adb\lib\tools\adb-commands.js:98:13)
[MJSONWP] at Generator.throw ()
[MJSONWP] at asyncGeneratorStep (C:\Users\stefane\AppData\Local\Programs\Appium\resources\app\node_modules\appium\node_modules@babel\runtime\helpers\asyncToGenerator.js:3:24)
[MJSONWP] at _throw (C:\Users\stefane\AppData\Local\Programs\Appium\resources\app\node_modules\appium\node_modules@babel\runtime\helpers\asyncToGenerator.js:29:9)
[MJSONWP] at run (C:\Users\stefane\AppData\Local\Programs\Appium\resources\app\node_modules\appium\node_modules\core-js\modules\es6.promise.js:75:22)
[MJSONWP] at C:\Users\stefane\AppData\Local\Programs\Appium\resources\app\node_modules\appium\node_modules\core-js\modules\es6.promise.js:92:30
[MJSONWP] at flush (C:\Users\stefane\AppData\Local\Programs\Appium\resources\app\node_modules\appium\node_modules\core-js\modules_microtask.js:18:9)
[MJSONWP] at process._tickCallback (internal/process/next_tick.js:61:11)
Would anyone here know what the issue is, or where I can look into this further?
Cheers,
Stefan