okhttp上传图片open failed: ENOENT (No such file or directory)

这两天使用okhttp框架上传图片,发生了一个问题open failed: ENOENT,说文件打不开,明明图片路径都是对的,怎么就打不开呢? 

Environment.getExternalStorageDirectory() +  File.separator + Contants.IMAGE_FILE_AVATARNAME_PATH

备注:sd卡路径 + '/' + "attendance/Camera/"

原来是图片路径文件夹超不过了一层(Contants.IMAGE_FILE_AVATARNAME_PATH ="attendance/Camera/")

okhttp中对打开多级路径的图片不支持(没写好,有时用第三方的东西真心累),然后把存的图片路径改成一层:Contants.IMAGE_FILE_AVATARNAME_PATH ="attendance/"

然后就ok了

你可能感兴趣的:(okhttp上传图片open failed: ENOENT (No such file or directory))