안녕하세요. 초보 개발자 입니다.
현재 하는 프로젝트가 app 내에서 shell 명령어가 필요한 프로젝트인데요.
이 동작을 실행하면 저절로 앱이 종료가 됩니다.
무슨 문제인지는 모르겠는데 코드와 로그 내용 올려보겠습니다..
도움 부탁드리겠습니다.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
tcpDumpOff();
}
private void tcpDumpOff() {
Process process;
Runtime runtime = Runtime.getRuntime();
try {
Log.d("hcjung","tcpdumpoff");
String cmd = "pkill -9 tcpdump\n";
process = Runtime.getRuntime().exec("su");
DataOutputStream os = new DataOutputStream(process.getOutputStream());
os.flush();
os.writeBytes(cmd);
// os.flush();
// os.writeBytes("exit\n");
// os.flush();
// os.close();
} catch (Exception e) {
e.fillInStackTrace();
}
}
로그 내용은
09-20 10:54:37.861 17889-17889/com.example.hyeon.tcpdump D/dalvikvm: VFY: replacing opcode 0x6e at 0x0002
09-20 10:54:37.866 17889-17889/com.example.hyeon.tcpdump I/dalvikvm: Could not find method android.content.res.TypedArray.getType, referenced from method android.support.v7.widget.TintTypedArray.getType
09-20 10:54:37.866 17889-17889/com.example.hyeon.tcpdump W/dalvikvm: VFY: unable to resolve virtual method 830: Landroid/content/res/TypedArray;.getType (I)I
09-20 10:54:37.866 17889-17889/com.example.hyeon.tcpdump D/dalvikvm: VFY: replacing opcode 0x6e at 0x0008
09-20 10:54:37.906 17889-17889/com.example.hyeon.tcpdump I/dalvikvm: Could not find method android.widget.FrameLayout.startActionModeForChild, referenced from method android.support.v7.widget.ActionBarContainer.startActionModeForChild
09-20 10:54:37.906 17889-17889/com.example.hyeon.tcpdump W/dalvikvm: VFY: unable to resolve virtual method 18881: Landroid/widget/FrameLayout;.startActionModeForChild (Landroid/view/View;Landroid/view/ActionMode$Callback;I)Landroid/view/ActionMode;
참고로 저 코드 이후에 다른 코드도 있습니다. 그런데 저부분만 실행되고는 바로 앱이 종료되는것이구요..