Q:

AWS Unable to calculate MD5 hash Android

I am uploading image file to S3 via the AWS java SDK, but i am getting the below error while uploading , i have checked my credentials and my bucket they are fine
Unable to calculate MD5 hash: /data/user/0/competent.groove.feetport/files/data/user/0/competent.groove.feetport/app_imageDir/IMG_20161122_073058.jpg: open failed: ENOENT (No such file or directory) 

I am capturing the image from camera and saving the image in phone , here is my code
 @Override
        public void onPictureTaken(CameraView cameraView, final byte[] data) {
            Log.d(TAG, "onPictureTaken " + data.length);
            //Toast.makeText(cameraView.getContext(), R.string.picture_taken, Toast.LENGTH_SHORT) .show();
            getBackgroundHandler().post(new Runnable() {
                @Override
                public void run() {
                    // This demo app saves the taken picture to a constant file.
                    // $ adb pull /sdcard/Android/data/com.google.android.cameraview.demo/files/Pictures/picture.jpg
                    ///storage/7A52-13E8/Android/data/competent.groove.feetport/files/Pictures/picture.jpg
                    //make a new picture file
                    File pictureFile = getOutputMediaFile();

                    if (pictureFile == null) {
                        Toast toast = Toast.makeText(getActivity(), "Picture Not saved", Toast.LENGTH_LONG);
                        toast.show();
                        return;
                    }
                    try {
                        //write the file
                        FileOutputStream fos = new FileOutputStream(pictureFile);
                        fos.write(data);
                        fos.close();
                        Toast toast = Toast.makeText(getActivity(), "Picture saved: " + pictureFile.getName(), Toast.LENGTH_LONG);
                        toast.show();

                        Log.e("-pictureFile--length-----",""+pictureFile.length());
                        Log.e("---pictureFile-----"+pictureFile.getName(),""+pictureFile.getAbsolutePath());
                        Log.e("-fileName--",""+fileName);

                        editor = sharedPref.edit();
                        editor.putString(Constants.PIC_PATH,""+fileName);
                        editor.commit();

                    } catch (FileNotFoundException e) {
                    } catch (IOException e) {
                    }

                }
            });
        }

    };

String fileName="";
    //make picture and save to a folder
    private  File getOutputMediaFile() {
        //make a new file directory inside the "sdcard" folder
       /* File mediaStorageDir = new File("/sdcard/", "JCG Camera");

        //if this "JCGCamera folder does not exist
        if (!mediaStorageDir.exists()) {
            //if you cannot make this folder return
            if (!mediaStorageDir.mkdirs()) {
                return null;
            }
        }*/
        String extStorageDirectory = Environment.getExternalStorageDirectory().toString();

        ContextWrapper cw = new ContextWrapper(getActivity());
        File directory = cw.getDir("imageDir", Context.MODE_PRIVATE);
        Log.e("---directory-----", "" + directory);

        //take the current timeStamp
        String timeStamp = new SimpleDateFormat("yyyyMMdd_HHmmss").format(new Date());
        File mediaFile;
        ///data/user/0/competent.groove.biometric/files/IMG_20160803_181740.jpg
        //and make a media file:

        fileName = directory + File.separator + "IMG_" + timeStamp + ".jpg";
        mediaFile = new File(directory + File.separator + "IMG_" + timeStamp + ".jpg");

        Log.e("---extStorageDirectory-----", "" + extStorageDirectory);
        //Log.e("---mediaFile-----",""+mediaFile.length());
        //Log.e("---mediaFile-----"+mediaFile.getName(),""+mediaFile.getAbsolutePath());

        return mediaFile;

    }

