Problem while Debugging the code

General topics about the Android-Platform itself.
Coding issues please to the subforum right below.

Problem while Debugging the code

Postby Sagar Ganeshe » Mon Dec 31, 2007 10:29 am

Hi All, :D

I am facing a problem while debugging.
I am using 'F6' for moving through the code.
But some times I am going to some other file like "Intrumentation.class" and there I could see "Source not found".

After that I am able to proceed with the debugging, even after attaching the code also.

Please help , if you know how resolve this problem..

Regardss..
New Year Wishes to All.. :P
Sagar Ganeshe
Freshman
Freshman
 
Posts: 9
Joined: Mon Dec 10, 2007 6:43 am

Top

You have the source code for android?

Postby faldureon » Thu Jan 03, 2008 3:53 am

Could you post the files here, because I am having a lot of difficulty locating them myself.... :D
faldureon
Developer
Developer
 
Posts: 27
Joined: Sun Dec 02, 2007 10:19 pm

Postby Sagar Ganeshe » Thu Jan 03, 2008 5:44 am

Hi,
This is the code snippet, in which I was doing debugging,
I have put the breakpoint at the first line of the class "LiveTalkClient" (i.e. private final String ipAddress = "127.0.0.1"; // ip of server pc. )
The break point will be hit properly, but after that when I start using F6, it is going to some file like Instrumentation.class , ActivityThread.class.

Actually it is going to a Class File Editor
Please see the attached snapshot for details.




Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. package com.lnt.livetalkclient;
  2.  
  3. import java.io.BufferedReader;
  4.  
  5. import java.io.IOException;
  6.  
  7. import java.io.PrintWriter;
  8.  
  9. import java.net.Socket;
  10.  
  11. import java.net.UnknownHostException;
  12.  
  13.  
  14.  
  15. import android.app.Activity;
  16.  
  17. import android.os.Bundle;
  18.  
  19. import android.view.View;
  20.  
  21. import android.view.View.OnClickListener;
  22.  
  23. import android.widget.Button;
  24.  
  25. import android.widget.EditText;
  26.  
  27.  
  28.  
  29. import android.app.Activity;
  30.  
  31. import android.os.Bundle;
  32.  
  33.  
  34.  
  35. public class LiveTalkClient extends Activity implements OnClickListener{
  36.  
  37.        
  38.  
  39.          private final String ipAddress = "127.0.0.1";  // ip of server pc.
  40.  
  41.      private final int port = 6666;
  42.  
  43.      EditText mLocation;
  44.  
  45.      Button mConnect;
  46.  
  47.      Socket kkSocket;    
  48.  
  49.  
  50.  
  51.     /** Called when the activity is first created. */
  52.  
  53.     @Override
  54.  
  55.     public void onCreate(Bundle icicle) {
  56.  
  57.         super.onCreate(icicle);
  58.  
  59.         setContentView(R.layout.main);    
  60.  
  61.         mConnect = (Button) findViewById(R.id.connect_button);
  62.  
  63.         mConnect.setOnClickListener(this);
  64.  
  65.        
  66.  
  67.  
  68.  
  69.     }    
  70.  
  71.    
  72.  
  73.     public void onClick(View view) {
  74.  
  75.        
  76.  
  77.         try {
  78.  
  79.             kkSocket = new Socket(ipAddress, port);
  80.  
  81.             Connection clientConnect = new Connection(kkSocket);
  82.  
  83.             errorMessage("Socket created successfully with Server IP:" + ipAddress);
  84.  
  85.        } catch (UnknownHostException e) {
  86.  
  87.             errorMessage("Unknown host" + ipAddress);
  88.  
  89.        } catch (IOException e) {
  90.  
  91.             errorMessage("Couldn't get I/O for the connection to: " + ipAddress);
  92.  
  93.        }        
  94.  
  95.        
  96.  
  97.    }
  98.  
  99.    
  100.  
  101.     private void errorMessage(String msg) {
  102.  
  103.         this.showAlert("Error!", msg, "OK", true);
  104.  
  105.         System.err.println("Error:" + msg);
  106.  
  107.    }
  108.  
  109.  
  110.  
  111.  
  112.  
  113. }
Parsed in 0.039 seconds, using GeSHi 1.0.8.4
[img]E:\ANDROID\Debugging[/img]
Attachments
Debugging.JPG
Debugging.JPG (161.38 KiB) Viewed 995 times
Sagar Ganeshe
Freshman
Freshman
 
Posts: 9
Joined: Mon Dec 10, 2007 6:43 am

Postby faldureon » Thu Jan 03, 2008 6:46 am

In the attached image I've circled the 4 debug step options in red. The first one attempts to step into code, if the code is not there(and only .class file are available) then what you experience happens. The second one steps over code, that is what you want to use for a chunk of code you have no source for. The third icon is used for jumping out from the current function into the caller. I don't believe that the source code for android is available, we are lucky they added as much javadoc as they did
faldureon
Developer
Developer
 
Posts: 27
Joined: Sun Dec 02, 2007 10:19 pm

Top

Return to General

Who is online

Users browsing this forum: No registered users and 5 guests