Android:HTTPClient

Android:HTTPClient,第1张

概述我正在从svn.apache.org尝试http-cleint教程.在运行应用程序时,我在控制台中收到以下错误. [2010-04-30 09:26:36 - HalloAndroid] ActivityManager: java.lang.SecurityException: Permission Denial: starting Intent { act=android.intent.acti 我正在从svn.apache.org尝试http-cleint教程.在运行应用程序时,我在控制台中收到以下错误.
[2010-04-30 09:26:36 - HalloAndroID] ActivityManager: java.lang.SecurityException: Permission Denial: starting Intent { act=androID.intent.action.MAIN cat=[androID.intent.category.LAUNCHER] flg=0x10000000 cmp=com.org.example/.HalloAndroID } from null (pID=-1,uID=-1) requires androID.permission.INTERNET

我在AndroIDManifest.xml中添加了androID.permission.INTERNET.

<?xml version="1.0" enCoding="utf-8"?><manifest xmlns:androID="http://schemas.androID.com/apk/res/androID"      package="com.org.example"      androID:versionCode="1"      androID:versionname="1.0">    <application androID:icon="@drawable/icon" androID:label="@string/app_name">        <activity androID:name=".HalloAndroID"                  androID:label="@string/app_name" androID:permission="androID.permission.INTERNET">            <intent-filter>                <action androID:name="androID.intent.action.MAIN" />                <category androID:name="androID.intent.category.LAUNCHER" />            </intent-filter>        </activity>    </application><uses-permission androID:name="androID.permission.INTERNET"></uses-permission></manifest>

HalloAndroID.java中的java代码如下

httpClIEnt httpclIEnt = new DefaulthttpClIEnt();    httpGet httpget2 = new httpGet("http://Google.com/");        httpResponse response2 = null;        try {            response2 = httpclIEnt.execute(httpget2);        } catch (ClIEntProtocolException e1) {            // Todo auto-generated catch block            e1.printstacktrace();        } catch (IOException e1) {            // Todo auto-generated catch block            e1.printstacktrace();        }    httpentity entity = response2.getEntity();    if (entity != null) {        long len = entity.getContentLength();        if (len != -1 && len < 2048) {            try {                    Log.d(TAG,EntityUtils.toString(entity));                } catch (ParseException e) {                    // Todo auto-generated catch block                    e.printstacktrace();                } catch (IOException e) {                    // Todo auto-generated catch block                    e.printstacktrace();                }        } else {            // Stream content out        }

任何帮助深表感谢.

解决方法 问题解决了. AndroIDManifest.xml文件中的这一行导致了麻烦.
androID:permission="androID.permission.INTERNET"
总结

以上是内存溢出为你收集整理的Android:HTTPClient全部内容,希望文章能够帮你解决Android:HTTPClient所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/web/1134052.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2022-05-30
下一篇2022-05-30

发表评论

登录后才能评论

评论列表(0条)

    保存