Failed to create session. An unknown server-side error occurred while processing the command. Original error: Error executing adbExec

Failed to create session. An unknown server-side error occurred while processing the command. Original error: Error executing adbExec. Original error: ‘Command ‘‘C:\Users\Hibooks User\AppData\Local\Android\Sdk\platform-tools\adb.exe’ -P 5037 -s 2f5a7783 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: Exception occurred while executing ‘delete’: java.lang.SecurityException: Permission denial: writing to settings requires:android.permission.WRITE_SECURE_SETTINGS at com.android.providers.settings.SettingsProvider.enforceWritePermission(SettingsProvider.java:2268) at com.android.providers.settings.SettingsProvider.mutateGlobalSetting(SettingsProvider.java:1435) at com.android.providers.settings.SettingsProvider.mutateGlobalSetting(SettingsProvider.java:1427) at com.android.providers.settings.SettingsProvider.deleteGlobalSetting(SettingsProvider.java:1398) at com.android.providers.settings.SettingsProvider.call(SettingsProvider.java:523) at android.content.ContentProvider.call(ContentProvider.java:2486) at android.content.ContentProvider$Transport.call(ContentProvider.java:517) at com.android.providers.settings.SettingsService$MyShellCommand.deleteForUser(SettingsService.java:408) at com.android.providers.settings.SettingsService$MyShellCommand.onCommand(SettingsService.java:282) at com.android.modules.utils.BasicShellCommandHandler.exec(BasicShellCommandHandler.java:97) at android.os.ShellCommand.exec(ShellCommand.java:38) at com.android.providers.settings.SettingsService.onShellCommand(SettingsService.java:50) at android.os.Binder.shellCommand(Binder.java:950) at


FYI: Server is connected, getting my device in adb device list. but unable to resolve this error

https://discuss.appium.io/search?q="Permission%20denial%3A%20writing%20to%20setting"%20order%3Alatest

can’t understand @Aleksei can you please share a bit more details?

You did not mention phone you have. Possibly it is some kind of Oppo or Xiaomi that have some restrictions.

start checking from:
In Developer Option scroll to end you will find an option “Disable permission monitoring”
click on this.

yes @Aleksei it’s Xiaomi
Didn’t get this option

check other solutions in google → "Permission denial: writing to settings requires:android.permission.WRITE_SECURE_SETTINGS" - Google Search