Not able to run Appium script, getting error You need the android.permission


I’m new to Appium. I’m using the Appium server, i have added desired capabilities in Appium and my real device is connected (Android version 7.1.2). While running Appium script it is showing the following error
An unknown server-side error occurred while processing the command.
Stderr: ‘Error: java.lang.SecurityException: You need the android.permission.INSTALL_GRANT_RUNTIME_PERMISSIONS permission to use the PackageManager.INSTALL_GRANT_RUNTIME_PERMISSIONS flag’; Code: ‘1’

Below is the desired capabilities added on Appium
“deviceName”: “Redmi”,
“platformName”: “Android”,
“platformVersion”: “7.1.2”,
“appPackage”: “io.ionic.scoolmeal”,
“appActivity”: “com.scoolmeal.view.acivities.SplashScreenActivity”,
“udid”: “3678e47e”,
“automationName”: “uiautomator2”,
“autoGrantPermissions”: true
I have installed Android 7.1.1 and 7.0 from SDK manager, 7.1.2 was not available in SDK platforms list
Added Android SDK path and java path (java version “1.8.0_211”)in the env: variables of my system. Is the issue related to my device android version? Or i need to set any other permissions on my device?

Please help me on this issue.

this device is not good for automation. Consider replacing it to some other one, which does not have MiOS restrictions.

1 Like