I created a .sh script which sets app permissions on Android devices.
If I push the script on /sdcard
and run it through adb shell
with command sh ./test.sh
, the following error occurs on each permission:
Bad argument: java.lang.IllegalArgumentException: Unknown permission: android.permission.WRITE_EXTERNAL_STORAGE
Here is my Script:
#!/bin/bash
pm grant com.android.camera2 android.permission.RECORD_AUDIO
pm grant com.android.camera2 android.permission.CAMERA
pm grant com.android.camera2 android.permission.ACCESS_FINE_LOCATION
pm grant com.android.camera2 android.permission.WRITE_EXTERNAL_STORAGE
pm grant com.android.camera2 android.permission.READ_EXTERNAL_STORAGE
pm grant com.android.chrome android.permission.CAMERA
pm grant com.android.chrome android.permission.ACCESS_FINE_LOCATION
pm grant com.android.chrome android.permission.WRITE_EXTERNAL_STORAGE
pm grant com.android.chrome android.permission.READ_EXTERNAL_STORAGE
pm grant com.android.chrome android.permission.RECORD_AUDIO
So every time the same command for different permissions and different apps. If I'm using these commands manually on adb shell
it works.
I don't have root permissions and the device OS is Android 8.1.0