Caused by: java.io.IOException: Permission denied
- find where su is, for instance:
/system/xbin/su - check su's file permission:
ls -al /system/xbin/su - change mod if necessary:
chmod 4755 su - try again.
Caused by: java.io.IOException: Permission denied
- find where su is, for instance:
/system/xbin/su - check su's file permission:
ls -al /system/xbin/su - change mod if necessary:
chmod 4755 su - try again.
Have you tried to add this permission
<uses-permission android:name="android.permission.ACCESS_SUPERUSER"/>
My ROM was messed up. I had to reinstall it. Adding a permission should NOT help. Edit: SuperUser is now giving warning if you don't define the permission, how ever it will still grant su.
You need to add to your AndroidManifest.xml
<uses-permission android:name="android.permission.ACCESS_SUPERUSER"/>
Files located on SD card aren't executable. Move the file to internal storage (e.g. to /data/local or, if you get permission denied, to data/local/tmp).
That is how I did it :
String filePath = getFilesDir().getAbsolutePath() + File.separator + "myFileName";
File myFile = new File(filePath);
if (!myFile.canExecute()) {
Log.d("File is not executable, trying to make it executable ...");
if (myFile .setExecutable(true)) {
Log.d("File is executable");
} else {
Log.d("Failed to make the File executable");
}
} else {
Log.d("File is executable");
}
I think Android's chmod does not understand u+x syntax, try using the numeric notation like 744.
It depends on the command you wish to run, you may not need any. However, if your attempting to run a system level command you will need root access (not an Android permission). Running a platform command pretty much circumvents anything going on with Android permissions and is only affected by whether or not your linux user id has read/write/execute permission for the command you are issuing.
Runtime.exec() will also throw a SecurityException if you are not allowed to run a specific command and the exception will provide more details as to why in the specific case, so you should probably catch that in your try block also. You may also use Runtime.checkexec() to verify if you can run a certain command string before you actually attempt it.
Hope that Helps!
I assume that no permissions are necessary here. But you can analyze the result of execution in order to understand were the binary get executed.