如何为应用程序添加清单权限? [英] How to add manifest permission to an application?
问题描述
我正在尝试使用Android中的 HttpURLConnection
访问HTTP链接来下载文件,但是我在 LogCat $ c中收到此警告$ c>:
I am trying to access HTTP link using HttpURLConnection
in Android to download a file, but I am getting this warning in LogCat
:
WARN / System.err(223):java.net.SocketException:权限被拒绝(可能缺少INTERNET权限)
WARN/System.err(223): java.net.SocketException: Permission denied (maybe missing INTERNET permission)
我已经在我的应用程序中添加了 android.Manifest.permission
,但它仍在
I have added android.Manifest.permission
to my application but it's still giving the same exception.
推荐答案
假定您没有从 LogCat $ c $设置的权限c>错误描述,这是我的
AndroidManifest.xml
文件的内容,该文件可以访问互联网:
Assuming you do not have permissions set from your LogCat
error description, here is my contents for my AndroidManifest.xml
file that has access to the internet:
<manifest xlmns:android...>
...
<uses-permission android:name="android.permission.INTERNET" />
<application ...
</manifest>
除此之外,您可以从互联网上下载文件。
Other than that, you should be fine to download a file from the internet.
这篇关于如何为应用程序添加清单权限?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!