Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"Source not found" when debugging android app using Eclipse

Code is as follows, and i set a breakpoint on certain line(i have marked it in the code below, in fact, Eclipse always tells me "source no found", wherever i set the breakpoint):

package com.app.MainActivity;

import java.io.IOException;

import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException;

import android.app.Activity;
import android.content.res.XmlResourceParser;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.TextView;

public class Chapter03_ResourceActivity extends Activity {
    /** Called when the activity is first created. */

    private Button myButton;
    final private TextView myTextView = (TextView)findViewById(R.id.text_xml);

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);

        myButton = (Button)findViewById(R.id.btn_xml);

        myButton.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View v) {
            StringBuilder sb = new StringBuilder();                   <==Here breakpoint
            XmlResourceParser xrp = getResources().getXml(R.xml.test);
            int counter = 0;
            try {
                while(xrp.getEventType() != XmlPullParser.END_DOCUMENT) {
                    if(xrp.getEventType() == XmlPullParser.START_TAG) {
                        String name = xrp.getName();
                        if(name.equals("customer")) {
                            counter ++;
                            sb.append(counter + " Customer" + "\n");
                            sb.append(xrp.getAttributeValue(0) + "\n");
                            sb.append(xrp.getAttributeValue(1) + "\n");
                            sb.append(xrp.getAttributeValue(2) + "\n\n");
                        } 
                        xrp.next();
                    }
                } 
            myTextView.setText(sb.toString());
            } catch(IOException e) {
                e.printStackTrace();
            } catch(XmlPullParserException e) {
                e.printStackTrace();
            } 
            }
        });
    }
}

Run--Debug, and then i got a prompt: Source not found. why? cannot Eclipse stop on the breakpoint in the code i supply? why does eclipse need more source code?

like image 924
Searene Avatar asked Dec 09 '22 03:12

Searene


1 Answers

Does this help?

  1. Start debugging, and run until you hit a breakpoint

  2. Right click in the Debug view of the Debug perspective (for example on the call stack), and choose "Edit Source Lookup Path"

  3. Add all your projects above "Default", via "Add..." > "Java project" > "Select All"

like image 156
Kuffs Avatar answered Dec 21 '22 09:12

Kuffs