Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Q : java.io.FileNotFoundException: /proc/self/net/dev: open failed: EACCES (Permission denied)

I want to open the file "/proc/self/net/dev" with a FileReader. In the Android 10 there comes a java.io.FileNotFoundException: /proc/self/net/dev: open failed: EACCES (Permission denied) In older versions it's no problem to open this file. What can I do?

like image 483
Bafoeg Avatar asked Aug 26 '19 11:08

Bafoeg


People also ask

How do I fix Open failed Eacces permission denied?

Just turn off USB storage, and with the correct permissions, you'll have the problem solved. Save this answer.

How do you fix exception Open failed Eacces permission denied on Android 11 12?

MANAGE_EXTERNAL_STORAGE"/> in the manifest file and try to get the file access permission in the android 11 phones. Then you will open and read the file from the storage. if you are working with android 11 and working on a file then you have to use MANAGE_EXTERNAL_STORAGE permission.


1 Answers

As per Android developer document, they have make change for Android Q scope storage. If your app is targeting Android Q, you should define android:requestLegacyExternalStorage="true" in manifest file

<manifest ... >
  <!-- This attribute is "false" by default on apps targeting Android Q. -->
  <application android:requestLegacyExternalStorage="true" ... >
    ...
  </application>
</manifest>

Referral link : https://developer.android.com/preview/privacy/scoped-storage

like image 173
apurv thakkar Avatar answered Oct 03 '22 06:10

apurv thakkar