title: While Uploading Images to Firebase I am getting "Permission denied" error
body: <p>I want to upload Image from drawable to firebase database but I am getting Permission denied error. I have taken permissions also. I have taken Uri of the drawable image and then uploaded it, but it gives permission denied error.</p>
  
  <pre><code>  private Uri mImageUri;
    private StorageReference mStorageRef;
    private DatabaseReference mDatabaseRef;
  
     private StorageTask mUploadTask;
     @Override
    protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_main);
      mImageUri = Uri.parse("android.resource://" + getPackageName() + "/" + 
    R.drawable.mobile);
  
  
      mStorageRef = FirebaseStorage.getInstance().getReference("uploads");
      mDatabaseRef = FirebaseDatabase.getInstance().getReference("uploads");
      uploadFile();
  }
  
  
  
   private void uploadFile() {
      if (mImageUri != null) {
          StorageReference fileReference = 
            mStorageRef.child(System.currentTimeMillis()
                  + "." + getFileExtension(mImageUri));
  
          mUploadTask = fileReference.putFile(mImageUri)
                  .addOnSuccessListener(new OnSuccessListener&lt;UploadTask.TaskSnapshot&gt;() {
                      @Override
                      public void onSuccess(UploadTask.TaskSnapshot taskSnapshot) {
                          Handler handler = new Handler();
                          handler.postDelayed(new Runnable() {
                              @Override
                              public void run() {
                              }
                          }, 500);
  
                          Toast.makeText(MainActivity.this, "Upload successful", Toast.LENGTH_LONG).show();
                          Upload upload = new Upload("Image",
                                  taskSnapshot.getDownloadUrl().toString());
                          String uploadId = mDatabaseRef.push().getKey();
                          mDatabaseRef.child(uploadId).setValue(upload);
                      }
                  })
                  .addOnFailureListener(new OnFailureListener() {
                      @Override
                      public void onFailure(@NonNull Exception e) {
                          Toast.makeText(MainActivity.this, e.getMessage(), Toast.LENGTH_SHORT).show();
                      }
                  });
  
      } else {
          Toast.makeText(this, "No file selected", Toast.LENGTH_SHORT).show();
      }
  }
  </code></pre>
  
  <p>Here are the dependencies that I have taken:</p>
  
  <pre><code>compile 'com.google.firebase:firebase-database:10.0.1'
  testCompile 'junit:junit:4.12'
  compile 'com.firebase:firebase-client-android:2.3.1'
  compile 'com.google.firebase:firebase-auth:10.0.1'
  compile 'com.google.firebase:firebase-storage:10.0.1'
  compile 'com.android.support:multidex:1.0.0'
  implementation 'com.firebase:geofire-android:2.1.1'
  </code></pre>
  
  <p>I am getting the following error</p>
  
  <pre><code>06-13 10:30:53.416 13173-13173/com.diyabhat.mycart W/DynamiteModule: Failed 
  to load module via fast 
  routecom.google.android.gms.dynamite.DynamiteModule$zza: V2 version check 
  failed
  06-13 10:30:53.483 13173-13198/com.diyabhat.mycart W/DynamiteModule: Failed 
  to load module via fast 
  routecom.google.android.gms.dynamite.DynamiteModule$zza: V2 version check 
  failed
  06-13 10:30:56.778 12931-12931/? E/Finsky: [1] 
  com.google.android.finsky.wear.y.a(3): onConnectionFailed: 
  ConnectionResult{statusCode=API_UNAVAILABLE, resolution=null, message=null}
  06-13 10:31:14.434 13236-13236/? E/libmdmdetect: Failed to open 
  /sys/bus/msm_subsys/devices/subsys0/name: Permission denied
  06-13 10:31:14.569 13241-13241/? E/libmdmdetect: Failed to open 
  /sys/bus/msm_subsys/devices/subsys0/name: Permission denied
  06-13 10:31:15.576 13263-13263/? E/libmdmdetect: Failed to open 
  /sys/bus/msm_subsys/devices/subsys0/name: Permission denied
  </code></pre>