/dev/local
という名前のnative(私はadbを通してプッシュしました)というバイナリをルート権限で実行したいとします。私はBrokenPipeエラーを取得これによりバイナリをrootのAndroidアプリケーションから実行する
try{
root=Runtime.getRuntime().exec("su");
root.waitFor();
DataOutputStream os = new DataOutputStream(root.getOutputStream());
DataInputStream osRes = new DataInputStream(root.getInputStream());
os.writeBytes("/data/local/native\n");
os.flush();
TextView output=(TextView)findViewById(R.id.textview);
output.append(osRes.readLine());
root.waitFor();
} catch (Exception e) {
// TODO Auto-generated catch block
Toast.makeText(this, e.toString() , Toast.LENGTH_SHORT).show();
}
:私はそれを変更してみました、これは私にNullPointerException
。だからを与えた
try {
root=Runtime.getRuntime().exec("su");
DataOutputStream os = new DataOutputStream(root.getOutputStream());
DataInputStream osRes = new DataInputStream(root.getInputStream());
os.writeBytes("/data/local/native\n");
os.flush();
TextView output=(TextView)findViewById(R.id.textview);
output.append(osRes.readLine());
root.waitFor();
} catch (Exception e) {
// TODO Auto-generated catch block
Toast.makeText(this, e.toString() , Toast.LENGTH_SHORT).show();
}
: はそれを達成するために、私は次のコードを書きました。
私はroot特権でバイナリを実行したいのですが、別の方法があるのでしょうか、それとも間違っているのですか?
私はこれを試しましたが、このように実行可能ファイルは実行されません! :( – d34th4ck3r