赞
踩
问题描述:
需要查看非root手机中的/data/data/[app name]的内容,以sqlite数据库为例。
1、在代码中更改数据库文件的访问权限
void deal() {
File destDir = new File("/data/data/****/databases/****.db");
Process p;
int status;
try {
p = Runtime.getRuntime().exec("chmod 666 " + destDir);
status = p.waitFor();
if (status == 0) {
// chmod succeed
// Toast.makeText(this, "chmod succeed",
// Toast.LENGTH_LONG).show();
} else {
// chmod failed
// Toast.makeText(this, "chmod failed",
// Toast.LENGTH_LONG).show();
}
} catch (Exception e) {
e.printStackTrace();
}
}
2、把数据库文件复制到CP进行查看(如果不能直接复制,可以先复制到/sdcrad/后,再adb pull)
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。