1

I get this error and cannot start the device:

java.lang.reflect.InvocationTargetException
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\\Dell\\Downloads\\commandlinetools-win-8512546_latest\\platform-tools\\adb.exe -P 5037 -s AA5DY9JBON69SGUC 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:2374)
    at com.android.providers.settings.SettingsProvider.mutateGlobalSetting(SettingsProvider.java:1413)
    at 

Exception occurred while executing 'delete':
java.lang.SecurityException: Permission denial: writing to settings requires:android.permission.WRITE_SECURE_SETTINGS
    at 
com.android.providers.settings.SettingsService$MyShellCommand.onCommand(SettingsService.java:281)
    at android.os.BasicShellCommandHandler.exec(BasicShellCommandHandler.java:98)
    at android.os.ShellCommand.exec(ShellCommand.java:44)
    at com.android.providers.settings.SettingsService.onShellCommand(SettingsService.java:49)
    at android.os.Binder.shellCommand(Binder.java:936)
    at android.os.Binder.onTransact(Binder.java:820)
    at android.os.Binder.execTransactInternal(Binder.java:1166)

java.base/java.util.stream.ReferencePipeline.forEachWithCancel(ReferencePipeline.java:129)
    at java.base/java.util.stream.AbstractPipeline.copyIntoWithCancel(AbstractPipeline.java:527)
    at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:513)
    at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499)
    at java.base/java.util.stream.FindOps$FindOp.evaluateSequential(FindOps.java:150)
    at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
    at java.base/java.util.stream.ReferencePipeline.findFirst(ReferencePipeline.java:647)
    at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:128)
    ... 17 more

I'm using these dependencies

<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>3.141.59</version>


<groupId>io.appium</groupId>
<artifactId>java-client</artifactId>
<version>7.0.0</version>

and connected the device correctly. Here's my code:

public class CalculatorTest {

static AppiumDriver<MobileElement> driver;


public static void main(String[] args) {

            openCalculator();
}   
public static void openCalculator() throws MalformedURLException  {
    DesiredCapabilities cap = new DesiredCapabilities();
    cap.setCapability("deviceName", "realme C15");
    cap.setCapability("udid", "AA5DY9JBON69SGUC");
    cap.setCapability("platformName", "Android");
    cap.setCapability("platformVersion", "11");
    cap.setCapability("appPackage", "com.coloros.calculator");
    cap.setCapability("appActivity", "com.android.calculator2.Calculator");
    
    URL url = new URL("http://127.0.0.1:4723/wd/hub");
    driver = new AppiumDriver<MobileElement>(url , cap);        
}

}

1 Answer 1

1

Remove the selenium dependency and try running, it should work

1
  • +1 you only need the java-client for Appium. Unless you fancy a trip to jar hell ?
    – ToastMan
    Jan 19, 2023 at 19:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.