title: java.lang.IllegalArgumentException: Length of Base64 encoded input string is not a multiple of 4 with Cloudinary
body: <p>when I tried to upload file I get this message.
  "java.lang.IllegalArgumentException: Length of Base64 encoded input string is not a multiple of 4."
  here is my code below</p>
  
  <p>I am using cloudinary android library for my CDN. 
  Usually, my library is working fine. but sometime's it happens and I can't find out the cause of reason.</p>
  
  <pre><code>@Override
  public void onActivityResult(int requestCode, int resultCode, Intent data) {
      super.onActivityResult(requestCode, resultCode, data);
  
      if (requestCode == ConstantsCustomGallery.REQUEST_CODE &amp;&amp; resultCode == RESULT_OK &amp;&amp; data != null) {
          //The array list has the image paths of the selected images
          images = data.getParcelableArrayListExtra(ConstantsCustomGallery.INTENT_EXTRA_IMAGES);
  
          imagePath = images.get(0).path;
  
  
          UploadCallback callback = new UploadCallback() {
              @Override
              public void onStart(String requestId) {
  
                  Log.d("id", requestId);
                  loading_layout.setVisibility(View.VISIBLE);
                  loading.show();
                  //progress_text.setVisibility(View.VISIBLE);
  
              }
  
              @Override
              public void onProgress(String requestId, long bytes, long totalBytes) {
  
                  Log.d("pregress", String.valueOf(bytes/totalBytes * 100) + "%");
                  final String progressString = String.valueOf(bytes/totalBytes * 100) + "%";
                  //progress_text.setText(progressString);
  
              }
  
              @Override
              public void onSuccess(String requestId, Map resultData) {
  
                  loading_layout.setVisibility(View.GONE);
                  loading.hide();
                  //progress_text.setVisibility(View.GONE);
  
                  Log.d("resultdata", resultData.get("secure_url").toString());
  
                  String uploadImg = resultData.get("secure_url").toString();
                  String[] splitString = uploadImg.split("/");
                  String uploadTarget = splitString[splitString.length-2] + "/" + splitString[splitString.length-1];
                  String finalUploadTaget = FunctionBase.imageUrlBase300 + uploadTarget;
  
                  finalImage = uploadTarget;
  
                  RequestManager requestManager = Glide.with(getActivity());
  
                  if(gifChecker(finalUploadTaget)){
  
                      requestManager
                              .load(finalUploadTaget)
                              .asGif()
                              .diskCacheStrategy(DiskCacheStrategy.SOURCE)
                              .into(preview);;
  
                  } else {
  
                      requestManager.load(finalUploadTaget).into(preview);
  
                  }
  
              }
  
              @Override
              public void onError(String requestId, ErrorInfo error) {
  
                  Log.d("error1", error.toString());
                  TastyToast.makeText(getActivity(), "업로드가 실패 했습니다 다시 시도해주세요.", TastyToast.LENGTH_LONG, TastyToast.ERROR);
  
              }
  
              @Override
              public void onReschedule(String requestId, ErrorInfo error) {
  
                  Log.d("error2", error.toString());
                  TastyToast.makeText(getActivity(), "업로드가 실패 했습니다 다시 시도해주세요.", TastyToast.LENGTH_LONG, TastyToast.ERROR);
  
              }
          };
  
          MediaManager.get().upload(imagePath).unsigned(AppConfig.image_preset).callback(callback).dispatch();
  
  
  
  
  
  
  
      }
  
  
  
  }
  </code></pre>
  
  <p>there is error log from logcat below.</p>
  
  <pre><code>09-13 14:22:02.348 31605-32612/? E/JobExecutor: Crashed job{id=29, 
  finished=true, result=FAILURE, canceled=false, periodic=false, class=UploadJob, tag=CLD}
                                              java.lang.IllegalArgumentException: Length of Base64 encoded input string is not a multiple of 4.
                                                  at com.cloudinary.utils.Base64Coder.decode(Base64Coder.java:243)
                                                  at com.cloudinary.utils.Base64Coder.decode(Base64Coder.java:226)
                                                  at com.cloudinary.utils.Base64Coder.decode(Base64Coder.java:214)
                                                  at com.cloudinary.utils.Base64Coder.decodeString(Base64Coder.java:181)
                                                  at com.cloudinary.android.payload.FilePayload.loadData(FilePayload.java:51)
                                                  at com.cloudinary.android.payload.PayloadFactory.fromUri(PayloadFactory.java:44)
                                                  at com.cloudinary.android.DefaultRequestProcessor.processRequest(DefaultRequestProcessor.java:82)
                                                  at com.cloudinary.android.MediaManager.processRequest(MediaManager.java:367)
                                                  at com.cloudinary.android.AndroidJobStrategy$UploadJob.onRunJob(AndroidJobStrategy.java:203)
                                                  at com.evernote.android.job.Job.runJob(Job.java:109)
                                                  at com.evernote.android.job.JobExecutor$JobCallable.runJob(JobExecutor.java:151)
                                                  at com.evernote.android.job.JobExecutor$JobCallable.call(JobExecutor.java:136)
                                                  at com.evernote.android.job.JobExecutor$JobCallable.call(JobExecutor.java:119)
                                                  at java.util.concurrent.FutureTask.run(FutureTask.java:237)
                                                  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
                                                  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
                                                  at java.lang.Thread.run(Thread.java:818)
  09-13 14:22:02.348 31605-32613/? E/JobExecutor: Crashed job{id=30, finished=true, result=FAILURE, canceled=false, periodic=false, class=UploadJob, tag=CLD}
                                              java.lang.IllegalArgumentException: Length of Base64 encoded input string is not a multiple of 4.
                                                  at com.cloudinary.utils.Base64Coder.decode(Base64Coder.java:243)
                                                  at com.cloudinary.utils.Base64Coder.decode(Base64Coder.java:226)
                                                  at com.cloudinary.utils.Base64Coder.decode(Base64Coder.java:214)
                                                  at com.cloudinary.utils.Base64Coder.decodeString(Base64Coder.java:181)
                                                  at com.cloudinary.android.payload.FilePayload.loadData(FilePayload.java:51)
                                                  at com.cloudinary.android.payload.PayloadFactory.fromUri(PayloadFactory.java:44)
                                                  at com.cloudinary.android.DefaultRequestProcessor.processRequest(DefaultRequestProcessor.java:82)
                                                  at com.cloudinary.android.MediaManager.processRequest(MediaManager.java:367)
                                                  at com.cloudinary.android.AndroidJobStrategy$UploadJob.onRunJob(AndroidJobStrategy.java:203)
                                                  at com.evernote.android.job.Job.runJob(Job.java:109)
                                                  at com.evernote.android.job.JobExecutor$JobCallable.runJob(JobExecutor.java:151)
                                                  at com.evernote.android.job.JobExecutor$JobCallable.call(JobExecutor.java:136)
                                                  at com.evernote.android.job.JobExecutor$JobCallable.call(JobExecutor.java:119)
                                                  at java.util.concurrent.FutureTask.run(FutureTask.java:237)
                                                  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
                                                  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
                                                  at java.lang.Thread.run(Thread.java:818)
  </code></pre>