android studio open failed: EACCES (Permission denied)(第一行代码第十章下载测试总是失败)

在学习android 下载的部分时,由于当前使用的android版本较高,总是出现访问权限问题---文件打开失败。通过科学地上网终于找到解决办法》》

Add android:requestLegacyExternalStorage="true" to the Android Manifest It's worked with Android 10 (Q) at SDK 29+ 

or After migrating Android X.

在AndroidMainfest.xml中添加android:requestLegacyExternalStorage="true"

 1 <application
 2     android:name=".MyApplication"
 3     android:allowBackup="true"
 4     android:hardwareAccelerated="true"
 5     android:icon=""
 6     android:label=""
 7     android:largeHeap="true"
 8     android:supportsRtl=""
 9     android:theme=""
10     android:requestLegacyExternalStorage="true">

 

猜你喜欢

转载自www.cnblogs.com/shi-win-snoopy/p/12237034.html