i am using eclipse 3.6 for my android app and I dont know how to debug and insert a break point in eclipse so can you please give me any link or guide me. I tried a lot to search on google but none of them were easy to understand.
i also tried this link:
https://www.ibm.com/developerworks/library/os-ecbug/
but that was also not helpful.
This shouldn't be difficult. You insert a breakpoint by right-clicking at the gray line at the left of your code and then selecting "Toggle breakpoint". A circle should appear.
In order for the breakpoint to be active, start your application in debug mode. You do that by clicking at the "bug" icon ("Debug as..").
Related
so I'm trying out Android Studio for the first time, and I've already run into something. I'm following the official "first application" tutorial on developer.android.com, but it's not matching up. So, I tested this with two apps, and it wasn't like a bug in the first one exclusively, it happened in both. Here's a pic of an app where nothing has been changed and I followed the tutorial exactly:
As you can see in the hierarchy, it is supposed to have the Hello World text that displays when you make a new app. However, with me not changing anything, it's not showing up.
Any ideas?
Also to clarify, the items do show up when I run it on my device, it just doesn't show up on the computer.
Check the upper right corner of the Preview screen, you should see a red warning mark. Click on that and it will tell what is preventing Android Studio from rendering your layout.
Some times android studio stuck or something.Try doing
File->Invalidate Caches/Restart
The best solution is
Clean Project
Rebuild Project
In your style.xml file change the string parent with the below line:
parent="Base.Theme.AppCompat.Light.DarkActionBar"
I am working on Ubuntu 14.04, AndroidStudio is 1.2.1.1. I am able to build the app, click on the "Debug" icon and launch the app. I can see logcat output and I can pause the app from the debugger. The one thing I cannot do is set a break point. I tried clearing the cache, restarting AS, right clicking in the file where I want to set the break point. None of these produce the desired effect. This is a well-hidden feature.
I also had this same issue in Android Studio, where I couldn't set breakpoints. This is what I was doing wrong: I was clicking on a line that didn't have any code in it, or a line that contained a comment. As soon as I clicked on a line in method/class, it allowed me to set the breakpoint.
There shouldn't be any problems setting break points if you follow the process outlined here
If you are running into some issues, here are a few steps to get you started:
- Use a Log.d() in your app and see if it outputs to the logs. If it doesn't then you know you are not in debug mode.
- Are you debugging on the device or the emulator? If the device, you need to enable development. I would suggest to select "wait for debugger" to make sure it's attached before you run the code.
This should be pretty straightforward. Let me know what you find out.
To add a line breakpoint, proceed as follows:
Locate the line of code where you want to pause execution, then either click the left gutter along that line of code or place the caret on the line and press Control+F8 (on Mac, Command+F8).
If your app is already running, you don't need to update it to add the breakpoint—just click Attach debugger to Android proccess . Otherwise, start debugging by clicking Debug .
I have found my app returned error after a for loop.
Are there any tricks for me to just run through the for-loop and then debug?
I have studied some posts saying that using Ctrl+R could help.
However my latest version eclipse cannot found such a function.
You can do Step debugging in Eclipse
mark a break point in the code where you want ( mark at the blue line as shown with a small blue circle)
then run->Debug Configuration and start the app
and when the program starts it will stop at that line where you put break point.
just dont forget to change from JAva or DDMS to Debug
also you can see various stepping code things in run menu while debugging
I hope it helps you
1.use Log.i() or System.out.println() to print something.
2.just see debug information in logcat
3.reduce loop times or replace loop with other simple code, then run the app again
I'm working on my first Android app and to be honest I'm not sure about most of what I'm doing. Right now I'm stuck on a NullPointerException that is created by a line that refers to another class that, in turn, refers to another class.
How can I locate the error?
The word you are looking for is debug. If you are using eclipse, it's very easy to debug your program in most cases. Two main options in eclipse are to use the logger for debug prints to logcat, or debug the program step by step to detect relevant errors. Here is a tutorial for both options and here is a nice video tutorial in YouTube regarding debug in eclipse.
You can use the Eclipse debugger to help with that. Set a break point above the line that errors out and deploy your app using the Eclipse debugger (with the little bug icon) rather than the standard deployer (the play button). You'll be able to see what is going on right before the line with the error occurs and hopefully fix things up.
If that doesn't work, you can post the stack trace and your method that has the error and we can take a look at it.
i have some problem when i want to Debug my android code. When i go to Debug as/ it says (none applicable). I have set a breakpoint though there's no blue arrow on it. Anyone who knows why this is happening?
Thanks
You should setup your debug configuration. It should know what avd to use to launch your code on. If you're using eclipse this article should help.