In my application users select picture from gallery and upload. On many devices my code works perfect but on new devices (etc: samsung S5, LG G2, Samsung S4) application crashes
in this tutorial used an util class which is handling all types of images from different sources. https://www.simplifiedcoding.net/upload-pdf-file-server-android/ you have to do just, in on onActivityResult method
String path = FilePath.getPath(this, filePath);
you will get right path, across every device and every source of app which are providing images(FilePath class will available in above tutorial link)