我正在將相機拍攝的圖像保存到外部存儲器。稍後我想將圖像上傳到我們的服務器。Android FileNotFoundException即使文件可用並且已設置權限
那裏我嘗試從路徑重新創建文件,但總是出現FileNotFoundException。
File file = new File("file:/storage/emulated/0/Pictures/Instantley/IMG_20160523_170354803382833.jpg");
我已經籤:
- 的文件都可以(把查找到的照片應用程序,並檢查URL)
- 設置權限的外部讀取清單中的
請求的運行時許可
Caused by: android.system.ErrnoException: open failed: ENOENT (No such file or directory) 05-23 17:04:33.014 1918-1918/com.instantley.messenger W/System.err: at libcore.io.Posix.open(Native Method) 05-23 17:04:33.014 1918-1918/com.instantley.messenger W/System.err: at libcore.io.BlockGuardOs.open(BlockGuardOs.java:186) 05-23 17:04:33.015 1918-1918/com.instantley.messenger W/System.err: at libcore.io.IoBridge.open(IoBridge.java:438)
嘗試打印的文件路徑,並檢查是否正確 – somia
使用的路徑,我會建議檢查這個http://www.technotalkative.com/android-read-text-file-from-sd-card/ – Harpreet