我正在尝试在我的 android 活动中使用 jsoup (1.3.3) 解析一些 html。当我调用此代码时
Jsoup.connect("http://www.google.com").get();
它在 android 2.1 和 2.2 中运行良好,但在 1.6 中我得到一个“java.io.IOException: 403 Error loading URL”。
我正在使用模拟器对此进行测试,我注意到 admob 广告也没有在 1.6 中显示,但它们在 2.0、2.1 和 2.2 中有效。
在 1.6 模拟器中使用 Web 浏览器确实有效,所以我很确定问题出在我的代码中。
我在 1.6 中是否需要一些额外的权限才能访问互联网,而在 2.0+ 中不需要?
这就是我的清单文件的结构,uses-permission 标签的位置有什么影响吗?
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.foo.bar"
android:versionCode="1"
android:versionName="1.0"
android:installLocation="auto">
<application android:icon="@drawable/icon"
android:label="@string/app_name"
android:theme="@android:style/Theme.NoTitleBar"
android:name="blahblah"
android:description="@string/app_desc">
<activity android:label="@string/app_name" android:name=".activities.MainMenu">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".activities.FullList" android:label="@string/app_name"/>
<!-- The application's publisher ID assigned by AdMob -->
<meta-data android:value="blahblahblah" android:name="ADMOB_PUBLISHER_ID" />
</application>
<uses-sdk android:minSdkVersion="4"/>
<uses-permission android:name="android.permission.INTERNET"></uses-permission>
</manifest>
我已经尝试从头开始创建一个新项目,只使用一个使用 Jsoup.connect() 方法的 hello world 屏幕,并且在同一个 1.6 模拟器上运行良好,所以它一定是代码问题,但我无法弄清楚.