Hello,
I’m having trouble understanding the purpose of the SDK Platforms regarding automated testing with Appium. The documentation for the UiAutomator2 driver (which I’m using) clearly says “ensure you have installed the SDK for Android API levels you wish to automate (e.g., 24)”, plus I saw in this article that UiAutomator2 now produces APKs, so I thought that they were required to build those APKs for the Android version the device runs. But I’m able to run automated tests on real devices without having installed any SDK Platform.
Hypotheses
- They are only required when using emulators. But if that’s the case, why not put that instruction only in the “Emulator Setup” part of the documentation, instead of the “Basic Setup” part, which is related to both emulators AND real devices ?
- In my tests, I’m not doing any action that “requires” the SDK Platform. If that’s the case, what are those actions that I won’t be able to do unless I install the SDK Platforms ?
Could someone elaborate on this requirement please ?
Thanks in advance
Below are some additional information if that helps.
Environment
- Appium version that exhibits the issue: 1.10.1
- Desktop OS/version used to run Appium: Alpine Linux 3.6.0
- Node.js version: 7.10.1-r1
- Npm or Yarn package manager: 7.10.1-r1
- Mobile platform/version under test: Android 7.0 (API level 24)
- Real device: Samsung Galaxy J3 SM-J330FN
- Appium CLI or Appium.app|exe: Appium CLI
- UiAutomator2 server version: 2.7.0
Details
Here are some parts of the logs produced by the environment I’m using (I narrowed them to what I thought could be useful regarding UiAutomator2) :
Partial logs
[debug] [ADB] 'io.appium.uiautomator2.server' is installed
[debug] [ADB] The installed 'io.appium.uiautomator2.server' package does not require upgrade ('2.7.0' >= '2.7.0')
[debug] [ADB] 'io.appium.uiautomator2.server.test' is installed
[ADB] Cannot read version names of '/usr/lib/node_modules/appium/node_modules/appium-uiautomator2-server/apks/appium-uiautomator2-server-debug-androidTest.apk' and/or 'io.appium.uiautomator2.server.test'. Assuming correct app version is already installed
[debug] [UiAutomator2] Instrumentation 'io.appium.uiautomator2.server.test/android.support.test.runner.AndroidJUnitRunner' available
[debug] [UiAutomator2] Forwarding UiAutomator2 Server port 6790 to 8200
[debug] [UiAutomator2] No app capability. Assuming it is already on the device
[UiAutomator2] Starting uiautomator2 server 2.7.0
[UiAutomator2] Using UIAutomator2 server from '/usr/lib/node_modules/appium/node_modules/appium-uiautomator2-server/apks/appium-uiautomator2-server-v2.7.0.apk' and test from '/usr/lib/node_modules/appium/node_modules/appium-uiautomator2-server/apks/appium-uiautomator2-server-debug-androidTest.apk'
[UiAutomator2] Running command: 'adb -s <SERIAL_NUMBER> shell am instrument -w io.appium.uiautomator2.server.test/android.support.test.runner.AndroidJUnitRunner'
[UiAutomator2] Waiting up to 20000ms for UiAutomator2 to be online...
[debug] [UiAutomator2] Instrumentation 'io.appium.uiautomator2.server.test/android.support.test.runner.AndroidJUnitRunner' available
[UiAutomator2] UiAutomator2 did not start the activity we were waiting for, <MY_APP_ACTIVITY>. Starting it ourselves
[Appium] New AndroidUiautomator2Driver session created successfully, session <MY_SESSION_ID> added to master session list
[Appium] Removing session <MY_SESSION_ID> from our master session list
[debug] [UiAutomator2] Deleting UiAutomator2 session
[debug] [UiAutomator2] Deleting UiAutomator2 server session
[debug] [UiAutomator2] [UIAutomator2] io.appium.uiautomator2.server.test.AppiumUiAutomator2Server:.
[debug] [UiAutomator2] [UIAutomator2] Time: 40,063
[debug] [UiAutomator2] [UIAutomator2] OK (1 test)
And here is the part related to the capabilities that I extracted from the logs :
Capabilities
{
"desiredCapabilities": {
"platform": "LINUX",
"webStorageEnabled": false,
"takesScreenshot": true,
"javascriptEnabled": true,
"databaseEnabled": false,
"networkConnectionEnabled": true,
"locationContextEnabled": false,
"warnings": {},
"desired": {
"platformName": "Android",
"platformVersion": "7.0.0",
"deviceName": <MY_DEVICE_NAME>,
"udid": <MY_DEVICE_UDID>,
"appPackage": <MY_APP_PACKAGE>,
"appActivity": <MY_APP_ACTIVITY>,
"noReset": true,
"automationName": "uiautomator2"
},
"platformName": "Android",
"platformVersion": "7.0.0",
"deviceName": <MY_DEVICE_UDID>,
"udid": <MY_DEVICE_UDID>,
"appPackage": <MY_APP_PACKAGE>,
"appActivity": <MY_APP_ACTIVITY>,
"noReset": true,
"automationName": "uiautomator2",
"deviceUDID": <MY_DEVICE_UDID>
}
}