我目前使用JSoup作爲外部JAR和下面的代碼片段拋出模擬器運行時異常,並最終應用程序崩潰:JSoup Android中的活動拋出異常
Document doc = Jsoup.connect(「http://www.cnn.com」).get();
06-18 14:00:17.272: I/dalvikvm(424): Could not find method org.jsoup.Jsoup.connect, referenced from method com.pamir.ODeskActivity.getList
06-18 14:00:17.272: W/dalvikvm(424): VFY: unable to resolve static method 25: Lorg/jsoup/Jsoup;.connect (Ljava/lang/String;)Lorg/jsoup/Connection;
06-18 14:00:17.282: D/dalvikvm(424): VFY: replacing opcode 0×71 at 0×0007
06-18 14:00:17.892: D/AndroidRuntime(424): Shutting down VM
06-18 14:00:17.905: W/dalvikvm(424): threadid=1: thread exiting with uncaught exception (group=0×40014760)
06-18 14:00:17.912: E/AndroidRuntime(424): FATAL EXCEPTION: main
06-18 14:00:17.912: E/AndroidRuntime(424): java.lang.NoClassDefFoundError: org.jsoup.Jsoup
06-18 14:00:17.912: E/AndroidRuntime(424): at com.pamir.ODeskActivity.getList(ODeskActivity.java:24)
這裏是清單:
<application
android:icon="@drawable/ic_launcher"
android:label="@string/app_name" >
<activity
android:name=".ODeskActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
我在做什麼錯了?任何幫助表示讚賞。
當然你要INTERNET權限也。 – Neil