Sunday, 27 October 2019

Error executing command: permission denied

I have an executable called iperf to measure network speed. The executable is an asset which I copy to my app files dir programatically. After that, I execute chmod command with 777 permission over this executable, with:

val processChmod = Runtime.getRuntime().exec("/system/bin/chmod 777 ${getExternalFilesDir(null)}/iperf3")
processChmod.waitFor()

The command finishes with exit code 0.

Then, I invoke this executable with:

ProcessBuilder().command(command).redirectErrorStream(true).start()

And I get this:

    Cannot run program 
   "/storage/emulated/0/Android/data/my.packpage.name/files/iperf3": 
   error=13, Permission denied

I don't know what can I do to execute this command in my app files folder. I also have the writte permission in my manifest:

 <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>

And the app has the writte permission granted.



from Error executing command: permission denied

No comments:

Post a Comment