Failed to create session. An unknown server-side error occurred while processing the command. Original error: Appium Settings app is not running after 5000ms

{
“appium:automationName”: “UiAutomator2”,
“platformName”: “Android”,
“appium:platformVersion”: “13”,
“appium:deviceName”: “OPPO F21 Pro”,
“appium:appPackage”: “com.educationfund.edufund”,
“appium:appActivity”: “com.educationfund.MainActivity”,
“appium:udid”: “e042712d”,
“appium:ignoreHiddenApiPolicyError”: true,
“appium:noReset”: true,
“appium:clearDeviceLogsOnStart”: true,
“appium:appWaitDuration”: 60000
}

Above are the capabilities mentioned & Below are the logs from the server

[debug] [AppiumDriver@afaf] Calling AppiumDriver.createSession() with args: [{“appium:automationName”:“UiAutomator2”,“platformName”:“Android”,“appium:platformVersion”:“13”,“appium:deviceName”:“OPPO F21 Pro”,“appium:appPackage”:“com.educationfund.edufund”,“appium:appActivity”:“com.educationfund.MainActivity”,“appium:udid”:“e042712d”,“appium:ignoreHiddenApiPolicyError”:true,“appium:noReset”:true,“appium:clearDeviceLogsOnStart”:true,“appium:waitDuration”:60000,“appium:ensureWebviewsHavePages”:true,“appium:nativeWebScreenshot”:true,“appium:newCommandTimeout”:3600,“appium:connectHardwareKeyboard”:true},null,{“alwaysMatch”:{“appium:automationName”:“UiAutomator2”,“platformName”:“Android”,“appium:platformVersion”:“13”,“appium:deviceName”:“OPPO F21 Pro”,“appium:appPackage”:“com.educationfund.edufund”,“appium:appActivity”:“com.educationfund.MainActivity”,“appium:udid”:“e042712d”,“appium:ignoreHiddenApiPolicyError”:true,“appium:noReset”:true,“appium:clearDeviceLogsOnStart”:true,“appium:waitDuration”:60000,“appium:ensureWebviewsHavePages”:true,“appium:nativeWebScreenshot”:true,"appium:newComm…
[debug] [AppiumDriver@afaf] Event ‘newSessionRequested’ logged at 1687778565448 (16:52:45 GMT+0530 (India Standard Time))
[Appium] Attempting to find matching driver for automationName ‘UiAutomator2’ and platformName ‘Android’
[Appium] The ‘uiautomator2’ driver was installed and matched caps.
[Appium] Will require it at C:\Users\faizm.appium\node_modules\appium-uiautomator2-driver
[debug] [Appium] Requiring driver at C:\Users\faizm.appium\node_modules\appium-uiautomator2-driver
[AppiumDriver@afaf] Appium v2.0.0-rc.3 creating new AndroidUiautomator2Driver (v2.27.0) session
[AppiumDriver@afaf] Checking BaseDriver versions for Appium and AndroidUiautomator2Driver
[AppiumDriver@afaf] Appium’s BaseDriver version is 9.3.13
[AppiumDriver@afaf] AndroidUiautomator2Driver’s BaseDriver version is 9.3.13
[debug] [AndroidUiautomator2Driver@5d23] Creating session with W3C capabilities: {
[debug] [AndroidUiautomator2Driver@5d23] “alwaysMatch”: {
[debug] [AndroidUiautomator2Driver@5d23] “platformName”: “Android”,
[debug] [AndroidUiautomator2Driver@5d23] “appium:automationName”: “UiAutomator2”,
[debug] [AndroidUiautomator2Driver@5d23] “appium:platformVersion”: “13”,
[debug] [AndroidUiautomator2Driver@5d23] “appium:deviceName”: “OPPO F21 Pro”,
[debug] [AndroidUiautomator2Driver@5d23] “appium:appPackage”: “com.educationfund.edufund”,
[debug] [AndroidUiautomator2Driver@5d23] “appium:appActivity”: “com.educationfund.MainActivity”,
[debug] [AndroidUiautomator2Driver@5d23] “appium:udid”: “e042712d”,
[debug] [AndroidUiautomator2Driver@5d23] “appium:ignoreHiddenApiPolicyError”: true,
[debug] [AndroidUiautomator2Driver@5d23] “appium:noReset”: true,
[debug] [AndroidUiautomator2Driver@5d23] “appium:clearDeviceLogsOnStart”: true,
[debug] [AndroidUiautomator2Driver@5d23] “appium:waitDuration”: 60000,
[debug] [AndroidUiautomator2Driver@5d23] “appium:ensureWebviewsHavePages”: true,
[debug] [AndroidUiautomator2Driver@5d23] “appium:nativeWebScreenshot”: true,
[debug] [AndroidUiautomator2Driver@5d23] “appium:newCommandTimeout”: 3600,
[debug] [AndroidUiautomator2Driver@5d23] “appium:connectHardwareKeyboard”: true
[debug] [AndroidUiautomator2Driver@5d23] },
[debug] [AndroidUiautomator2Driver@5d23] “firstMatch”: [
[debug] [AndroidUiautomator2Driver@5d23] {}
[debug] [AndroidUiautomator2Driver@5d23] ]
[debug] [AndroidUiautomator2Driver@5d23] }
[AndroidUiautomator2Driver@5d23] The following capabilities were provided, but are not recognized by Appium:
[AndroidUiautomator2Driver@5d23] waitDuration
[AndroidUiautomator2Driver@5d23] connectHardwareKeyboard
[AndroidUiautomator2Driver@5d23 (360c9d3e)] Session created with session id: 360c9d3e-583e-4c08-be52-8d713926c4cc
[AndroidUiautomator2Driver@5d23 (360c9d3e)] Starting ‘com.educationfund.edufund’ directly on the device
[debug] [ADB] Running ‘adb -P 5037 start-server’
[ADB] Found 1 ‘build-tools’ folders under ‘C:\Users\faizm\AppData\Local\Android\sdk’ (newest first):
[ADB] C:/Users/faizm/AppData/Local/Android/sdk/build-tools/34.0.0
[ADB] Using ‘adb.exe’ from ‘C:\Users\faizm\AppData\Local\Android\sdk\platform-tools\adb.exe’
[AndroidDriver] Retrieving device list
[debug] [ADB] Trying to find a connected android device
[debug] [ADB] Getting connected devices
[debug] [ADB] Connected devices: [{“udid”:“e042712d”,“state”:“device”}]
[AndroidDriver] Using device: e042712d
[debug] [ADB] Running ‘adb -P 5037 start-server’
[ADB] Using ‘adb.exe’ from ‘C:\Users\faizm\AppData\Local\Android\sdk\platform-tools\adb.exe’
[debug] [ADB] Setting device id to e042712d
[debug] [ADB] Running ‘C:\Users\faizm\AppData\Local\Android\sdk\platform-tools\adb.exe -P 5037 -s e042712d shell getprop ro.build.version.sdk’
[debug] [ADB] Current device property ‘ro.build.version.sdk’: 33
[ADB] Getting device platform version
[debug] [ADB] Running ‘C:\Users\faizm\AppData\Local\Android\sdk\platform-tools\adb.exe -P 5037 -s e042712d shell getprop ro.build.version.release’
[debug] [ADB] Current device property ‘ro.build.version.release’: 13
[debug] [ADB] Device API level: 33
[AndroidUiautomator2Driver@5d23 (360c9d3e)] Relaxing hidden api policy
[debug] [ADB] Running ‘C:\Users\faizm\AppData\Local\Android\sdk\platform-tools\adb.exe -P 5037 -s e042712d 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’’
[ADB] Failed to set setting keys ‘hidden_api_policy_pre_p_apps,hidden_api_policy_p_apps,hidden_api_policy’ to ‘1’. Original error: Error executing adbExec. Original error: ‘Command ‘C:\Users\faizm\AppData\Local\Android\sdk\platform-tools\adb.exe -P 5037 -s e042712d 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’’ exited with code 255’; Command output:
[ADB] Exception occurred while executing ‘put’:
[ADB] java.lang.SecurityException: Permission denial: writing to settings requires:android.permission.WRITE_SECURE_SETTINGS
[ADB] at com.android.providers.settings.SettingsProvider.enforceWritePermission(SettingsProvider.java:2562)
[ADB] at com.android.providers.settings.SettingsProvider.mutateGlobalSetting(SettingsProvider.java:1562)
[ADB] at com.android.providers.settings.SettingsProvider.insertGlobalSetting(SettingsProvider.java:1516)
[ADB] at com.android.providers.settings.SettingsProvider.call(SettingsProvider.java:495)
[ADB] at android.content.ContentProvider.call(ContentProvider.java:2511)
[ADB] at android.content.ContentProvider$Transport.call(ContentProvider.java:525)
[ADB] at com.android.providers.settings.SettingsService$MyShellCommand.putForUser(SettingsService.java:384)
[ADB] at com.android.providers.settings.SettingsService$MyShellCommand.onCommand(SettingsService.java:280)
[ADB] at com.android.modules.utils.BasicShellCommandHandler.exec(BasicShellCommandHandler.java:97)
[ADB] at android.os.ShellCommand.exec(ShellCommand.java:38)
[ADB] at com.android.providers.settings.SettingsService.onShellCommand(SettingsService.java:51)
[ADB] at android.os.Binder.shellCommand(Binder.java:1073)
[ADB] at android.os.Binder.onTransact(Binder.java:901)
[ADB] at android.os.Binder.execTransactInternal(Binder.java:1331)
[ADB] at android.os.Binder.execTransact(Binder.java:1268)
[ADB]
[ADB] Exception occurred while executing ‘put’:
[ADB] java.lang.SecurityException: Permission denial: writing to settings requires:android.permission.WRITE_SECURE_SETTINGS
[ADB] at com.android.providers.settings.SettingsProvider.enforceWritePermission(SettingsProvider.java:2562)
[ADB] at com.android.providers.settings.SettingsProvider.mutateGlobalSetting(SettingsProvider.java:1562)
[ADB] at com.android.providers.settings.SettingsProvider.insertGlobalSetting(SettingsProvider.java:1516)
[ADB] at com.android.providers.settings.SettingsProvider.call(SettingsProvider.java:495)
[ADB] at android.content.ContentProvider.call(ContentProvider.java:2511)
[ADB] at android.content.ContentProvider$Transport.call(ContentProvider.java:525)
[ADB] at com.android.providers.settings.SettingsService$MyShellCommand.putForUser(SettingsService.java:384)
[ADB] at com.android.providers.settings.SettingsService$MyShellCommand.onCommand(SettingsService.java:280)
[ADB] at com.android.modules.utils.BasicShellCommandHandler.exec(BasicShellCommandHandler.java:97)
[ADB] at android.os.ShellCommand.exec(ShellCommand.java:38)
[ADB] at com.android.providers.settings.SettingsService.onShellCommand(SettingsService.java:51)
[ADB] at android.os.Binder.shellCommand(Binder.java:1073)
[ADB] at android.os.Binder.onTransact(Binder.java:901)
[ADB] at android.os.Binder.execTransactInternal(Binder.java:1331)
[ADB] at android.os.Binder.execTransact(Binder.java:1268)
[ADB]
[ADB] Exception occurred while executing ‘put’:
[ADB] java.lang.SecurityException: Permission denial: writing to settings requires:android.permission.WRITE_SECURE_SETTINGS
[ADB] at com.android.providers.settings.SettingsProvider.enforceWritePermission(SettingsProvider.java:2562)
[ADB] at com.android.providers.settings.SettingsProvider.mutateGlobalSetting(SettingsProvider.java:1562)
[ADB] at com.android.providers.settings.SettingsProvider.insertGlobalSetting(SettingsProvider.java:1516)
[ADB] at com.android.providers.settings.SettingsProvider.call(SettingsProvider.java:495)
[ADB] at android.content.ContentProvider.call(ContentProvider.java:2511)
[ADB] at android.content.ContentProvider$Transport.call(ContentProvider.java:525)
[ADB] at com.android.providers.settings.SettingsService$MyShellCommand.putForUser(SettingsService.java:384)
[ADB] at com.android.providers.settings.SettingsService$MyShellCommand.onCommand(SettingsService.java:280)
[ADB] at com.android.modules.utils.BasicShellCommandHandler.exec(BasicShellCommandHandler.java:97)
[ADB] at android.os.ShellCommand.exec(ShellCommand.java:38)
[ADB] at com.android.providers.settings.SettingsService.onShellCommand(SettingsService.java:51)
[ADB] at android.os.Binder.shellCommand(Binder.java:1073)
[ADB] at android.os.Binder.onTransact(Binder.java:901)
[ADB] at android.os.Binder.execTransactInternal(Binder.java:1331)
[ADB] at android.os.Binder.execTransact(Binder.java:1268)
[ADB]
[AndroidDriver] No app sent in, not parsing package/activity
[debug] [AndroidDriver] Pushing settings apk to device…
[debug] [ADB] Getting install status for io.appium.settings
[debug] [ADB] Running ‘C:\Users\faizm\AppData\Local\Android\sdk\platform-tools\adb.exe -P 5037 -s e042712d shell dumpsys package io.appium.settings’
[debug] [ADB] ‘io.appium.settings’ is installed
[debug] [ADB] Getting package info for ‘io.appium.settings’
[debug] [ADB] Running ‘C:\Users\faizm\AppData\Local\Android\sdk\platform-tools\adb.exe -P 5037 -s e042712d shell dumpsys package io.appium.settings’
[debug] [ADB] The version name of the installed ‘io.appium.settings’ is greater or equal to the application version name (‘5.0.4’ >= ‘5.0.4’)
[debug] [ADB] There is no need to install/upgrade ‘C:\Users\faizm.appium\node_modules\appium-uiautomator2-driver\node_modules\io.appium.settings\apks\settings_apk-debug.apk’
[debug] [ADB] Getting IDs of all ‘io.appium.settings’ processes
[debug] [ADB] Running ‘C:\Users\faizm\AppData\Local\Android\sdk\platform-tools\adb.exe -P 5037 -s e042712d shell ‘pgrep --help; echo $?’’
[debug] [ADB] Running ‘C:\Users\faizm\AppData\Local\Android\sdk\platform-tools\adb.exe -P 5037 -s e042712d shell pgrep -f ([[:blank:]]|^)io.appium.settings([[:blank:]]|$)’
[debug] [ADB] Running ‘C:\Users\faizm\AppData\Local\Android\sdk\platform-tools\adb.exe -P 5037 -s e042712d shell appops set io.appium.settings PROJECT_MEDIA allow’
[debug] [AndroidDriver] Error executing adbExec. Original error: ‘Command ‘C:\Users\faizm\AppData\Local\Android\sdk\platform-tools\adb.exe -P 5037 -s e042712d shell appops set io.appium.settings PROJECT_MEDIA allow’ exited with code 255’; Command output:
[debug] [AndroidDriver] Exception occurred while executing ‘set’:
[debug] [AndroidDriver] java.lang.SecurityException: uid 2000 does not have android.permission.MANAGE_APP_OPS_MODES.
[debug] [AndroidDriver] at android.app.ContextImpl.enforce(ContextImpl.java:2253)
[debug] [AndroidDriver] at android.app.ContextImpl.enforcePermission(ContextImpl.java:2262)
[debug] [AndroidDriver] at com.android.server.appop.AppOpsService.enforceManageAppOpsModes(AppOpsService.java:2586)
[debug] [AndroidDriver] at com.android.server.appop.AppOpsService.setMode(AppOpsService.java:2855)
[debug] [AndroidDriver] at com.android.server.appop.AppOpsService.setMode(AppOpsService.java:2850)
[debug] [AndroidDriver] at com.android.server.appop.AppOpsService.onShellCommand(AppOpsService.java:5680)
[debug] [AndroidDriver] at com.android.server.appop.AppOpsService$Shell.onCommand(AppOpsService.java:5449)
[debug] [AndroidDriver] at com.android.modules.utils.BasicShellCommandHandler.exec(BasicShellCommandHandler.java:97)
[debug] [AndroidDriver] at android.os.ShellCommand.exec(ShellCommand.java:38)
[debug] [AndroidDriver] at com.android.server.appop.AppOpsService.onShellCommand(AppOpsService.java:5621)
[debug] [AndroidDriver] at android.os.Binder.shellCommand(Binder.java:1073)
[debug] [AndroidDriver] at android.os.Binder.onTransact(Binder.java:901)
[debug] [AndroidDriver] at com.android.internal.app.IAppOpsService$Stub.onTransact(IAppOpsService.java:1120)
[debug] [AndroidDriver] at android.os.Binder.execTransactInternal(Binder.java:1331)
[debug] [AndroidDriver] at android.os.Binder.execTransact(Binder.java:1268)
[debug] [AndroidDriver]
[debug] [ADB] Running ‘C:\Users\faizm\AppData\Local\Android\sdk\platform-tools\adb.exe -P 5037 -s e042712d shell cmd notification allow_listener io.appium.settings/.NLService’
[debug] [ADB] Getting IDs of all ‘io.appium.settings’ processes
[debug] [ADB] Running ‘C:\Users\faizm\AppData\Local\Android\sdk\platform-tools\adb.exe -P 5037 -s e042712d shell pgrep -f ([[:blank:]]|^)io.appium.settings([[:blank:]]|$)’
[debug] [ADB] Starting Appium Settings app
[debug] [ADB] Running ‘C:\Users\faizm\AppData\Local\Android\sdk\platform-tools\adb.exe -P 5037 -s e042712d shell am start -n io.appium.settings/.Settings -a android.intent.action.MAIN -c android.intent.category.LAUNCHER’
[debug] [ADB] Getting IDs of all ‘io.appium.settings’ processes
[debug] [ADB] Running ‘C:\Users\faizm\AppData\Local\Android\sdk\platform-tools\adb.exe -P 5037 -s e042712d shell pgrep -f ([[:blank:]]|^)io.appium.settings([[:blank:]]|$)’
[debug] [ADB] Getting IDs of all ‘io.appium.settings’ processes
[debug] [ADB] Running ‘C:\Users\faizm\AppData\Local\Android\sdk\platform-tools\adb.exe -P 5037 -s e042712d shell pgrep -f ([[:blank:]]|^)io.appium.settings([[:blank:]]|$)’
[debug] [ADB] Getting IDs of all ‘io.appium.settings’ processes
[debug] [ADB] Running ‘C:\Users\faizm\AppData\Local\Android\sdk\platform-tools\adb.exe -P 5037 -s e042712d shell pgrep -f ([[:blank:]]|^)io.appium.settings([[:blank:]]|$)’
[debug] [ADB] Getting IDs of all ‘io.appium.settings’ processes
[debug] [ADB] Running ‘C:\Users\faizm\AppData\Local\Android\sdk\platform-tools\adb.exe -P 5037 -s e042712d shell pgrep -f ([[:blank:]]|^)io.appium.settings([[:blank:]]|$)’
[debug] [ADB] Getting IDs of all ‘io.appium.settings’ processes
[debug] [ADB] Running ‘C:\Users\faizm\AppData\Local\Android\sdk\platform-tools\adb.exe -P 5037 -s e042712d shell pgrep -f ([[:blank:]]|^)io.appium.settings([[:blank:]]|$)’
[debug] [ADB] Getting IDs of all ‘io.appium.settings’ processes
[debug] [ADB] Running ‘C:\Users\faizm\AppData\Local\Android\sdk\platform-tools\adb.exe -P 5037 -s e042712d shell pgrep -f ([[:blank:]]|^)io.appium.settings([[:blank:]]|$)’
[debug] [ADB] Getting IDs of all ‘io.appium.settings’ processes
[debug] [ADB] Running ‘C:\Users\faizm\AppData\Local\Android\sdk\platform-tools\adb.exe -P 5037 -s e042712d shell pgrep -f ([[:blank:]]|^)io.appium.settings([[:blank:]]|$)’
[debug] [ADB] Getting IDs of all ‘io.appium.settings’ processes
[debug] [ADB] Running ‘C:\Users\faizm\AppData\Local\Android\sdk\platform-tools\adb.exe -P 5037 -s e042712d shell pgrep -f ([[:blank:]]|^)io.appium.settings([[:blank:]]|$)’
[debug] [ADB] Getting IDs of all ‘io.appium.settings’ processes
[debug] [ADB] Running ‘C:\Users\faizm\AppData\Local\Android\sdk\platform-tools\adb.exe -P 5037 -s e042712d shell pgrep -f ([[:blank:]]|^)io.appium.settings([[:blank:]]|$)’
[debug] [ADB] Getting IDs of all ‘io.appium.settings’ processes
[debug] [ADB] Running ‘C:\Users\faizm\AppData\Local\Android\sdk\platform-tools\adb.exe -P 5037 -s e042712d shell pgrep -f ([[:blank:]]|^)io.appium.settings([[:blank:]]|$)’
[debug] [ADB] Getting IDs of all ‘io.appium.settings’ processes
[debug] [ADB] Running ‘C:\Users\faizm\AppData\Local\Android\sdk\platform-tools\adb.exe -P 5037 -s e042712d shell pgrep -f ([[:blank:]]|^)io.appium.settings([[:blank:]]|$)’
[debug] [AndroidDriver] Error: Appium Settings app is not running after 5000ms
[debug] [AndroidDriver] at ADB.requireRunningSettingsApp (C:\Users\faizm.appium\node_modules\appium-uiautomator2-driver\node_modules\appium-adb\lib\tools\settings-client-commands.js:100:11)
[debug] [AndroidDriver] at Object.pushSettingsApp (C:\Users\faizm.appium\node_modules\appium-uiautomator2-driver\node_modules\appium-android-driver\lib\android-helpers.js:677:5)
[debug] [AndroidDriver] at Object.initDevice (C:\Users\faizm.appium\node_modules\appium-uiautomator2-driver\node_modules\appium-android-driver\lib\android-helpers.js:823:5)
[debug] [AndroidDriver] at AndroidUiautomator2Driver.startUiAutomator2Session (C:\Users\faizm.appium\node_modules\appium-uiautomator2-driver\lib\driver.js:393:5)
[debug] [AndroidDriver] at AndroidUiautomator2Driver.createSession (C:\Users\faizm.appium\node_modules\appium-uiautomator2-driver\lib\driver.js:241:7)
[debug] [AndroidDriver] at AppiumDriver.createSession (C:\Users\faizm\AppData\Roaming\npm\node_modules\appium\lib\appium.js:346:35)
[debug] [AndroidUiautomator2Driver@5d23 (360c9d3e)] Deleting UiAutomator2 session
[debug] [ADB] Running ‘C:\Users\faizm\AppData\Local\Android\sdk\platform-tools\adb.exe -P 5037 -s e042712d shell dumpsys activity services io.appium.settings/.recorder.RecorderService’
[AndroidUiautomator2Driver@5d23 (360c9d3e)] Restoring hidden api policy to the device default configuration
[debug] [ADB] Running ‘C:\Users\faizm\AppData\Local\Android\sdk\platform-tools\adb.exe -P 5037 -s e042712d shell ‘settings delete global hidden_api_policy_pre_p_apps;settings delete global hidden_api_policy_p_apps;settings delete global hidden_api_policy’’
[ADB] Failed to delete keys ‘hidden_api_policy_pre_p_apps,hidden_api_policy_p_apps,hidden_api_policy’. Original error: Error executing adbExec. Original error: ‘Command ‘C:\Users\faizm\AppData\Local\Android\sdk\platform-tools\adb.exe -P 5037 -s e042712d 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 255’; Command output:
[ADB] Exception occurred while executing ‘delete’:
[ADB] java.lang.SecurityException: Permission denial: writing to settings requires:android.permission.WRITE_SECURE_SETTINGS
[ADB] at com.android.providers.settings.SettingsProvider.enforceWritePermission(SettingsProvider.java:2562)
[ADB] at com.android.providers.settings.SettingsProvider.mutateGlobalSetting(SettingsProvider.java:1562)
[ADB] at com.android.providers.settings.SettingsProvider.mutateGlobalSetting(SettingsProvider.java:1554)
[ADB] at com.android.providers.settings.SettingsProvider.deleteGlobalSetting(SettingsProvider.java:1525)
[ADB] at com.android.providers.settings.SettingsProvider.call(SettingsProvider.java:568)
[ADB] at android.content.ContentProvider.call(ContentProvider.java:2511)
[ADB] at android.content.ContentProvider$Transport.call(ContentProvider.java:525)
[ADB] at com.android.providers.settings.SettingsService$MyShellCommand.deleteForUser(SettingsService.java:410)
[ADB] at com.android.providers.settings.SettingsService$MyShellCommand.onCommand(SettingsService.java:284)
[ADB] at com.android.modules.utils.BasicShellCommandHandler.exec(BasicShellCommandHandler.java:97)
[ADB] at android.os.ShellCommand.exec(ShellCommand.java:38)
[ADB] at com.android.providers.settings.SettingsService.onShellCommand(SettingsService.java:51)
[ADB] at android.os.Binder.shellCommand(Binder.java:1073)
[ADB] at android.os.Binder.onTransact(Binder.java:901)
[ADB] at android.os.Binder.execTransactInternal(Binder.java:1331)
[ADB] at android.os.Binder.execTransact(Binder.java:1268)
[ADB]
[ADB] Exception occurred while executing ‘delete’:
[ADB] java.lang.SecurityException: Permission denial: writing to settings requires:android.permission.WRITE_SECURE_SETTINGS
[ADB] at com.android.providers.settings.SettingsProvider.enforceWritePermission(SettingsProvider.java:2562)
[ADB] at com.android.providers.settings.SettingsProvider.mutateGlobalSetting(SettingsProvider.java:1562)
[ADB] at com.android.providers.settings.SettingsProvider.mutateGlobalSetting(SettingsProvider.java:1554)
[ADB] at com.android.providers.settings.SettingsProvider.deleteGlobalSetting(SettingsProvider.java:1525)
[ADB] at com.android.providers.settings.SettingsProvider.call(SettingsProvider.java:568)
[ADB] at android.content.ContentProvider.call(ContentProvider.java:2511)
[ADB] at android.content.ContentProvider$Transport.call(ContentProvider.java:525)
[ADB] at com.android.providers.settings.SettingsService$MyShellCommand.deleteForUser(SettingsService.java:410)
[ADB] at com.android.providers.settings.SettingsService$MyShellCommand.onCommand(SettingsService.java:284)
[ADB] at com.android.modules.utils.BasicShellCommandHandler.exec(BasicShellCommandHandler.java:97)
[ADB] at android.os.ShellCommand.exec(ShellCommand.java:38)
[ADB] at com.android.providers.settings.SettingsService.onShellCommand(SettingsService.java:51)
[ADB] at android.os.Binder.shellCommand(Binder.java:1073)
[ADB] at android.os.Binder.onTransact(Binder.java:901)
[ADB] at android.os.Binder.execTransactInternal(Binder.java:1331)
[ADB] at android.os.Binder.execTransact(Binder.java:1268)
[ADB]
[ADB] Exception occurred while executing ‘delete’:
[ADB] java.lang.SecurityException: Permission denial: writing to settings requires:android.permission.WRITE_SECURE_SETTINGS
[ADB] at com.android.providers.settings.SettingsProvider.enforceWritePermission(SettingsProvider.java:2562)
[ADB] at com.android.providers.settings.SettingsProvider.mutateGlobalSetting(SettingsProvider.java:1562)
[ADB] at com.android.providers.settings.SettingsProvider.mutateGlobalSetting(SettingsProvider.java:1554)
[ADB] at com.android.providers.settings.SettingsProvider.deleteGlobalSetting(SettingsProvider.java:1525)
[ADB] at com.android.providers.settings.SettingsProvider.call(SettingsProvider.java:568)
[ADB] at android.content.ContentProvider.call(ContentProvider.java:2511)
[ADB] at android.content.ContentProvider$Transport.call(ContentProvider.java:525)
[ADB] at com.android.providers.settings.SettingsService$MyShellCommand.deleteForUser(SettingsService.java:410)
[ADB] at com.android.providers.settings.SettingsService$MyShellCommand.onCommand(SettingsService.java:284)
[ADB] at com.android.modules.utils.BasicShellCommandHandler.exec(BasicShellCommandHandler.java:97)
[ADB] at android.os.ShellCommand.exec(ShellCommand.java:38)
[ADB] at com.android.providers.settings.SettingsService.onShellCommand(SettingsService.java:51)
[ADB] at android.os.Binder.shellCommand(Binder.java:1073)
[ADB] at android.os.Binder.onTransact(Binder.java:901)
[ADB] at android.os.Binder.execTransactInternal(Binder.java:1331)
[ADB] at android.os.Binder.execTransact(Binder.java:1268)
[ADB]
[debug] [AppiumDriver@afaf] Event ‘newSessionStarted’ logged at 1687778574349 (16:52:54 GMT+0530 (India Standard Time))
[debug] [AppiumDriver@afaf] Encountered internal error running command: Error: Appium Settings app is not running after 5000ms
[debug] [AppiumDriver@afaf] at ADB.requireRunningSettingsApp (C:\Users\faizm.appium\node_modules\appium-uiautomator2-driver\node_modules\appium-adb\lib\tools\settings-client-commands.js:100:11)
[debug] [AppiumDriver@afaf] at Object.pushSettingsApp (C:\Users\faizm.appium\node_modules\appium-uiautomator2-driver\node_modules\appium-android-driver\lib\android-helpers.js:677:5)
[debug] [AppiumDriver@afaf] at Object.initDevice (C:\Users\faizm.appium\node_modules\appium-uiautomator2-driver\node_modules\appium-android-driver\lib\android-helpers.js:823:5)
[debug] [AppiumDriver@afaf] at AndroidUiautomator2Driver.startUiAutomator2Session (C:\Users\faizm.appium\node_modules\appium-uiautomator2-driver\lib\driver.js:393:5)
[debug] [AppiumDriver@afaf] at AndroidUiautomator2Driver.createSession (C:\Users\faizm.appium\node_modules\appium-uiautomator2-driver\lib\driver.js:241:7)
[debug] [AppiumDriver@afaf] at AppiumDriver.createSession (C:\Users\faizm\AppData\Roaming\npm\node_modules\appium\lib\appium.js:346:35)
[HTTP] <-- POST /wd/hub/session 500 8960 ms - 660
[HTTP]
[HTTP] --> POST /wd/hub/session
[HTTP] {“capabilities”:{“alwaysMatch”:{“appium:automationName”:“UiAutomator2”,“platformName”:“Android”,“appium:platformVersion”:“13”,“appium:deviceName”:“OPPO F21 Pro”,“appium:appPackage”:“com.educationfund.edufund”,“appium:appActivity”:“com.educationfund.MainActivity”,“appium:udid”:“e042712d”,“appium:ignoreHiddenApiPolicyError”:true,“appium:noReset”:true,“appium:clearDeviceLogsOnStart”:true,“appium:waitDuration”:60000,“appium:ensureWebviewsHavePages”:true,“appium:nativeWebScreenshot”:true,“appium:newCommandTimeout”:3600,“appium:connectHardwareKeyboard”:true},“firstMatch”:[{}]},“desiredCapabilities”:{“appium:automationName”:“UiAutomator2”,“platformName”:“Android”,“appium:platformVersion”:“13”,“appium:deviceName”:“OPPO F21 Pro”,“appium:appPackage”:“com.educationfund.edufund”,“appium:appActivity”:“com.educationfund.MainActivity”,“appium:udid”:“e042712d”,“appium:ignoreHiddenApiPolicyError”:true,“appium:noReset”:true,“appium:clearDeviceLogsOnStart”:true,“appium:waitDuration”:60000,“appium:ensureWebviewsHavePages”:tru…
[debug] [AppiumDriver@afaf] Calling AppiumDriver.createSession() with args: [{“appium:automationName”:“UiAutomator2”,“platformName”:“Android”,“appium:platformVersion”:“13”,“appium:deviceName”:“OPPO F21 Pro”,“appium:appPackage”:“com.educationfund.edufund”,“appium:appActivity”:“com.educationfund.MainActivity”,“appium:udid”:“e042712d”,“appium:ignoreHiddenApiPolicyError”:true,“appium:noReset”:true,“appium:clearDeviceLogsOnStart”:true,“appium:waitDuration”:60000,“appium:ensureWebviewsHavePages”:true,“appium:nativeWebScreenshot”:true,“appium:newCommandTimeout”:3600,“appium:connectHardwareKeyboard”:true},null,{“alwaysMatch”:{“appium:automationName”:“UiAutomator2”,“platformName”:“Android”,“appium:platformVersion”:“13”,“appium:deviceName”:“OPPO F21 Pro”,“appium:appPackage”:“com.educationfund.edufund”,“appium:appActivity”:“com.educationfund.MainActivity”,“appium:udid”:“e042712d”,“appium:ignoreHiddenApiPolicyError”:true,“appium:noReset”:true,“appium:clearDeviceLogsOnStart”:true,“appium:waitDuration”:60000,“appium:ensureWebviewsHavePages”:true,“appium:nativeWebScreenshot”:true,"appium:newComm…
[debug] [AppiumDriver@afaf] Event ‘newSessionRequested’ logged at 1687778733278 (16:55:33 GMT+0530 (India Standard Time))
[Appium] Attempting to find matching driver for automationName ‘UiAutomator2’ and platformName ‘Android’
[Appium] The ‘uiautomator2’ driver was installed and matched caps.
[Appium] Will require it at C:\Users\faizm.appium\node_modules\appium-uiautomator2-driver
[debug] [Appium] Requiring driver at C:\Users\faizm.appium\node_modules\appium-uiautomator2-driver
[AppiumDriver@afaf] Appium v2.0.0-rc.3 creating new AndroidUiautomator2Driver (v2.27.0) session
[AppiumDriver@afaf] Checking BaseDriver versions for Appium and AndroidUiautomator2Driver
[AppiumDriver@afaf] Appium’s BaseDriver version is 9.3.13
[AppiumDriver@afaf] AndroidUiautomator2Driver’s BaseDriver version is 9.3.13
[debug] [AndroidUiautomator2Driver@159e] Creating session with W3C capabilities: {
[debug] [AndroidUiautomator2Driver@159e] “alwaysMatch”: {
[debug] [AndroidUiautomator2Driver@159e] “platformName”: “Android”,
[debug] [AndroidUiautomator2Driver@159e] “appium:automationName”: “UiAutomator2”,
[debug] [AndroidUiautomator2Driver@159e] “appium:platformVersion”: “13”,
[debug] [AndroidUiautomator2Driver@159e] “appium:deviceName”: “OPPO F21 Pro”,
[debug] [AndroidUiautomator2Driver@159e] “appium:appPackage”: “com.educationfund.edufund”,
[debug] [AndroidUiautomator2Driver@159e] “appium:appActivity”: “com.educationfund.MainActivity”,
[debug] [AndroidUiautomator2Driver@159e] “appium:udid”: “e042712d”,
[debug] [AndroidUiautomator2Driver@159e] “appium:ignoreHiddenApiPolicyError”: true,
[debug] [AndroidUiautomator2Driver@159e] “appium:noReset”: true,
[debug] [AndroidUiautomator2Driver@159e] “appium:clearDeviceLogsOnStart”: true,
[debug] [AndroidUiautomator2Driver@159e] “appium:waitDuration”: 60000,
[debug] [AndroidUiautomator2Driver@159e] “appium:ensureWebviewsHavePages”: true,
[debug] [AndroidUiautomator2Driver@159e] “appium:nativeWebScreenshot”: true,
[debug] [AndroidUiautomator2Driver@159e] “appium:newCommandTimeout”: 3600,
[debug] [AndroidUiautomator2Driver@159e] “appium:connectHardwareKeyboard”: true
[debug] [AndroidUiautomator2Driver@159e] },
[debug] [AndroidUiautomator2Driver@159e] “firstMatch”: [
[debug] [AndroidUiautomator2Driver@159e] {}
[debug] [AndroidUiautomator2Driver@159e] ]
[debug] [AndroidUiautomator2Driver@159e] }
[AndroidUiautomator2Driver@159e] The following capabilities were provided, but are not recognized by Appium:
[AndroidUiautomator2Driver@159e] waitDuration
[AndroidUiautomator2Driver@159e] connectHardwareKeyboard
[AndroidUiautomator2Driver@159e (4e82e4a6)] Session created with session id: 4e82e4a6-9812-454a-80db-b09f88142f09
[AndroidUiautomator2Driver@159e (4e82e4a6)] Starting ‘com.educationfund.edufund’ directly on the device
[debug] [ADB] Running ‘adb -P 5037 start-server’
[ADB] Using ‘adb.exe’ from ‘C:\Users\faizm\AppData\Local\Android\sdk\platform-tools\adb.exe’
[AndroidDriver] Retrieving device list
[debug] [ADB] Trying to find a connected android device
[debug] [ADB] Getting connected devices
[debug] [ADB] Connected devices: [{“udid”:“e042712d”,“state”:“device”}]
[AndroidDriver] Using device: e042712d
[debug] [ADB] Running ‘adb -P 5037 start-server’
[ADB] Using ‘adb.exe’ from ‘C:\Users\faizm\AppData\Local\Android\sdk\platform-tools\adb.exe’
[debug] [ADB] Setting device id to e042712d
[debug] [ADB] Running ‘C:\Users\faizm\AppData\Local\Android\sdk\platform-tools\adb.exe -P 5037 -s e042712d shell getprop ro.build.version.sdk’
[debug] [ADB] Current device property ‘ro.build.version.sdk’: 33
[ADB] Getting device platform version
[debug] [ADB] Running ‘C:\Users\faizm\AppData\Local\Android\sdk\platform-tools\adb.exe -P 5037 -s e042712d shell getprop ro.build.version.release’
[debug] [ADB] Current device property ‘ro.build.version.release’: 13
[debug] [ADB] Device API level: 33
[AndroidUiautomator2Driver@159e (4e82e4a6)] Relaxing hidden api policy
[debug] [ADB] Running ‘C:\Users\faizm\AppData\Local\Android\sdk\platform-tools\adb.exe -P 5037 -s e042712d 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’’
[ADB] Failed to set setting keys ‘hidden_api_policy_pre_p_apps,hidden_api_policy_p_apps,hidden_api_policy’ to ‘1’. Original error: Error executing adbExec. Original error: ‘Command ‘C:\Users\faizm\AppData\Local\Android\sdk\platform-tools\adb.exe -P 5037 -s e042712d 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’’ exited with code 255’; Command output:
[ADB] Exception occurred while executing ‘put’:
[ADB] java.lang.SecurityException: Permission denial: writing to settings requires:android.permission.WRITE_SECURE_SETTINGS
[ADB] at com.android.providers.settings.SettingsProvider.enforceWritePermission(SettingsProvider.java:2562)
[ADB] at com.android.providers.settings.SettingsProvider.mutateGlobalSetting(SettingsProvider.java:1562)
[ADB] at com.android.providers.settings.SettingsProvider.insertGlobalSetting(SettingsProvider.java:1516)
[ADB] at com.android.providers.settings.SettingsProvider.call(SettingsProvider.java:495)
[ADB] at android.content.ContentProvider.call(ContentProvider.java:2511)
[ADB] at android.content.ContentProvider$Transport.call(ContentProvider.java:525)
[ADB] at com.android.providers.settings.SettingsService$MyShellCommand.putForUser(SettingsService.java:384)
[ADB] at com.android.providers.settings.SettingsService$MyShellCommand.onCommand(SettingsService.java:280)
[ADB] at com.android.modules.utils.BasicShellCommandHandler.exec(BasicShellCommandHandler.java:97)
[ADB] at android.os.ShellCommand.exec(ShellCommand.java:38)
[ADB] at com.android.providers.settings.SettingsService.onShellCommand(SettingsService.java:51)
[ADB] at android.os.Binder.shellCommand(Binder.java:1073)
[ADB] at android.os.Binder.onTransact(Binder.java:901)
[ADB] at android.os.Binder.execTransactInternal(Binder.java:1331)
[ADB] at android.os.Binder.execTransact(Binder.java:1268)
[ADB]
[ADB] Exception occurred while executing ‘put’:
[ADB] java.lang.SecurityException: Permission denial: writing to settings requires:android.permission.WRITE_SECURE_SETTINGS
[ADB] at com.android.providers.settings.SettingsProvider.enforceWritePermission(SettingsProvider.java:2562)
[ADB] at com.android.providers.settings.SettingsProvider.mutateGlobalSetting(SettingsProvider.java:1562)
[ADB] at com.android.providers.settings.SettingsProvider.insertGlobalSetting(SettingsProvider.java:1516)
[ADB] at com.android.providers.settings.SettingsProvider.call(SettingsProvider.java:495)
[ADB] at android.content.ContentProvider.call(ContentProvider.java:2511)
[ADB] at android.content.ContentProvider$Transport.call(ContentProvider.java:525)
[ADB] at com.android.providers.settings.SettingsService$MyShellCommand.putForUser(SettingsService.java:384)
[ADB] at com.android.providers.settings.SettingsService$MyShellCommand.onCommand(SettingsService.java:280)
[ADB] at com.android.modules.utils.BasicShellCommandHandler.exec(BasicShellCommandHandler.java:97)
[ADB] at android.os.ShellCommand.exec(ShellCommand.java:38)
[ADB] at com.android.providers.settings.SettingsService.onShellCommand(SettingsService.java:51)
[ADB] at android.os.Binder.shellCommand(Binder.java:1073)
[ADB] at android.os.Binder.onTransact(Binder.java:901)
[ADB] at android.os.Binder.execTransactInternal(Binder.java:1331)
[ADB] at android.os.Binder.execTransact(Binder.java:1268)
[ADB]
[ADB] Exception occurred while executing ‘put’:
[ADB] java.lang.SecurityException: Permission denial: writing to settings requires:android.permission.WRITE_SECURE_SETTINGS
[ADB] at com.android.providers.settings.SettingsProvider.enforceWritePermission(SettingsProvider.java:2562)
[ADB] at com.android.providers.settings.SettingsProvider.mutateGlobalSetting(SettingsProvider.java:1562)
[ADB] at com.android.providers.settings.SettingsProvider.insertGlobalSetting(SettingsProvider.java:1516)
[ADB] at com.android.providers.settings.SettingsProvider.call(SettingsProvider.java:495)
[ADB] at android.content.ContentProvider.call(ContentProvider.java:2511)
[ADB] at android.content.ContentProvider$Transport.call(ContentProvider.java:525)
[ADB] at com.android.providers.settings.SettingsService$MyShellCommand.putForUser(SettingsService.java:384)
[ADB] at com.android.providers.settings.SettingsService$MyShellCommand.onCommand(SettingsService.java:280)
[ADB] at com.android.modules.utils.BasicShellCommandHandler.exec(BasicShellCommandHandler.java:97)
[ADB] at android.os.ShellCommand.exec(ShellCommand.java:38)
[ADB] at com.android.providers.settings.SettingsService.onShellCommand(SettingsService.java:51)
[ADB] at android.os.Binder.shellCommand(Binder.java:1073)
[ADB] at android.os.Binder.onTransact(Binder.java:901)
[ADB] at android.os.Binder.execTransactInternal(Binder.java:1331)
[ADB] at android.os.Binder.execTransact(Binder.java:1268)
[ADB]
[AndroidDriver] No app sent in, not parsing package/activity
[debug] [AndroidDriver] Pushing settings apk to device…
[debug] [ADB] Getting install status for io.appium.settings
[debug] [ADB] Running ‘C:\Users\faizm\AppData\Local\Android\sdk\platform-tools\adb.exe -P 5037 -s e042712d shell dumpsys package io.appium.settings’
[debug] [ADB] ‘io.appium.settings’ is installed
[debug] [ADB] Getting package info for ‘io.appium.settings’
[debug] [ADB] Running ‘C:\Users\faizm\AppData\Local\Android\sdk\platform-tools\adb.exe -P 5037 -s e042712d shell dumpsys package io.appium.settings’
[debug] [ADB] The version name of the installed ‘io.appium.settings’ is greater or equal to the application version name (‘5.0.4’ >= ‘5.0.4’)
[debug] [ADB] There is no need to install/upgrade ‘C:\Users\faizm.appium\node_modules\appium-uiautomator2-driver\node_modules\io.appium.settings\apks\settings_apk-debug.apk’
[debug] [ADB] Getting IDs of all ‘io.appium.settings’ processes
[debug] [ADB] Running ‘C:\Users\faizm\AppData\Local\Android\sdk\platform-tools\adb.exe -P 5037 -s e042712d shell ‘pgrep --help; echo $?’’
[debug] [ADB] Running ‘C:\Users\faizm\AppData\Local\Android\sdk\platform-tools\adb.exe -P 5037 -s e042712d shell pgrep -f ([[:blank:]]|^)io.appium.settings([[:blank:]]|$)’
[debug] [ADB] Running ‘C:\Users\faizm\AppData\Local\Android\sdk\platform-tools\adb.exe -P 5037 -s e042712d shell appops set io.appium.settings PROJECT_MEDIA allow’
[debug] [AndroidDriver] Error executing adbExec. Original error: ‘Command ‘C:\Users\faizm\AppData\Local\Android\sdk\platform-tools\adb.exe -P 5037 -s e042712d shell appops set io.appium.settings PROJECT_MEDIA allow’ exited with code 255’; Command output:
[debug] [AndroidDriver] Exception occurred while executing ‘set’:
[debug] [AndroidDriver] java.lang.SecurityException: uid 2000 does not have android.permission.MANAGE_APP_OPS_MODES.
[debug] [AndroidDriver] at android.app.ContextImpl.enforce(ContextImpl.java:2253)
[debug] [AndroidDriver] at android.app.ContextImpl.enforcePermission(ContextImpl.java:2262)
[debug] [AndroidDriver] at com.android.server.appop.AppOpsService.enforceManageAppOpsModes(AppOpsService.java:2586)
[debug] [AndroidDriver] at com.android.server.appop.AppOpsService.setMode(AppOpsService.java:2855)
[debug] [AndroidDriver] at com.android.server.appop.AppOpsService.setMode(AppOpsService.java:2850)
[debug] [AndroidDriver] at com.android.server.appop.AppOpsService.onShellCommand(AppOpsService.java:5680)
[debug] [AndroidDriver] at com.android.server.appop.AppOpsService$Shell.onCommand(AppOpsService.java:5449)
[debug] [AndroidDriver] at com.android.modules.utils.BasicShellCommandHandler.exec(BasicShellCommandHandler.java:97)
[debug] [AndroidDriver] at android.os.ShellCommand.exec(ShellCommand.java:38)
[debug] [AndroidDriver] at com.android.server.appop.AppOpsService.onShellCommand(AppOpsService.java:5621)
[debug] [AndroidDriver] at android.os.Binder.shellCommand(Binder.java:1073)
[debug] [AndroidDriver] at android.os.Binder.onTransact(Binder.java:901)
[debug] [AndroidDriver] at com.android.internal.app.IAppOpsService$Stub.onTransact(IAppOpsService.java:1120)
[debug] [AndroidDriver] at android.os.Binder.execTransactInternal(Binder.java:1331)
[debug] [AndroidDriver] at android.os.Binder.execTransact(Binder.java:1268)
[debug] [AndroidDriver]
[debug] [ADB] Running ‘C:\Users\faizm\AppData\Local\Android\sdk\platform-tools\adb.exe -P 5037 -s e042712d shell cmd notification allow_listener io.appium.settings/.NLService’
[debug] [ADB] Getting IDs of all ‘io.appium.settings’ processes
[debug] [ADB] Running ‘C:\Users\faizm\AppData\Local\Android\sdk\platform-tools\adb.exe -P 5037 -s e042712d shell pgrep -f ([[:blank:]]|^)io.appium.settings([[:blank:]]|$)’
[debug] [ADB] Starting Appium Settings app
[debug] [ADB] Running ‘C:\Users\faizm\AppData\Local\Android\sdk\platform-tools\adb.exe -P 5037 -s e042712d shell am start -n io.appium.settings/.Settings -a android.intent.action.MAIN -c android.intent.category.LAUNCHER’
[debug] [ADB] Getting IDs of all ‘io.appium.settings’ processes
[debug] [ADB] Running ‘C:\Users\faizm\AppData\Local\Android\sdk\platform-tools\adb.exe -P 5037 -s e042712d shell pgrep -f ([[:blank:]]|^)io.appium.settings([[:blank:]]|$)’
[debug] [ADB] Getting IDs of all ‘io.appium.settings’ processes
[debug] [ADB] Running ‘C:\Users\faizm\AppData\Local\Android\sdk\platform-tools\adb.exe -P 5037 -s e042712d shell pgrep -f ([[:blank:]]|^)io.appium.settings([[:blank:]]|$)’
[debug] [ADB] Getting IDs of all ‘io.appium.settings’ processes
[debug] [ADB] Running ‘C:\Users\faizm\AppData\Local\Android\sdk\platform-tools\adb.exe -P 5037 -s e042712d shell pgrep -f ([[:blank:]]|^)io.appium.settings([[:blank:]]|$)’
[debug] [ADB] Getting IDs of all ‘io.appium.settings’ processes
[debug] [ADB] Running ‘C:\Users\faizm\AppData\Local\Android\sdk\platform-tools\adb.exe -P 5037 -s e042712d shell pgrep -f ([[:blank:]]|^)io.appium.settings([[:blank:]]|$)’
[debug] [ADB] Getting IDs of all ‘io.appium.settings’ processes
[debug] [ADB] Running ‘C:\Users\faizm\AppData\Local\Android\sdk\platform-tools\adb.exe -P 5037 -s e042712d shell pgrep -f ([[:blank:]]|^)io.appium.settings([[:blank:]]|$)’
[debug] [ADB] Getting IDs of all ‘io.appium.settings’ processes
[debug] [ADB] Running ‘C:\Users\faizm\AppData\Local\Android\sdk\platform-tools\adb.exe -P 5037 -s e042712d shell pgrep -f ([[:blank:]]|^)io.appium.settings([[:blank:]]|$)’
[debug] [ADB] Getting IDs of all ‘io.appium.settings’ processes
[debug] [ADB] Running ‘C:\Users\faizm\AppData\Local\Android\sdk\platform-tools\adb.exe -P 5037 -s e042712d shell pgrep -f ([[:blank:]]|^)io.appium.settings([[:blank:]]|$)’
[debug] [ADB] Getting IDs of all ‘io.appium.settings’ processes
[debug] [ADB] Running ‘C:\Users\faizm\AppData\Local\Android\sdk\platform-tools\adb.exe -P 5037 -s e042712d shell pgrep -f ([[:blank:]]|^)io.appium.settings([[:blank:]]|$)’
[debug] [ADB] Getting IDs of all ‘io.appium.settings’ processes
[debug] [ADB] Running ‘C:\Users\faizm\AppData\Local\Android\sdk\platform-tools\adb.exe -P 5037 -s e042712d shell pgrep -f ([[:blank:]]|^)io.appium.settings([[:blank:]]|$)’
[debug] [ADB] Getting IDs of all ‘io.appium.settings’ processes
[debug] [ADB] Running ‘C:\Users\faizm\AppData\Local\Android\sdk\platform-tools\adb.exe -P 5037 -s e042712d shell pgrep -f ([[:blank:]]|^)io.appium.settings([[:blank:]]|$)’
[debug] [ADB] Getting IDs of all ‘io.appium.settings’ processes
[debug] [ADB] Running ‘C:\Users\faizm\AppData\Local\Android\sdk\platform-tools\adb.exe -P 5037 -s e042712d shell pgrep -f ([[:blank:]]|^)io.appium.settings([[:blank:]]|$)’
[debug] [AndroidDriver] Error: Appium Settings app is not running after 5000ms
[debug] [AndroidDriver] at ADB.requireRunningSettingsApp (C:\Users\faizm.appium\node_modules\appium-uiautomator2-driver\node_modules\appium-adb\lib\tools\settings-client-commands.js:100:11)
[debug] [AndroidDriver] at Object.pushSettingsApp (C:\Users\faizm.appium\node_modules\appium-uiautomator2-driver\node_modules\appium-android-driver\lib\android-helpers.js:677:5)
[debug] [AndroidDriver] at Object.initDevice (C:\Users\faizm.appium\node_modules\appium-uiautomator2-driver\node_modules\appium-android-driver\lib\android-helpers.js:823:5)
[debug] [AndroidDriver] at AndroidUiautomator2Driver.startUiAutomator2Session (C:\Users\faizm.appium\node_modules\appium-uiautomator2-driver\lib\driver.js:393:5)
[debug] [AndroidDriver] at AndroidUiautomator2Driver.createSession (C:\Users\faizm.appium\node_modules\appium-uiautomator2-driver\lib\driver.js:241:7)
[debug] [AndroidDriver] at AppiumDriver.createSession (C:\Users\faizm\AppData\Roaming\npm\node_modules\appium\lib\appium.js:346:35)
[debug] [AndroidUiautomator2Driver@159e (4e82e4a6)] Deleting UiAutomator2 session
[debug] [ADB] Running ‘C:\Users\faizm\AppData\Local\Android\sdk\platform-tools\adb.exe -P 5037 -s e042712d shell dumpsys activity services io.appium.settings/.recorder.RecorderService’
[AndroidUiautomator2Driver@159e (4e82e4a6)] Restoring hidden api policy to the device default configuration
[debug] [ADB] Running ‘C:\Users\faizm\AppData\Local\Android\sdk\platform-tools\adb.exe -P 5037 -s e042712d shell ‘settings delete global hidden_api_policy_pre_p_apps;settings delete global hidden_api_policy_p_apps;settings delete global hidden_api_policy’’
[ADB] Failed to delete keys ‘hidden_api_policy_pre_p_apps,hidden_api_policy_p_apps,hidden_api_policy’. Original error: Error executing adbExec. Original error: ‘Command ‘C:\Users\faizm\AppData\Local\Android\sdk\platform-tools\adb.exe -P 5037 -s e042712d 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 255’; Command output:
[ADB] Exception occurred while executing ‘delete’:
[ADB] java.lang.SecurityException: Permission denial: writing to settings requires:android.permission.WRITE_SECURE_SETTINGS
[ADB] at com.android.providers.settings.SettingsProvider.enforceWritePermission(SettingsProvider.java:2562)
[ADB] at com.android.providers.settings.SettingsProvider.mutateGlobalSetting(SettingsProvider.java:1562)
[ADB] at com.android.providers.settings.SettingsProvider.mutateGlobalSetting(SettingsProvider.java:1554)
[ADB] at com.android.providers.settings.SettingsProvider.deleteGlobalSetting(SettingsProvider.java:1525)
[ADB] at com.android.providers.settings.SettingsProvider.call(SettingsProvider.java:568)
[ADB] at android.content.ContentProvider.call(ContentProvider.java:2511)
[ADB] at android.content.ContentProvider$Transport.call(ContentProvider.java:525)
[ADB] at com.android.providers.settings.SettingsService$MyShellCommand.deleteForUser(SettingsService.java:410)
[ADB] at com.android.providers.settings.SettingsService$MyShellCommand.onCommand(SettingsService.java:284)
[ADB] at com.android.modules.utils.BasicShellCommandHandler.exec(BasicShellCommandHandler.java:97)
[ADB] at android.os.ShellCommand.exec(ShellCommand.java:38)
[ADB] at com.android.providers.settings.SettingsService.onShellCommand(SettingsService.java:51)
[ADB] at android.os.Binder.shellCommand(Binder.java:1073)
[ADB] at android.os.Binder.onTransact(Binder.java:901)
[ADB] at android.os.Binder.execTransactInternal(Binder.java:1331)
[ADB] at android.os.Binder.execTransact(Binder.java:1268)
[ADB]
[ADB] Exception occurred while executing ‘delete’:
[ADB] java.lang.SecurityException: Permission denial: writing to settings requires:android.permission.WRITE_SECURE_SETTINGS
[ADB] at com.android.providers.settings.SettingsProvider.enforceWritePermission(SettingsProvider.java:2562)
[ADB] at com.android.providers.settings.SettingsProvider.mutateGlobalSetting(SettingsProvider.java:1562)
[ADB] at com.android.providers.settings.SettingsProvider.mutateGlobalSetting(SettingsProvider.java:1554)
[ADB] at com.android.providers.settings.SettingsProvider.deleteGlobalSetting(SettingsProvider.java:1525)
[ADB] at com.android.providers.settings.SettingsProvider.call(SettingsProvider.java:568)
[ADB] at android.content.ContentProvider.call(ContentProvider.java:2511)
[ADB] at android.content.ContentProvider$Transport.call(ContentProvider.java:525)
[ADB] at com.android.providers.settings.SettingsService$MyShellCommand.deleteForUser(SettingsService.java:410)
[ADB] at com.android.providers.settings.SettingsService$MyShellCommand.onCommand(SettingsService.java:284)
[ADB] at com.android.modules.utils.BasicShellCommandHandler.exec(BasicShellCommandHandler.java:97)
[ADB] at android.os.ShellCommand.exec(ShellCommand.java:38)
[ADB] at com.android.providers.settings.SettingsService.onShellCommand(SettingsService.java:51)
[ADB] at android.os.Binder.shellCommand(Binder.java:1073)
[ADB] at android.os.Binder.onTransact(Binder.java:901)
[ADB] at android.os.Binder.execTransactInternal(Binder.java:1331)
[ADB] at android.os.Binder.execTransact(Binder.java:1268)
[ADB]
[ADB] Exception occurred while executing ‘delete’:
[ADB] java.lang.SecurityException: Permission denial: writing to settings requires:android.permission.WRITE_SECURE_SETTINGS
[ADB] at com.android.providers.settings.SettingsProvider.enforceWritePermission(SettingsProvider.java:2562)
[ADB] at com.android.providers.settings.SettingsProvider.mutateGlobalSetting(SettingsProvider.java:1562)
[ADB] at com.android.providers.settings.SettingsProvider.mutateGlobalSetting(SettingsProvider.java:1554)
[ADB] at com.android.providers.settings.SettingsProvider.deleteGlobalSetting(SettingsProvider.java:1525)
[ADB] at com.android.providers.settings.SettingsProvider.call(SettingsProvider.java:568)
[ADB] at android.content.ContentProvider.call(ContentProvider.java:2511)
[ADB] at android.content.ContentProvider$Transport.call(ContentProvider.java:525)
[ADB] at com.android.providers.settings.SettingsService$MyShellCommand.deleteForUser(SettingsService.java:410)
[ADB] at com.android.providers.settings.SettingsService$MyShellCommand.onCommand(SettingsService.java:284)
[ADB] at com.android.modules.utils.BasicShellCommandHandler.exec(BasicShellCommandHandler.java:97)
[ADB] at android.os.ShellCommand.exec(ShellCommand.java:38)
[ADB] at com.android.providers.settings.SettingsService.onShellCommand(SettingsService.java:51)
[ADB] at android.os.Binder.shellCommand(Binder.java:1073)
[ADB] at android.os.Binder.onTransact(Binder.java:901)
[ADB] at android.os.Binder.execTransactInternal(Binder.java:1331)
[ADB] at android.os.Binder.execTransact(Binder.java:1268)
[ADB]
[debug] [AppiumDriver@afaf] Event ‘newSessionStarted’ logged at 1687778742065 (16:55:42 GMT+0530 (India Standard Time))
[debug] [AppiumDriver@afaf] Encountered internal error running command: Error: Appium Settings app is not running after 5000ms
[debug] [AppiumDriver@afaf] at ADB.requireRunningSettingsApp (C:\Users\faizm.appium\node_modules\appium-uiautomator2-driver\node_modules\appium-adb\lib\tools\settings-client-commands.js:100:11)
[debug] [AppiumDriver@afaf] at Object.pushSettingsApp (C:\Users\faizm.appium\node_modules\appium-uiautomator2-driver\node_modules\appium-android-driver\lib\android-helpers.js:677:5)
[debug] [AppiumDriver@afaf] at Object.initDevice (C:\Users\faizm.appium\node_modules\appium-uiautomator2-driver\node_modules\appium-android-driver\lib\android-helpers.js:823:5)
[debug] [AppiumDriver@afaf] at AndroidUiautomator2Driver.startUiAutomator2Session (C:\Users\faizm.appium\node_modules\appium-uiautomator2-driver\lib\driver.js:393:5)
[debug] [AppiumDriver@afaf] at AndroidUiautomator2Driver.createSession (C:\Users\faizm.appium\node_modules\appium-uiautomator2-driver\lib\driver.js:241:7)
[debug] [AppiumDriver@afaf] at AppiumDriver.createSession (C:\Users\faizm\AppData\Roaming\npm\node_modules\appium\lib\appium.js:346:35)
[HTTP] <-- POST /wd/hub/session 500 89082 ms - 660

https://discuss.appium.io/search?q=java.lang.SecurityException%3A%20Permission%20denial%3A%20writing%20to%20settings

try first link with answer