运行 adb shell,查找到 /mnt/shell/emulated/0 的旧链接但是 getCanonicalPath 无法获取 /mnt/shell/emulated/0?
shell@android:/storage/emulated $ ls -l lrwxrwxrwx root root 2012-12-07 12:01 legacy -> /mnt/shell/emulated/0
File file = new File("/storage/emulated/legacy");
String pachString = null;
try {
pachString = file.getCanonicalPath();
// prints /storage/emulated/legacy
} catch (IOException e) {
e.printStackTrace();
}