I am getting following error while executing appium java script

Hello Team,

I am getting an error while executing appium java script on Realme C1, Android 9.0 mobile device. but the same script running fine on Lenovo , Android 5.1.1 mobile device.

following is error
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 ‘C:\Users\win10\AppData\Local\Android\Sdk\platform-tools\adb.exe -P 5037 -s b990d528 shell settings delete global hidden_api_policy_pre_p_apps’ exited with code 255’; Stderr: 'Security exception: Permission denial: writing to settings requires:android.permission.WRITE_SECURE_SETTINGS

java.lang.SecurityException: Permission denial: writing to settings requires:android.permission.WRITE_SECURE_SETTINGS
at com.android.providers.settings.SettingsProvider.enforceWritePermission(SettingsProvider.java:2028)
at com.android.providers.settings.SettingsProvider.mutateGlobalSetting(SettingsProvider.java:1093)
at com.android.providers.settings.SettingsProvider.deleteGlobalSetting(SettingsProvider.java:1076)
at com.android.providers.settings.SettingsProvider.delete(SettingsProvider.java:666)
at android.content.ContentProvider$Transport.delete(ContentProvider.java:408)
at com.android.providers.settings.SettingsService$MyShellCommand.deleteForUser(SettingsService.java:406)
at com.android.providers.settings.SettingsService$MyShellCommand.onCommand(SettingsService.java:289)
at android.os.ShellCommand.exec(ShellCommand.java:103)

The devices from this manufacturer are probably not good for automated testing

  1. go to developer option.
  2. go to last option called --> Disable Permission Monitoring --> enable it.
1 Like

@Sandeep_Duve Thank you so much. Its working .

1 Like

The same error happens to me but with Xiaomi device, and I can’t find ‘Disable Permission Monitoring’ in my device. Does anyone know the same option in Xiaomi device?

Linking https://github.com/appium/appium/issues/13802

Thank you so much, it actually worked