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 file:///Users/390099/Documents/repo/mob-qa-nlapp-android/src/test/resources/features/Account/AccountSignIn.feature
2022-07-25 11:17:52 INFO :148 -


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

Valid customer login to the Yellow App from Account page(signin-yellow-app-from-account-page;valid-customer-login-to-the-yellow-app-from-account-page)

[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
[HTTP] {“desiredCapabilities”:{“app”:".//src/test/resources/APK/NoelLeeming-qat-release.apk",“appPackage”:“nz.co.noelleeming.mynlapp.qat”,“allowTestPackages”:“true”,“loggingPrefs”:{},“autoDismissAlerts”:“true”,“js”:"/opt/homebrew/lib/node_modules/appium/build/lib/main.js",“deviceName”:“Pixel_2_API_30”,“fullReset”:“true”,“appActivity”:“nz.co.noelleeming.mynlapp.boot.SplashScreenActivity”,“chromedriverExecutable”:".//src//test//resources//BrowserDrivers//chromedriver.exe",“port”:“4723”,“newCommandTimeout”:“1000”,“automationName”:“uiautomator2”,“host”:“127.0.0.1”,“platformName”:“Android”,“autoAcceptAlerts”:“true”},“capabilities”:{“firstMatch”:[{“appium:allowTestPackages”:“true”,“appium:app”:".//src/test/resources/APK/NoelLeeming-qat-release.apk",“appium:appActivity”:“nz.co.noelleeming.mynlapp.boot.SplashScreenActivity”,“appium:appPackage”:“nz.co.noelleeming.mynlapp.qat”,“appium:autoAcceptAlerts”:“true”,“appium:autoDismissAlerts”:“true”,“appium:automationName”:“uiautomator2”,“appium:chromedriverExecutable”:".//src//t…
[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: 616e1697-f9e4-4496-b2b6-9d286f4d06af
[BaseDriver] Using local app ‘.//src/test/resources/APK/NoelLeeming-qat-release.apk’
[BaseDriver] The current application path ‘.//src/test/resources/APK/NoelLeeming-qat-release.apk’ is not absolute and has been rewritten to ‘/Users/390099/Documents/repo/mob-qa-nlapp-android/src/test/resources/APK/NoelLeeming-qat-release.apk’. Consider using absolute paths rather than relative
[ADB] Found 2 ‘build-tools’ folders under ‘/Users/390099/Library/Android/Sdk’ (newest first):
[ADB] /Users/390099/Library/Android/Sdk/build-tools/33.0.0
[ADB] /Users/390099/Library/Android/Sdk/build-tools/30.0.3
[ADB] Using ‘adb’ from ‘/Users/390099/Library/Android/Sdk/platform-tools/adb’
[ADB] Using ‘emulator’ from ‘/Users/390099/Library/Android/Sdk/emulator/emulator’
[ADB] [AVD OUTPUT] WARNING | unexpected system image feature string, emulator might not function correctly, please try updating the emulator.
[ADB] [AVD OUTPUT] WARNING | cannot add library /Users/390099/Library/Android/sdk/emulator/qemu/darwin-aarch64/lib64/vulkan/libvulkan.dylib: failed
[ADB] [AVD OUTPUT] INFO | Warning: QMetaObject::connectSlotsByName: No matching signal for on_new_posture_requested(int) ((null):0, (null))
[ADB] [AVD OUTPUT] INFO | Warning: QMetaObject::connectSlotsByName: No matching signal for on_dismiss_posture_selection_dialog() ((null):0, (null))
[ADB] [AVD OUTPUT] INFO | Warning: QMetaObject::connectSlotsByName: No matching signal for on_new_resizable_requested(PresetEmulatorSizeType) ((null):0, (null))
[ADB] [AVD OUTPUT] INFO | Warning: QMetaObject::connectSlotsByName: No matching signal for on_dismiss_resizable_dialog() ((null):0, (null))
[ADB] [AVD OUTPUT] INFO | added library /Users/390099/Library/Android/sdk/emulator/lib64/vulkan/libvulkan.dylib
[ADB] [AVD OUTPUT] INFO | configAndStartRenderer: setting vsync to 60 hz
[ADB] [AVD OUTPUT] INFO | Sending adb public key [QAAAAEV2GCpz0+gzbLIZKM7jw5kzGuhNSv980n7BHJqXINuRpd7AVPKc8YPY3aVfJUWMObZoEbgFedt8lWoza/cRIbYrJpYYsfk8BMVlNeXfCQH3hQwrgSw0Lc3euiBzb8jVBDvCpLX6vQJtZMZof7Ex1oXJebDFHwCLaC7Bq2CG0LaauUM5JN9Gxv804KmXtNgwwerhqROPAPoY+SKjM1enTeEI5vFtmtY0WBvyuX06r8gQ+YLDfOSV4GHV5N/SBa8FTyrX8+DT7PrUYCeVTIYUmpKU0mRbQQzmZyvo7z3QZilc1DybpF5bZx6aM2feMLATeFN5prqZrWApEVq0zxDvBdTfgEa4wiPg/0us6K0u8lTV4KJselreGpd6GmIot4Iq61snN9J3ns0dUbXQUPIm4aVodfS/d/Hf1beg7lgDroQ3vFyoXsAFHQdUqr/gJGiHzzNLFyCzcyezhyKYFTws59pC47mOlZNxy3N2EFONxJUkHHJ5UXWMg/WaDxdr0Z5OnF0bTfe8WZMHVl4BBnmWtFwjwE5KAHdSzqYPo7jMRHGzrAz5L7t4lbq7sxU7sKPM8A4DiPrjwEPpL/hLHm6HxCKjeAjaDXgTNkz8zj7yTfdw7pae0uwxrvzv2v/nO5wA9WJwdT2pg0ypQlrS2PWidOhV619bWw9ereUUnhdjcxC3N7NXigEAAQA= [email protected]]
[ADB] [AVD OUTPUT] INFO | Rootcanal has been activated.
[ADB] [AVD OUTPUT] INFO | Started GRPC server at 127.0.0.1:8554, security: Local
[ADB] [AVD OUTPUT] INFO | Advertising in: /Users/390099/Library/Caches/TemporaryItems/avd/running/pid_5809.ini
[AndroidDriver] Using device: emulator-5554
[ADB] Using ‘adb’ from ‘/Users/390099/Library/Android/Sdk/platform-tools/adb’
[ADB] Getting device platform version
[UiAutomator2] Relaxing hidden api policy
[UiAutomator2] Unable to force stop app: Error executing adbExec. Original error: ‘Command ‘/Users/390099/Library/Android/Sdk/platform-tools/adb -P 5037 -s emulator-5554 shell am force-stop nz.co.noelleeming.mynlapp.qat’ exited with code 20’; Command output: cmd: Can’t find service: activity
[UiAutomator2]
[ADB] nz.co.noelleeming.mynlapp.qat was not uninstalled, because it was not present on the device
[UiAutomator2] Restoring hidden api policy to the device default configuration
[HTTP] <-- POST /wd/hub/session 500 10185 ms - 1347
[HTTP]
2022-07-25 11:18:04 WARN PageFactory:49 - Failed to instantiate page of type class com.TWG.nlapp.pages.HamburgerPage ({})
net.thucydides.core.webdriver.DriverConfigurationError: Could not instantiate class io.appium.java_client.AppiumDriver
at net.thucydides.core.webdriver.WebDriverFacade.newDriverInstance(WebDriverFacade.java:144)
at net.thucydides.core.webdriver.WebDriverFacade.newProxyDriver(WebDriverFacade.java:132)
at net.thucydides.core.webdriver.WebDriverFacade.getProxiedDriver(WebDriverFacade.java:102)
at com.TWG.nlapp.pages.AppiumPageObject$1.apply(AppiumPageObject.java:235)
at com.TWG.nlapp.pages.AppiumPageObject$1.apply(AppiumPageObject.java:231)
at net.serenitybdd.core.pages.PageObject.(PageObject.java:140)
at com.TWG.nlapp.pages.AppiumPageObject.(AppiumPageObject.java:231)
at com.TWG.nlapp.pages.HamburgerPage.(HamburgerPage.java:13)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at net.thucydides.core.pages.PageFactory.createFromConstructorWithWebdriver(PageFactory.java:98)
at net.thucydides.core.pages.PageFactory.createPageOfType(PageFactory.java:40)
at net.thucydides.core.steps.PageObjectDependencyInjector.instantiatePageObjectIfNotAssigned(PageObjectDependencyInjector.java:85)
at net.thucydides.core.steps.PageObjectDependencyInjector.injectDependenciesInto(PageObjectDependencyInjector.java:52)
at net.thucydides.core.steps.StepFactory.injectOtherDependenciesInto(StepFactory.java:206)
at net.thucydides.core.steps.StepFactory.instantiateNewStepLibraryFor(StepFactory.java:196)
at net.thucydides.core.steps.StepFactory.instantiateNewStepLibraryFor(StepFactory.java:177)
at net.thucydides.core.steps.StepFactory.getNewStepLibraryFor(StepFactory.java:124)
at net.thucydides.core.steps.IndividualInstancesByDefaultStepCreationStrategy.initiateStepsFor(IndividualInstancesByDefaultStepCreationStrategy.java:16)
at net.thucydides.core.steps.StepAnnotations.instantiateAnyUnitiaializedSteps(StepAnnotations.java:80)
at net.thucydides.core.steps.StepAnnotations.instanciateScenarioStepFields(StepAnnotations.java:61)
at net.thucydides.core.steps.StepAnnotations.injectScenarioStepsInto(StepAnnotations.java:43)
at net.serenitybdd.core.Serenity.injectScenarioStepsInto(Serenity.java:141)
at net.serenitybdd.core.Serenity.initializeWithNoStepListener(Serenity.java:107)
at cucumber.runtime.SerenityObjectFactory.newInstance(SerenityObjectFactory.java:75)
at cucumber.runtime.SerenityObjectFactory.cacheNewInstance(SerenityObjectFactory.java:58)
at cucumber.runtime.SerenityObjectFactory.getInstance(SerenityObjectFactory.java:48)
at io.cucumber.java.AbstractGlueDefinition.invokeMethod(AbstractGlueDefinition.java:47)
at io.cucumber.java.JavaStepDefinition.execute(JavaStepDefinition.java:29)
at io.cucumber.core.runner.CoreStepDefinition.execute(CoreStepDefinition.java:66)
at io.cucumber.core.runner.PickleStepDefinitionMatch.runStep(PickleStepDefinitionMatch.java:63)
at io.cucumber.core.runner.TestStep.executeStep(TestStep.java:92)
at io.cucumber.core.runner.TestStep.run(TestStep.java:63)
at io.cucumber.core.runner.PickleStepTestStep.run(PickleStepTestStep.java:49)
at io.cucumber.core.runner.TestCase.run(TestCase.java:99)
at io.cucumber.core.runner.Runner.runPickle(Runner.java:71)
at io.cucumber.junit.PickleRunners$NoStepDescriptions.run(PickleRunners.java:151)
at io.cucumber.junit.FeatureRunner.runChild(FeatureRunner.java:135)
at io.cucumber.junit.FeatureRunner.runChild(FeatureRunner.java:27)
at org.junit.runners.ParentRunner$4.run(ParentRunner.java:331)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:79)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:329)
at org.junit.runners.ParentRunner.access$100(ParentRunner.java:66)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:293)
at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
at org.junit.runners.ParentRunner.run(ParentRunner.java:413)
at io.cucumber.junit.CucumberSerenityRunner.runChild(CucumberSerenityRunner.java:234)
at io.cucumber.junit.CucumberSerenityRunner.runChild(CucumberSerenityRunner.java:57)
at org.junit.runners.ParentRunner$4.run(ParentRunner.java:331)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:79)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:329)
at org.junit.runners.ParentRunner.access$100(ParentRunner.java:66)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:293)
at io.cucumber.junit.CucumberSerenityRunner$RunCucumber.evaluate(CucumberSerenityRunner.java:262)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
at org.junit.runners.ParentRunner.run(ParentRunner.java:413)
at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:69)
at com.intellij.rt.junit.IdeaTestRunner$Repeater$1.execute(IdeaTestRunner.java:38)
at com.intellij.rt.execution.junit.TestsRepeater.repeat(TestsRepeater.java:11)
at com.intellij.rt.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:35)
at com.intellij.rt.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:235)
at com.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:54)
Caused by: net.thucydides.core.webdriver.DriverConfigurationError: Could not instantiate new WebDriver instance of type class io.appium.java_client.AppiumDriver (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: 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

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

at getResponseForW3CError (/opt/homebrew/lib/node_modules/appium/node_modules/appium-base-driver/lib/protocol/errors.js:804:9)
at asyncHandler (/opt/homebrew/lib/node_modules/appium/node_modules/appium-base-driver/lib/protocol/protocol.js:380:37)

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). See below for more details.
at net.thucydides.core.webdriver.WebDriverFactory.newWebdriverInstance(WebDriverFactory.java:159)
at net.thucydides.core.webdriver.WebDriverFacade.newDriverInstance(WebDriverFacade.java:141)
… 66 more
Caused by: 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: 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

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

