Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/232.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
File.delete()不删除Android上的符号链接?_Android - Fatal编程技术网

File.delete()不删除Android上的符号链接?

File.delete()不删除Android上的符号链接?,android,Android,我无法删除Android上的符号链接。无法使用File.delete(),也不能使用 exec(“rm”+verFile.getPath()) 我有一个符号链接 com.example.app/mydata/12345.ver-->com.example.app/lib/library.so 它是由 Runtime.getRuntime().exec(String.format("ln -s %s %s", target, link)); 升级后(从web下载其他build.apk),我想通过

我无法删除Android上的符号链接。无法使用
File.delete()
,也不能使用
exec(“rm”+verFile.getPath())

我有一个符号链接

com.example.app/mydata/12345.ver-->com.example.app/lib/library.so

它是由

Runtime.getRuntime().exec(String.format("ln -s %s %s", target, link));
升级后(从web下载其他build.apk),我想通过以下方式删除此链接:

File verFile = new File(dataDir, verFile);
Log.w("MyApp", "Deleting file " + verFile.getPath());
if (verFile.exists()) Log.w("MyApp", "File exists!");
try {
    Runtime.getRuntime().exec("rm " + verFile.getPath());
} catch( IOException ioex ) { Log.w("MyApp", "Failed to delete"); }
我可以代替

Runtime.getRuntime().exec("rm " + verFile.getPath());

但它没有效果(文件仍然不会被删除)

从adb日志中我可以看到

W/MyApp   (13298): Deleting file /data/data/com.example.app/mydata/12345.ver
W/MyApp   (13298): File exists!
但是12345.ver文件仍然存在!它与应用程序的其余部分具有相同的用户/组权限(除了
lib
目录,该目录由
system
用户拥有)


有什么线索吗?

我知道这有点晚了,但谷歌派我来这里是为了解决类似的问题。 任何删除特定符号链接的尝试都失败,并显示令人困惑的消息“directory not empty” 我再深入一点,发现目标文件不存在。我创建了一个,rm工作:-)


在我看来,这似乎是安卓系统中的一个bug,但我对安卓系统来说太陌生了,无法确定。

你在执行呼叫中尝试过“rm-f”吗?
W/MyApp   (13298): Deleting file /data/data/com.example.app/mydata/12345.ver
W/MyApp   (13298): File exists!