너무 많은 질문글을 올리게되네요 ㅠㅠ
이건 정말 해결을 못하겠네요;
......
final Process ppp = null;
final DataOutputStream out = new DataOutputStream(ppp.getOutputStream());
Button clean = (Button) findViewById(R.id.button1);
clean.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
try {
if (app.exists()) {
ppp = Runtime.getRuntime().exec("su");
out.writeBytes("del /system/file.abc\n");
out.writeBytes("exit\n");
Toast.makeText(getApplicationContext(), "Removed !", Toast.LENGTH_SHORT).show();
} else {
Toast.makeText(getApplicationContext(), "Failed !", Toast.LENGTH_SHORT).show();
}
} catch (Exception e) {
}
};
});
}
저기 굵게처리된 ppp가 계속 The final local variable ppp cannot be assigned, since it is defined in an enclosing type 이란 오류를 내뿜습니다.
어떻게하면 패스할 수 있나요?
맨 위의 두줄을 public void onClick 안에 넣으면 버튼 누르는 순간 강제종료가 되버립니다...




일단 final로 선언된 변수는 선언과 동시에 값을 집어 넣어야 합니다. (멤버 변수의 경우에는 생성자에서 해도 됨)
즉, final Process ppp = null; 이기 때문에 ppp = Runtime.getRuntime().exec("su"); 를 할 수 없는 거죠.
그리고
final Process ppp = null;
final DataOutputStream out = new DataOutputStream(ppp.getOutputStream());
ppp가 null이므로 NullPointerException이 발생합니다.
맨 위의 두 줄을 onClick 안으로 넣으면 어디서 어떻게 에러가 나면서 죽나요? 로그 보면 아실 듯.