at getResponseForW3CError (/opt/homebrew/lib/node_modules/appium/node_modules/appium-base-driver/lib/protocol/errors.js:804:9)
at asyncHandler (/opt/homebrew/lib/node_modules/appium/node_modules/appium-base-driver/lib/protocol/protocol.js:380:37)

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
at io.appium.java_client.remote.AppiumCommandExecutor$1.createSession(AppiumCommandExecutor.java:208)
at io.appium.java_client.remote.AppiumCommandExecutor.createSession(AppiumCommandExecutor.java:217)
at io.appium.java_client.remote.AppiumCommandExecutor.execute(AppiumCommandExecutor.java:239)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:552)
at io.appium.java_client.DefaultGenericMobileDriver.execute(DefaultGenericMobileDriver.java:41)
at io.appium.java_client.AppiumDriver.execute(AppiumDriver.java:1)
at io.appium.java_client.android.AndroidDriver.execute(AndroidDriver.java:1)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:213)
at io.appium.java_client.AppiumDriver.startSession(AppiumDriver.java:336)
at org.openqa.selenium.remote.RemoteWebDriver.(RemoteWebDriver.java:131)
at io.appium.java_client.DefaultGenericMobileDriver.(DefaultGenericMobileDriver.java:37)
at io.appium.java_client.AppiumDriver.(AppiumDriver.java:88)
at io.appium.java_client.AppiumDriver.(AppiumDriver.java:98)
at io.appium.java_client.android.AndroidDriver.(AndroidDriver.java:94)
at net.serenitybdd.core.webdriver.driverproviders.AppiumDriverProvider.newDriverUsingExternalServer(AppiumDriverProvider.java:59)
at net.serenitybdd.core.webdriver.driverproviders.AppiumDriverProvider.newInstance(AppiumDriverProvider.java:47)
at net.thucydides.core.webdriver.WebDriverFactory.createWebDriver(WebDriverFactory.java:170)
at net.thucydides.core.webdriver.WebDriverFactory.newWebdriverInstance(WebDriverFactory.java:151)
… 67 more
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at io.appium.java_client.remote.AppiumCommandExecutor$1.createSession(AppiumCommandExecutor.java:186)
… 84 more
Caused by: org.openqa.selenium.WebDriverException: 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

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

