出于某种原因,在我的调试器中打开了一个新选项卡,标题为:Activity.class
标题说明:Class File Editor
和错误说明: The JAR file c:\sdk\platforms\android-17\android.jar has no source attachment
。您可以通过单击下面的附加源来附加源。
从那里我尝试从我的工作区添加它,但它仍然不起作用(它只是说现在更改附加源)
日志猫:
09-10 14:52:25.744: I/System.out(23760): Sending WAIT chunk
09-10 14:50:58.191: D/dalvikvm(23118): Late-enabling CheckJNI
09-10 14:50:58.291: E/Trace(23118): error opening trace file: No such file or directory (2)
09-10 14:50:58.311: I/System.out(23118): Sending WAIT chunk
09-10 14:50:58.311: W/ActivityThread(23118): Application com.example.test is waiting for the debugger on port 8100...
09-10 14:50:58.331: I/dalvikvm(23118): Debugger is active
09-10 14:50:58.511: I/System.out(23118): Debugger has connected
09-10 14:50:58.521: I/System.out(23118): waiting for debugger to settle...
09-10 14:50:58.721: I/System.out(23118): waiting for debugger to settle...
09-10 14:50:58.922: I/System.out(23118): waiting for debugger to settle...
09-10 14:50:59.122: I/System.out(23118): waiting for debugger to settle...
09-10 14:50:59.322: I/System.out(23118): waiting for debugger to settle...
09-10 14:50:59.522: I/System.out(23118): waiting for debugger to settle...
09-10 14:50:59.722: I/System.out(23118): waiting for debugger to settle...
09-10 14:50:59.923: I/System.out(23118): debugger has settled (1375)
09-10 14:51:01.244: D/dalvikvm(23118): threadid=1: still suspended after undo (sc=1 dc=1)
09-10 14:51:46.202: D/dalvikvm(23118): Debugger has detached; object registry had 188 entries
09-10 14:51:46.202: I/dalvikvm(23118): ignoring registerObject request in thread=1
09-10 14:51:46.202: I/dalvikvm(23118): ignoring registerObject request in thread=1
09-10 14:51:46.352: D/libEGL(23118): loaded /system/lib/egl/libEGL_adreno200.so
09-10 14:51:46.352: D/libEGL(23118): loaded /system/lib/egl/libGLESv1_CM_adreno200.so
09-10 14:51:46.352: D/libEGL(23118): loaded /system/lib/egl/libGLESv2_adreno200.so
09-10 14:51:46.352: I/Adreno200-EGL(23118): <qeglDrvAPI_eglInitialize:294>: EGL 1.4 QUALCOMM build: AU_LINUX_ANDROID_JB.04.01.01.00.036_msm8960_JB_CL2644550_release_AU (CL2644550)
09-10 14:51:46.352: I/Adreno200-EGL(23118): Build Date: 07/31/12 Tue
09-10 14:51:46.352: I/Adreno200-EGL(23118): Local Branch:
09-10 14:51:46.352: I/Adreno200-EGL(23118): Remote Branch: quic/master
09-10 14:51:46.352: I/Adreno200-EGL(23118): Local Patches: NONE
09-10 14:51:46.352: I/Adreno200-EGL(23118): Reconstruct Branch: AU_LINUX_ANDROID_JB.04.01.01.00.036 + NOTHING
09-10 14:51:46.382: D/OpenGLRenderer(23118): Enabling debug mode 0
09-10 14:52:25.704: E/Trace(23760): error opening trace file: No such file or directory (2)
09-10 14:52:25.724: W/ActivityThread(23760): Application com.example.test is waiting for the debugger on port 8100...
09-10 14:52:25.884: I/dalvikvm(23760): Debugger is active
09-10 14:52:25.944: I/System.out(23760): Debugger has connected
09-10 14:52:25.944: I/System.out(23760): waiting for debugger to settle...
09-10 14:52:26.145: I/System.out(23760): waiting for debugger to settle...
09-10 14:52:26.345: I/System.out(23760): waiting for debugger to settle...
09-10 14:52:26.545: I/System.out(23760): waiting for debugger to settle...
09-10 14:52:26.745: I/System.out(23760): waiting for debugger to settle...
09-10 14:52:26.945: I/System.out(23760): waiting for debugger to settle...
09-10 14:52:27.156: I/System.out(23760): waiting for debugger to settle...
09-10 14:52:27.356: I/System.out(23760): waiting for debugger to settle...
09-10 14:52:27.556: I/System.out(23760): waiting for debugger to settle...
09-10 14:52:27.756: I/System.out(23760): waiting for debugger to settle...
09-10 14:52:27.957: I/System.out(23760): waiting for debugger to settle...
09-10 14:52:28.157: I/System.out(23760): waiting for debugger to settle...
09-10 14:52:28.357: I/System.out(23760): debugger has settled (1495)
09-10 14:52:28.617: D/dalvikvm(23760): threadid=1: still suspended after undo (sc=1 dc=1)
09-10 15:14:09.756: E/Trace(27219): error opening trace file: No such file or directory (2)
09-10 15:14:09.766: I/System.out(27219): Sending WAIT chunk
09-10 15:14:09.766: W/ActivityThread(27219): Application com.example.test is waiting for the debugger on port 8100...
09-10 15:14:09.786: I/dalvikvm(27219): Debugger is active
09-10 15:14:09.966: I/System.out(27219): Debugger has connected
09-10 15:14:09.966: I/System.out(27219): waiting for debugger to settle...
09-10 15:14:10.176: I/System.out(27219): waiting for debugger to settle...
09-10 15:14:10.376: I/System.out(27219): waiting for debugger to settle...
09-10 15:14:10.577: I/System.out(27219): waiting for debugger to settle...
09-10 15:14:10.777: I/System.out(27219): waiting for debugger to settle...
09-10 15:14:10.977: I/System.out(27219): waiting for debugger to settle...
09-10 15:14:11.177: I/System.out(27219): waiting for debugger to settle...
09-10 15:14:11.377: I/System.out(27219): waiting for debugger to settle...
09-10 15:14:11.578: I/System.out(27219): waiting for debugger to settle...
09-10 15:14:11.778: I/System.out(27219): waiting for debugger to settle...
09-10 15:14:11.978: I/System.out(27219): debugger has settled (1496)
09-10 15:14:12.729: D/dalvikvm(27219): threadid=1: still suspended after undo (sc=1 dc=1)
来源:
package com.example.test;
import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.IOException;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import org.jsoup.select.Elements;
import org.apache.http.HttpResponse;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.DefaultHttpClient;
import com.example.test.R;
import android.app.Activity;
import android.os.AsyncTask;
import android.os.Bundle;
import android.view.View;
import android.widget.TextView;
public class MainActivity extends Activity {
private TextView textView;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
textView = (TextView) findViewById(R.id.TextView01);
}
private class DownloadWebPageTask extends AsyncTask<String, Void, String> {
@Override
protected String doInBackground(String... urls) {
String response = "";
for (String url : urls) {
DefaultHttpClient client = new DefaultHttpClient();
HttpGet httpGet = new HttpGet(url);
try {
Document doc;
// need http protocol
doc = Jsoup.connect("http://google.com").get();
// get page title
String title = doc.title();
System.out.println("title : " + title);
// get all links
Elements links = doc.select("a[href]");
for (Element link : links) {
// get the value from href attribute
System.out.println("\nlink : " + link.attr("href"));
System.out.println("text : " + link.text());
}
} catch (IOException e) {
e.printStackTrace();
}
}
return response;
}
@Override
protected void onPostExecute(String result) {
textView.setText(result);
}
}
public void onClick(View view) {
DownloadWebPageTask task = new DownloadWebPageTask();
task.execute(new String[] { "http://www.google.com" });
}
}