Otrzymuję komunikat o błędzie podczas uruchamiania tego kodu, a błąd jest następujący: "Odmowa dostępu root [java.io.IOException]: Błąd z uruchomieniem komendy exec(). Command: [su] Working Katalog: null Środowisko: null "Błąd "Odmowa dostępu root" w aplikacji Android
try
{
suProcess = Runtime.getRuntime().exec("su");
DataOutputStream os = new DataOutputStream(suProcess.getOutputStream());
DataInputStream osRes = new DataInputStream(suProcess.getInputStream());
if (null != os && null != osRes)
{
// Getting the id of the current user to check if this is root
os.writeBytes("id\n");
os.flush();
String currUid = osRes.readLine();
boolean exitSu = false;
if (null == currUid)
{
retval = false;
exitSu = false;
Log.d("ROOT", "Can't get root access or denied by user");
}
else if (true == currUid.contains("uid=0"))
{
retval = true;
exitSu = true;
Log.d("ROOT", "Root access granted");
}
else
{
retval = false;
exitSu = true;
Log.d("ROOT", "Root access rejected: " + currUid);
}
if (exitSu)
{
os.writeBytes("exit\n");
os.flush();
}
}
}
catch (Exception e)
{
Log.d("ROOT", "Root access rejected [" + e.getClass().getName()
+ "] : " + e.getMessage());
}
Próbuję zaimplementować kod, w którym muszę skompresować wideo za pomocą Androida, ale nie mogę znaleźć odpowiedniego API do tego. Czy możesz mnie poprowadzić? –