I need root access via su to dine in the TcpDump binary (I am working on a kind of android sniffer). I am using this code:
try { Process process = Runtime.getRuntime().exec("su"); DataOutputStream os = new DataOutputStream(process.getOutputStream()); os = new DataOutputStream(process.getOutputStream()); os.writeBytes("/data/local/tcpdump-arm -c 10 -s 0 -w /data/local/out.txt\n"); os.writeBytes("exit\n"); os.flush(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); }
It works fine on the root phone, but I want to achieve this in the emulator. By default, you cannot get root privileges via su on the emulator (although this is possible through the adb shell).
I found this post
But this does not work for me. I read that this advice will not work with the revised version of sdk, but it does not say what it will work with. I am trying to run Android 2.1 with sdk 10 and avd.
abd
source share