There are multiple such questions out there, however, they are not able to solve the problem.
build.gradle
- compileSdkVersion - 29
- buildToolsVersion - 29.0.3
- midSdkVersion - 26
- targetSdkVersion - 29
- Android Studio - 3.6
- Testing Device OS - Android Q (10)
Android Manifest.xml
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.INTERNET" />
Activity.java
String filepath = '/path/to/file';
filepath.exists() // true
filepath.canRead() // false
filepath.canWrite() // false
ActivityCompat.checkSelfPermission(this, Manifest.permission.READ_EXTERNAL_STORAGE) == PackageManager.PERMISSION_GRANTED // true
ActivityCompat.checkSelfPermission(this, Manifest.permission.WRITE_EXTERNAL_STORAGE) == PackageManager.PERMISSION_GRANTED // true
The MainActivity
is not able to read the file despite the fact that the file exists and the relevant permissions have been granted. Is there any other solution to this problem?