AndroidUiautomator2Driver not created at first test in M1 Chip

Hi all,

I’m using M1 chip : MacPro with below details for my appium automation.Before I used Intel, same framework is used to fine, now I’m using M1 chip. I have other configuration for M1 in bash profile.

While running, I noticed My UIAutomator2 server is not running in my first test, it started working after 3rd test. My emulator is not loading quite well at first test, then automatically it starts working fine after few test.

I din’t understand it’s my driver issue or emulator issue
Intelli J : IntelliJ IDEA 2022.1.3
serenity.version:2.3.12
java-client : 8.0.0
selenium-java:3.141.59
UIAutomator2 server 4.27.0

Scenario: Valid customer login to the App from Account page # src/test/resources/features/Account/AccountSignIn.feature:8
2022-07-25 11:17:52 INFO SerenityReporter:194 - Running feature from
2022-07-25 11:17:52 INFO :148 -


|_ | / __| | / __| |/ \ | _ _ | | _ \
| | | | _
\ | | _
\ | | / _ \ | |
) || | | | | | | |
| | | |
___) || | ___) || |/ ___ | _ < | | | |
| |
| |
|
| |_____|
/ || |/ |// __| _|| |_____|___/


[Appium] Welcome to Appium v1.22.3
[Appium] Non-default server args:
[Appium] address: 127.0.0.1
[Appium] loglevel: info
[Appium] avd: Pixel_2_API_30
[Appium] Deprecated server args:
[Appium] --avd => --default-capabilities
[Appium] Default capabilities, which will be added to each request unless overridden by desired capabilities:
[Appium] avd: Pixel_2_API_30
[Appium] Appium REST http interface listener started on 127.0.0.1:4723
[HTTP] --> POST /wd/hub/session

You have all these warnings in your log and an indication that not fixing these may affect performance. Can I ask why you choose not to fix these? This really seems like a setup issue.

For capabilities you can reference this link for what values should be supplied. Note that there is a big difference between 1000 and ‘1000’, and, false and ‘false’:

https://appium.io/docs/en/writing-running-appium/caps/

M1 chip seems like a red herring.

Hi Wreed. Thanks for looking, yeah i fixed those warnings. But still notice my emulator loads slowly ,sometimes cold boot resolves the issue.but not every time.

[Appium] Welcome to Appium v1.22.3
[Appium] Non-default server args:
[Appium] address: 127.0.0.1
[Appium] loglevel: info
[Appium] avd: Pixel_2_API_30
[Appium] Deprecated server args:
[Appium] --avd => --default-capabilities
[Appium] Default capabilities, which will be added to each request unless overridden by desired capabilities:
[Appium] avd: Pixel_2_API_30
[Appium] Appium REST http interface listener started on 127.0.0.1:4723


[BaseDriver] The following capabilities are not standard capabilities and should have an extension prefix:
[BaseDriver] host
[BaseDriver] js
[BaseDriver] loggingPrefs
[BaseDriver] port
[BaseDriver] avd
[BaseDriver] Number capability passed in as string. Functionality may be compromised.
[Appium] Appium v1.22.3 creating new AndroidUiautomator2Driver (v1.70.1) session
[BaseDriver] Number capability passed in as string. Functionality may be compromised.
[BaseDriver] Capability ‘fullReset’ changed from string to boolean. This may cause unexpected behavior
[BaseDriver] Capability ‘allowTestPackages’ changed from string to boolean. This may cause unexpected behavior
[BaseDriver] Capability ‘newCommandTimeout’ changed from string (‘1000’) to integer (1000). This may cause unexpected behavior
[BaseDriver] The following capabilities were provided, but are not recognized by Appium:
[BaseDriver] host
[BaseDriver] js
[BaseDriver] loggingPrefs
[BaseDriver] port
[BaseDriver] autoAcceptAlerts
[BaseDriver] autoDismissAlerts
[BaseDriver] Session created with session id: 750fc18b-79d1-463f-9803-a152b198ff03
net.thucydides.core.webdriver.DriverConfigurationError: Could not instantiate class io.appium.java_client.AppiumDriver

Build info: version: ‘3.141.59’, revision: ‘e82be7d358’, time: ‘2018-11-14T08:17:03’
System info: host: ‘ITM306880’, ip: ‘2406:e003:1055:b101:c1d2:372d:8c39:6860%en0’, os.name: ‘Mac OS X’, os.arch: ‘x86_64’, os.version: ‘10.16’, java.version: ‘1.8.0_242-release’
Driver info: driver.version: AndroidDriver
remote stacktrace: UnknownError: An unknown server-side error occurred while processing the command. Original error: Error executing adbExec. Original error: ‘Command ‘/Users/390099/Library/Android/Sdk/platform-tools/adb -P 5037 -s emulator-5554 shell ‘settings delete global hidden_api_policy_pre_p_apps;settings delete global hidden_api_policy_p_apps;settings delete global hidden_api_policy’’ exited with code 20’; Command output: cmd: Can’t find service: settings
cmd: Can’t find service: settings
cmd: Can’t find service: settings

Did you post the wrong log? Still seeing same errors.

It looks like you have errors in both Appium and the underlying ADB. I think you can fix Appium errors by fixing the capabilities as noted above. Maybe try clean install for ADB?

Thanks Wreed for guidance. All above issues are resolved. M1 chip having compatible issue with old android studio. I downloaded latest one, then above issue is resolved. I have set capability in class than property file.

1 Like

I’m glad this worked for you. Good luck!

1 Like

Although you solved it. Please note:

  1. when you create an avd (emulator) with android studios’s UI, make sure you choose an ARM Image (ABI: arm64-v8a) which is compatible for a M1 device and that’s why your emulator might not function well as you mentioned.
  2. I updated my repo to use java-client 8.0.0 and it has an issue with the plafotmName capability which was fixed in version 8.1.1 (java-client release notes
    ) so I had to update. If I remember correctly, it caused different errors regarding the “settings delete global hidden_api_policy_p_apps” so it maybe worth to update your client as well if it will happen again.
1 Like

Thanks for suggestion.I’m getting error ( Dependency Not found) ,if i change Java client as 8.1.1. What’s your maven version?Mine as follows.

<serenity.version>2.3.12</serenity.version>
<serenity.maven.version>2.3.12</serenity.maven.version>
<serenity.cucumber.version>2.3.12</serenity.cucumber.version>
<cucumber.version>6.9.1</cucumber.version>

mine is: 3.8.1
after you changed the dependency you need to refresh/sync it with maven.
run in terminal mvn clean test-compile

copy from here: https://mvnrepository.com/artifact/io.appium/java-client/8.1.1

1 Like