Android FireBase error when uploading picture
<p>I am trying to upload a picture via a local file method.   </p>

<pre><code>UploadTask uploadTask = currentPicRef.putFile(file, metadata);
</code></pre>

<p>When the user pick's image from the gallery or taking a picture via the camera the picture is saved in external storage and I save the uri in shared preference.   </p>

<p>I successfully loaded the image into an imageview using the <code>setImageURI(uri)</code> method, but When I call the firebase method and using the same uri   (<code>Uri file = Uri.fromFile(new File(fileName));</code>)<br>
 I get the error </p>

<blockquote>
  <p>could not locate file for uploading:file:///content%3A/media/external/images/media/22943</p>
</blockquote>

<p>but when I use log to check the local file I get </p>

<blockquote>
  <p>uri is content://media/external/images/media/22943</p>
</blockquote>

<p>also worth to mention that when I used <code>uri.parse()</code> instead <code>uri.fromFile()</code> in firebase to upload from a local file it uploaded the metadata but not the photo itself.</p>

<p>Any ideas how to fix it?</p>