How to resolve 'Permission denial: WRITE_SECURE_SETTINGS' error when starting a mobile test on Android with Katalon?

I am encountering an error when I try to start a mobile application test using Katalon Studio. It seems that ADB commands related to settings delete are failing due to permission denial. I am using a realme RMX3630 device running Android 14.

Here is the error message I received:
java.util.concurrent.ExecutionException: org.openqa.selenium.SessionNotCreatedException: Could not start a new session. Response code 500.
Message: An unknown server-side error occurred while processing the command. Original error: Error executing adbExec.
Original error: ‘Command ‘C:\Users\gayuh\.katalon\tools\android_sdk\platform-tools\adb.exe -P 5037 -s USNVNRAUCYP7GABM 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, must have one of: [android.permission.WRITE_SECURE_SETTINGS]

Environment Details:

  • Katalon Studio Version: 10 Free
  • Operating System: Windows 11
  • Java Version: 1.8.0_421
  • Device: realme RMX3630
  • Android Version: 14
  • Appium Automation: uiautomator2

Additional Context:

  • I am using scrcpy to control the device, and ADB works fine for other commands.
  • The issue seems to stem from a lack of permission to execute WRITE_SECURE_SETTINGS on the device.
  • I have attached a screenshot of the full error message (see below).

Question:

  • How can I bypass or resolve this issue to allow Katalon Studio to interact properly with my device?
  • Is there any configuration or workaround to handle this for non-rooted devices?

Screenshoot:

1 Like

I have a Redmi device that was throwing this error for a while. My device is on a slightly older version of android but it could be the same.

I had to enable the developer setting Disable Permission Monitoring I found this by going to:

Settings → Developer Settings → Disable Permission Monitoring.

Hopefully that works for you.

2 Likes

Thank you :heart: