File file = new File("/data/data/com.wlanplus.chang/lib/libcutil.so");
file.delete();
执行后查看文件依然在。 后来加入如下代码
upgradeRootPermission(getPackageCodePath());//请求ROOT权限
file.setExecutable(true, false);
file.setReadable(true, false);
file.setWritable(true, false);
添加了权限:
<uses-permission android:name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS"></uses-permission>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"></uses-permission>
依然不行。
file.exists() file.canWrite()返回也都是true。
该怎么才能删除呢?
Looking at the file path, it should be a problem with the file you want to delete. The system doesn’t want you to delete it, so it creates a new one every time you delete it. You can try manually deleting the file on your phone. If you still can't delete it, that's why.
/data/data/+Package name If the files in the directory are non-root, only the package name program can perform read and write operations.
You can refer to http://www.cnblogs.com/tgyf/p/4649319.html