Read file in android - file permission denied

I was experiencing the same problem and it can be easily removed by following either of these steps: 1. Install your app by using -g if installing on Android N and O versions. 2. Grant permission manually Settings->apps->"app_name"->Permissions->Enable Switch

For Both steps 1 and 2, define uses-permission

android:name="android.permission.WRITE_EXTERNAL_STORAGE" and uses-permission 
android:name="android.permission.READ_EXTERNAL_STORAGE" in AndroidManifest.xml

Like this :

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="...">


    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
    <!-- all permissions here -->
    <application
        ...

Make sure you have added the permission to read external storage in your manifest file.

 <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />