问题描述
我要打开文件"/proc/self/net/dev"与FileReader.在Android 10中,出现了java.io.FileNotFoundException:/proc/self/net/dev:打开失败:EACCES(权限被拒绝)在旧版本中,打开该文件没有问题.我该怎么办?
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?
推荐答案
根据Android开发者文档,他们对Android Q作用域存储进行了更改.如果您的应用针对的是Android Q,则应在清单文件中定义android:requestLegacyExternalStorage ="true"
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>
引荐链接: https://developer.android.com/preview/privacy/scoped -存储
这篇关于Android Q:java.io.FileNotFoundException:/proc/self/net/dev:打开失败:EACCES(权限被拒绝)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!