at getResponseForW3CError (/opt/homebrew/lib/node_modules/appium/node_modules/appium-base-driver/lib/protocol/errors.js:804:9)
at asyncHandler (/opt/homebrew/lib/node_modules/appium/node_modules/appium-base-driver/lib/protocol/protocol.js:380:37)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at org.openqa.selenium.remote.W3CHandshakeResponse.lambda$errorHandler$0(W3CHandshakeResponse.java:62)
at org.openqa.selenium.remote.HandshakeResponse.lambda$getResponseFunction$0(HandshakeResponse.java:30)
at org.openqa.selenium.remote.ProtocolHandshake.lambda$createSession$0(ProtocolHandshake.java:126)
at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193)
at java.util.Spliterators$ArraySpliterator.tryAdvance(Spliterators.java:958)
at java.util.stream.ReferencePipeline.forEachWithCancel(ReferencePipeline.java:126)
at java.util.stream.AbstractPipeline.copyIntoWithCancel(AbstractPipeline.java:499)
at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:486)
at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:472)
at java.util.stream.FindOps$FindOp.evaluateSequential(FindOps.java:152)
at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
at java.util.stream.ReferencePipeline.findFirst(ReferencePipeline.java:531)
at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:128)
... 89 more

Given The customer launch Yellow App # com.TWG.nlapp.stepDefinitions.Cucumber.CommonStepDef.TheCustomerLaunchYellowApp()
net.thucydides.core.pages.WrongPageError: The page object class com.TWG.nlapp.pages.HamburgerPage could not be instantiated:
Failed to instantiate page (net.thucydides.core.webdriver.DriverConfigurationError: Could not instantiate class io.appium.java_client.AppiumDriver)
at net.thucydides.core.pages.PageFactory.thisPageObjectLooksDodgy(PageFactory.java:103)
at net.thucydides.core.pages.PageFactory.createPageOfType(PageFactory.java:50)
at net.thucydides.core.steps.PageObjectDependencyInjector.instantiatePageObjectIfNotAssigned(PageObjectDependencyInjector.java:85)
at net.thucydides.core.steps.PageObjectDependencyInjector.injectDependenciesInto(PageObjectDependencyInjector.java:52)
at net.thucydides.core.steps.StepFactory.injectOtherDependenciesInto(StepFactory.java:206)
at net.thucydides.core.steps.StepFactory.instantiateNewStepLibraryFor(StepFactory.java:196)
at net.thucydides.core.steps.StepFactory.instantiateNewStepLibraryFor(StepFactory.java:177)
at net.thucydides.core.steps.StepFactory.getNewStepLibraryFor(StepFactory.java:124)
at net.thucydides.core.steps.IndividualInstancesByDefaultStepCreationStrategy.initiateStepsFor(IndividualInstancesByDefaultStepCreationStrategy.java:16)
at net.thucydides.core.steps.StepAnnotations.instantiateAnyUnitiaializedSteps(StepAnnotations.java:80)
at net.thucydides.core.steps.StepAnnotations.instanciateScenarioStepFields(StepAnnotations.java:61)
at net.thucydides.core.steps.StepAnnotations.injectScenarioStepsInto(StepAnnotations.java:43)
at net.serenitybdd.core.Serenity.injectScenarioStepsInto(Serenity.java:141)
at net.serenitybdd.core.Serenity.initializeWithNoStepListener(Serenity.java:107)
at cucumber.runtime.SerenityObjectFactory.newInstance(SerenityObjectFactory.java:75)
at cucumber.runtime.SerenityObjectFactory.cacheNewInstance(SerenityObjectFactory.java:58)
at cucumber.runtime.SerenityObjectFactory.getInstance(SerenityObjectFactory.java:48)
at io.cucumber.java.AbstractGlueDefinition.invokeMethod(AbstractGlueDefinition.java:47)
at io.cucumber.java.JavaStepDefinition.execute(JavaStepDefinition.java:29)
at io.cucumber.core.runner.CoreStepDefinition.execute(CoreStepDefinition.java:66)
at io.cucumber.core.runner.PickleStepDefinitionMatch.runStep(PickleStepDefinitionMatch.java:63)
at io.cucumber.core.runner.TestStep.executeStep(TestStep.java:92)
at io.cucumber.core.runner.TestStep.run(TestStep.java:63)
at io.cucumber.core.runner.PickleStepTestStep.run(PickleStepTestStep.java:49)
at io.cucumber.core.runner.TestCase.run(TestCase.java:99)
at io.cucumber.core.runner.Runner.runPickle(Runner.java:71)
at io.cucumber.junit.PickleRunners$NoStepDescriptions.run(PickleRunners.java:151)
at io.cucumber.junit.FeatureRunner.runChild(FeatureRunner.java:135)
at io.cucumber.junit.FeatureRunner.runChild(FeatureRunner.java:27)
at org.junit.runners.ParentRunner$4.run(ParentRunner.java:331)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:79)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:329)
at org.junit.runners.ParentRunner.access$100(ParentRunner.java:66)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:293)
at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
at org.junit.runners.ParentRunner.run(ParentRunner.java:413)
at io.cucumber.junit.CucumberSerenityRunner.runChild(CucumberSerenityRunner.java:234)
at io.cucumber.junit.CucumberSerenityRunner.runChild(CucumberSerenityRunner.java:57)
at org.junit.runners.ParentRunner$4.run(ParentRunner.java:331)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:79)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:329)
at org.junit.runners.ParentRunner.access$100(ParentRunner.java:66)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:293)
at io.cucumber.junit.CucumberSerenityRunner$RunCucumber.evaluate(CucumberSerenityRunner.java:262)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
at org.junit.runners.ParentRunner.run(ParentRunner.java:413)
at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:69)
at com.intellij.rt.junit.IdeaTestRunner$Repeater$1.execute(IdeaTestRunner.java:38)
at com.intellij.rt.execution.junit.TestsRepeater.repeat(TestsRepeater.java:11)
at com.intellij.rt.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:35)
at com.intellij.rt.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:235)
at com.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:54)

