title: How to replace deprecated okhttp.RequestBody.create()
body: <p>I try to upload an image from an Android App to a Django server using <strong>Retrofit 2</strong> and <strong>OkHttp3</strong>.
  For that, I used to create a <code>RequestBody</code> instance using the following lines:</p>
  
  <pre><code>RequestBody requestImageFile =
                      // NOW this call is DEPRECATED
                      RequestBody.create(
                              MediaType.parse("image/*"),
  
                              // a File instance created via the path string to the image
                              imageFile
                      );
  </code></pre>
  
  <p>I used the previous instance in the next method call as argument:</p>
  
  <pre><code>// MultipartBody.Part is used to send also the actual file name
  MultipartBody.Part image = MultipartBody.Part.createFormData("image", imageFile.getName(), requestImageFile);
  </code></pre>
  
  <p>Finally, I fired up the Retrofit interface to do the rest:</p>
  
  <pre><code>// finally, execute the request
  Call&lt;ResponseBody&gt; call = service.upload(image);
  call.enqueue(new Callback&lt;ResponseBody&gt;() {
       @Override
       public void onResponse(Call&lt;ResponseBody&gt; call, Response&lt;ResponseBody&gt; response) {
              Log.v("Upload", "success");
       }
  
       @Override
       public void onFailure(Call&lt;ResponseBody&gt; call, Throwable t) {
              Log.e("Upload error:", t.getMessage());
       }
  });
  </code></pre>
  
  <p>Some months ago, Android Studio did not told me that <code>create()</code> was deprecated. When I open the project now, it tells me that <code>create()</code> is deprecated. Does somebody know how to fix it ?</p>