2012-12-07 102 views
2

運行adb shell,尋找到/ mnt/shell/emulated/0的遺留鏈接但是ge​​tCanonicalPath無法獲得/ mnt/shell/emulated/0?爲什麼sdcard legacy getCanonicalPath在Android 4.2操作系統中不能模擬/ 0?

殼@機器人:/存儲/仿真$ LS -l lrwxrwxrwx根根2012年12月7日12:01遺留 - >的/ mnt /殼/模擬/ 0

File file = new File("/storage/emulated/legacy"); 
String pachString = null; 
try { 
    pachString = file.getCanonicalPath(); 
     // prints /storage/emulated/legacy 
} catch (IOException e) { 
    e.printStackTrace(); 
} 

回答

2

殼@機器人:/mnt $ ls -l /mnt/

ls -l /mnt/ 
drwxr-xr-x root  system   2013-03-13 16:31 asec 
drwxr-xr-x root  system   2013-03-13 16:31 obb 
lrwxrwxrwx root  root    2013-03-13 16:31 sdcard -> /storage/emulated/legacy 
drwx------ root  root    2013-03-13 16:31 secure 
drwx------ shell shell    2013-03-13 16:31 shell 

'/mnt/shell'目錄被接受只。

因此,應用程序不能read /mnt/shell

+0

「READ_EXTERNAL_STORAGE」權限現在需要訪問SD卡 –

相關問題