Then customer should see “HamburgerAfterLaunch” button # com.TWG.nlapp.stepDefinitions.Cucumber.HamburgerStepDef.check_BtnAvailability_Hamburger(java.lang.String)
And customer opens “Account” page # com.TWG.nlapp.stepDefinitions.Cucumber.CommonStepDef.open_page(java.lang.String)
Then customer should see “AccountSignIn” button in Account page # com.TWG.nlapp.stepDefinitions.Cucumber.AccountPageStepDef.check_BtnAvailability_AccountPage(java.lang.String)
When customer clicks “AccountSignIn” button in Account page # com.TWG.nlapp.stepDefinitions.Cucumber.AccountPageStepDef.click_Btn_AccountPage(java.lang.String)
Then customer should see “Sign In” page # com.TWG.nlapp.stepDefinitions.Cucumber.CommonStepDef.check_page(java.lang.String)
When customer enters login credentials # com.TWG.nlapp.stepDefinitions.Cucumber.HamburgerStepDef.customerEntersLoginCredentials()
And customer clicks “SIGN IN” button on Sing In page # com.TWG.nlapp.stepDefinitions.Cucumber.HamburgerStepDef.click_SignInBtn_SignInPage()
Then customer should see “Account Details” in Account page # com.TWG.nlapp.stepDefinitions.Cucumber.AccountPageStepDef.customerShouldSeeInAccountPage(java.lang.String)
2022-07-25 11:18:04 ERROR :221 -
__ _____ _____ ____ _____ _____ _ ___ _ _____ ____
_ / / |_ | / | _| | / \ | _| | | ___| _ \
(
)
| | | | | | _ \ | | | |
/ _ \ | || | | | | | | |
|| | | | | | ___) || | | / ___ \ | || || |
| |
| |
(
) | | |
| ||_/ || ||// __||___|____/
_\

