Activity.class - 类文件编辑器:JAR文件c:\ sdk \ platforms \ android-17 \ android.jar没有源附件

时间:2013-09-10 19:12:51

标签: java android eclipse jar

由于某些原因,在我的调试器中打开了一个标签为Activity.class的新标签页,其中 标题说明 Class File Editor < em>错误陈述 The JAR file c:\sdk\platforms\android-17\android.jar has no source attachment。您可以通过单击下面的附加源来附加源。

从那里我尝试从我的工作区添加它但是它仍然不起作用(它现在简单地说改变附加源)

logcat的:

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" });
    }
}

3 个答案:

答案 0 :(得分:1)

尝试以下

第1步:转到adroid-sdk安装文件夹。确保android-17

上有android-sdk/sources/文件夹

第2步:现在转到Class File Editor tab。在那里,您会看到一个标签为'Attach source code'的按钮。单击它并获取选择外部文件夹的选项。并浏览,直到你到达上面提到的android-17文件夹。选择它。它将附加源代码。

第3步:现在刷新项目。

第4步:现在再次按Activity

检查ctrl+click.的源代码

就是这样,现在您可以看到Activity的源代码。

<强>更新

参考attach android source

答案 1 :(得分:0)

我不确定附加正确Android源的最简单方法,但是eclipse尝试打开Activity.class的原因可能是发生了一些异常。

看看logcat。您应该能够在那里看到堆栈跟踪并找到原因,甚至不需要Android源代码。

答案 2 :(得分:0)

这种情况正在发生,因为您已到达方法onCreate的末尾。然后,控制权返回到调用Activity方法的onCreate类。如果您稍后在应用程序中尝试调试某些内容,则应在代码中稍后设置断点。但是,一旦到达onCreate方法的末尾,就没有什么可以调试了。如果你想调试实际的Android Activity类,你需要下载源代码并告诉eclipse在哪里找到它,虽然我怀疑这不是你想要做的。