如何为应用程序添加清单权限? [英] How to add manifest permission to an application?

查看:131
本文介绍了如何为应用程序添加清单权限?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用Android中的 HttpURLConnection 访问HTTP链接来下载文件,但是我在 LogCat

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 错误描述,这是我的 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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