Valid customer login to the Yellow App from Account page

2022-07-25 11:18:04 ERROR :254 - Test failed at step: Given The customer launch Yellow App
2022-07-25 11:18:04 ERROR :256 - The page object class com.TWG.nlapp.pages.HamburgerPage could not be instantiated:

net.thucydides.core.pages.WrongPageError: The page object class com.TWG.nlapp.pages.HamburgerPage could not be instantiated:
Failed to instantiate page (net.thucydides.core.webdriver.DriverConfigurationError: Could not instantiate class io.appium.java_client.AppiumDriver)

at net.thucydides.core.pages.PageFactory.thisPageObjectLooksDodgy(PageFactory.java:103)
at net.thucydides.core.pages.PageFactory.createPageOfType(PageFactory.java:50)
at net.thucydides.core.steps.PageObjectDependencyInjector.instantiatePageObjectIfNotAssigned(PageObjectDependencyInjector.java:85)
at net.thucydides.core.steps.PageObjectDependencyInjector.injectDependenciesInto(PageObjectDependencyInjector.java:52)
at net.thucydides.core.steps.StepFactory.injectOtherDependenciesInto(StepFactory.java:206)
at net.thucydides.core.steps.StepFactory.instantiateNewStepLibraryFor(StepFactory.java:196)
at net.thucydides.core.steps.StepFactory.instantiateNewStepLibraryFor(StepFactory.java:177)
at net.thucydides.core.steps.StepFactory.getNewStepLibraryFor(StepFactory.java:124)
at net.thucydides.core.steps.IndividualInstancesByDefaultStepCreationStrategy.initiateStepsFor(IndividualInstancesByDefaultStepCreationStrategy.java:16)
at net.thucydides.core.steps.StepAnnotations.instantiateAnyUnitiaializedSteps(StepAnnotations.java:80)
at net.thucydides.core.steps.StepAnnotations.instanciateScenarioStepFields(StepAnnotations.java:61)
at net.thucydides.core.steps.StepAnnotations.injectScenarioStepsInto(StepAnnotations.java:43)
at net.serenitybdd.core.Serenity.injectScenarioStepsInto(Serenity.java:141)
at net.serenitybdd.core.Serenity.initializeWithNoStepListener(Serenity.java:107)
at cucumber.runtime.SerenityObjectFactory.newInstance(SerenityObjectFactory.java:75)
at cucumber.runtime.SerenityObjectFactory.cacheNewInstance(SerenityObjectFactory.java:58)
at cucumber.runtime.SerenityObjectFactory.getInstance(SerenityObjectFactory.java:48)
at io.cucumber.java.AbstractGlueDefinition.invokeMethod(AbstractGlueDefinition.java:47)
at io.cucumber.java.JavaStepDefinition.execute(JavaStepDefinition.java:29)
at io.cucumber.core.runner.CoreStepDefinition.execute(CoreStepDefinition.java:66)
at io.cucumber.core.runner.PickleStepDefinitionMatch.runStep(PickleStepDefinitionMatch.java:63)
at io.cucumber.core.runner.TestStep.executeStep(TestStep.java:92)
at io.cucumber.core.runner.TestStep.run(TestStep.java:63)
at io.cucumber.core.runner.PickleStepTestStep.run(PickleStepTestStep.java:49)
at io.cucumber.core.runner.TestCase.run(TestCase.java:99)
at io.cucumber.core.runner.Runner.runPickle(Runner.java:71)
at io.cucumber.junit.PickleRunners$NoStepDescriptions.run(PickleRunners.java:151)
at io.cucumber.junit.FeatureRunner.runChild(FeatureRunner.java:135)
at io.cucumber.junit.FeatureRunner.runChild(FeatureRunner.java:27)
at org.junit.runners.ParentRunner$4.run(ParentRunner.java:331)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:79)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:329)
at org.junit.runners.ParentRunner.access$100(ParentRunner.java:66)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:293)
at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
at org.junit.runners.ParentRunner.run(ParentRunner.java:413)
at io.cucumber.junit.CucumberSerenityRunner.runChild(CucumberSerenityRunner.java:234)
at io.cucumber.junit.CucumberSerenityRunner.runChild(CucumberSerenityRunner.java:57)
at org.junit.runners.ParentRunner$4.run(ParentRunner.java:331)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:79)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:329)
at org.junit.runners.ParentRunner.access$100(ParentRunner.java:66)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:293)
at io.cucumber.junit.CucumberSerenityRunner$RunCucumber.evaluate(CucumberSerenityRunner.java:262)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
at org.junit.runners.ParentRunner.run(ParentRunner.java:413)
at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:69)
at com.intellij.rt.junit.IdeaTestRunner$Repeater$1.execute(IdeaTestRunner.java:38)
at com.intellij.rt.execution.junit.TestsRepeater.repeat(TestsRepeater.java:11)
at com.intellij.rt.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:35)
at com.intellij.rt.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:235)
at com.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:54)

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?

https://stackoverflow.com/questions/57424137/emulator-unexpected-feature-list-multidisplay-vulkannulloptionalstrings-yuv420

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