and my aws code to upload file is 
public class UploadAws extends AsyncTask{
private  int total, percentage = 0;
Context context;
String s3_server_path = "";
ObscuredSharedPreferences shrdpref;
ObscuredSharedPreferences.Editor editor;

String res = ""; 

public UploadAws(Context context){
    Log.e(""+getClass(), "UploadAws constructor called");
    this.context = context;
    shrdpref = new ObscuredSharedPreferences(context, context.getSharedPreferences(Constants.PREFERENCES, Context.MODE_PRIVATE));

}

@Override
protected Object doInBackground(Object... params) {
    try {
        Log.d("" + getClass(), "UploadAws doInBackground called");
        File pictures = null;
        AmazonS3Client s3Client = null;
        TransferUtility tx = null;
        percentage = 0;

    try {                           
        s3_server_path = shrdpref.getString(Constants.PIC_PATH,"");

        File dir = context.getFilesDir();
        pictures = new File(dir, s3_server_path);
        s3Client = new AmazonS3Client(new BasicAWSCredentials(shrdpref.getString(Constants.AWS_Access_Key,""),shrdpref.getString(Constants.AWS_Secret_Key,"")));
        tx = new TransferUtility(s3Client,context);

    } catch (NullPointerException e) {
        e.printStackTrace();                
    }                 

        try {

            Log.e("------File length--------=", "" + pictures.length());
            Log.e("------File getName--------=", "" + pictures.getName());
            Log.e("------File getAbsolutePath--------=", "" + pictures.getAbsolutePath());
            s3Client.setEndpoint("s3.amazonaws.com");

            String Feetport_bucket = shrdpref.getString(Constants.fs_bucket, "");

            if (s3Client.doesBucketExist(Feetport_bucket)) {
                Log.e("Warn", "service called bucket exist");
            } else {
                s3Client.createBucket(Feetport_bucket);
                Log.e("FOS signature", "Bucket created");
            }

            int imageIndex = pictures.toString().lastIndexOf("/");
            String pictureString = pictures.toString().substring(imageIndex + 1, pictures.toString().length());

            String selfie_url = "FeetPort/" + shrdpref.getString(Constants.company_name, "") + "/attend/" + Utils.getCurrentDate() + "/" + pictureString;
            Log.d("UploadAws selfie_url called: ", "" + selfie_url);

            //https://feetport.s3.amazonaws.com/8632/17/20161122/mayank1_I_1624_065610_COL22.jpeg

            final TransferObserver observer = tx.upload(Feetport_bucket, pictures.getName(), pictures);

            observer.setTransferListener(new TransferListener() {
                @Override
                public void onStateChanged(int arg0, TransferState state) {
                    Log.e("onStateChanged", "on state changed " + state);
                }

                @Override
                public void onProgressChanged(int id, long bytesCurrent, long bytesTotal) {
                    Log.e("onProgressChanged", "total bytes " + observer.getBytesTotal());
                    Log.e("onProgressChanged", "total bytes transfered " + observer.getBytesTransferred());
                    percentage = (int) (bytesCurrent / bytesTotal * 100);
                    Log.e("onProgressChanged", "total percentage " + percentage);
                }

                @Override
                public void onError(int arg0, Exception arg1) {
                    Log.e("onError=" + arg0, "on Error  " + arg1.toString());
                    percentage = 101;
                }
            });

            do {

            } while (percentage < 100);

            Log.e("percentage", "percentage  " + percentage);
            if (percentage == 100) {
                /**
                 * CGPL-17 9-5-2016 dynamic bucket and url.
                 */
                String S3_SERVER = "https://".concat(Feetport_bucket).concat(".s3.amazonaws.com/");
                String imageUrl = S3_SERVER + selfie_url;

                //Session.setselfie_url(shrdpref, imageUrl);

                editor = shrdpref.edit();
                editor.putString(Constants.PIC_PATH, "" + imageUrl);
                editor.commit();

                Log.e("Selfie url ", "imageUrl --- " + imageUrl);
        /*JsonParameters object = new JsonParameters(context);
        object.markedAttendance(callback);*/
            } else {
        /*JsonParameters object = new JsonParameters(context);
        object.markedAttendance(callback);*/
            }
        } catch (Exception e) {
            e.printStackTrace();
        }

    } catch (Exception exception) {
        exception.printStackTrace();

    }
    return null;
}

}

A:

This isn't anything related to S3.
ENOENT (No such file or directory) is a local error: file not found.
Take a very close look at the path in the error message.  I've included the path here, and added some line breaks for readability.  I did not otherwise edit this, and, importantly, I did not paste any of it here more than once:
/data/user/0
/competent.groove.feetport
/files/data/user/0
/competent.groove.feetport
/app_imageDir/IMG_20161122_073058.jpg

I'm not saying that this is wrong, but it certainly looks wrong.  It certainly looks like you're trying to upload the file from a path that you have incorrectly constructed, with some duplication in the directory structure... and there's no such directory, no such file.

