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

自闭症网瘾萝莉.ら 提交于 2020-01-23 07:49:22

问题


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?


回答1:


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



来源:https://stackoverflow.com/questions/57657272/android-q-java-io-filenotfoundexception-proc-self-net-dev-open-failed-eacc

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!