Android Studio Not able to debug - android

The log cat does not show anything.Clicking on the debug button does't do anything different.

What you are looking at is the Console, not LogCat. It is a separate tab in Android Studio.
Try pressing Alt+6 on Windows or CMD+6 on Mac.

look at the debug menu in the toolbar of android studio beside run , after selecting your breakpoint ,hit that button then open debugger console ,this should work.
did you select breakpoint ? if you just want to see the Log messages then you should see Andorid Monitor , if you want to debug then you have to select breakpoint

Open Android Monitor, and look for a tab named Logcat. This is where logs are printed. You can use stdout logs as well as stderr.

For open the LogCat :
on Windows or Linux : Alt+6
on MacOS : command+6

First you will have to set a breakpoint in your android studio. A breakpoint is a point in your code where you want the app to pause waiting your reaction like seeing variables value and the app in your device or virtual device will also pause as well. By default android studio should open the debugger tab when it finds a break point.
So this is how you set a break point:
Go your code may be in an Activity find a line of code you want to debug in your app (The one close to or the one which you think it brings the error).
In android studio there are line numbers column on the left just go there and just right of that particular number click once and the red dot will appear. Thats your breakpoint. Then just do the same for any other line you want to debug.
After that just click on the Button for debugging. In case you dont know it go to the tab Run and choose the Debug app. And now when you run your app will pause in your breakpoint and you will read all variables.

Related

logcat in android studio not showing

After updating Android Studio to version 2.2.3, sometimes(manytimes) it doesn't show logs
Also After re-running application, it doesn't show logs
I have tried restart button in logcat but doesn't show effects and have checked all criteria like No Filters, Verbose, selected emulator and application package.
Restarting Android Studio works
to be more clear , when i clear logs it doesn't show logs again and every time I have to restart Android Studio
can anyone post a solution to this ?
I know the question is old, but I think my answer can help someone in the future. If you have problems with showing of logcats of emulators, try the following:
Turn off the emulator
Rename emulator
Start it again.
It works for me.
Try this solutions,
1) Press Alt+6 twice to restart the logcat window.it will show the log outputs.
2) Restart logcat
Change the log level to Debug (or anything else) and back to Verbose.
unplugging and plugging back in the device
running adb kill-server && adb start-server
Close Android Studio and launch ddms on the command line.
Restart Android Studio
3) try pressing Alt + 6 to open Log tab.
Look at the log level:- it must be verbose.
Restart adb.
If that doesn't works restart the android studio.
4)
In Android 2.2, for some reason, Firebase was selected by default in the dropdown box marked above. So logs didn't drop. I just needed to change it to No Filters. Then it worked.
5) Go to Tools -> Android -> Android Device Monitor (DDMS)
Now you would see Devices tab at the right side, you would see a view menu icon, just click on it and Reset adb
Now you should be able to get the log messages displayed on the LogCat console.
i hope any of these much solution can help you!!!
Frist click on Tool+ Android+ Enable ADB Integration
2.after that click on Tool+ Android+ Android device monitor
3.wait for second..........
or
1.in android 3.0
2.in bottom 6: Logcat option
On the left hand side of the Logcat window, there is an icon named restart. Simply press that icon once would show the logcat messages again.
In some cases it may be a phone issue. you should try restarting your phone or emulator.
It always works for me

Is there is any way to see the code line running during the app

I want to see my code lines that are running during my app testing in the emulator and developing with android studio
io
Click on the Debugger button button shown in the image, to start the app on the device in debug mode
And be sure to have break points in reachable code. like shown in the image
To create a breakpoint just click the area where pointed by the red arrow mark in the above image. Its a simple process really
Use the debugger to step through the code. You can step over and step into functions, set breakpoints and so on.
See here

How to prevent Android Monitor from automatically opening when I run a project in Android Studio?

This Android Monitor window displays log activity from my phone, so I can see stack trace, etc. when my program crashes. Fortunately my program usually runs without crashing. :-) However this means the window is not useful to me most of the time.
How can I prevent Android Monitor from opening automatically on every time I Run Project?
For now, I've just resized it to be very small.
For Android Studio 1.4
go to Run -> Edit Configurations
expand Defaults and click on Android Application (or just for the current app, pick the top Android Application node)
switch to Miscellaneous tab
uncheck the Show logcat automatically option
You can open the window anytime by Alt/Opt+6.
As this answer says: https://stackoverflow.com/a/24459915/4409113
to get rid of the logcat opening on run, go to Run -> Edit
Configurations... on the main menu (or via the toolbar dropdown), then
uncheck the Show logcat automatically option in the Logcat tab.
Similar question: Disable Logcat (DDMS) & Run Console automatically opening on any activity

Debugging in Eclipse/Emulator not hitting breakpoints

I have configured a VD through Eclipse and it starts up fine. If I press F11 from one of my .java files in my application project, it starts up a new instance of the emulator and installs the app on it. However it does not open the app and if I manually open it and click on action buttons, it plainly is not linked up to the IDE for debugging as no break points get hit.
Other times when the emulator is open, F11 does the job of re-installing the app (after I manually uninstall it from the emulator), but again it does not attach as a debugger, just installs the app so I can run it.
Is there something basic I am doing wrong so that step-through debugging is not working?
Eclipse having option Skip All Breakpoints,
it might be possible you enable this option so you need to disable Skip All Breakpoints,
Option will appear when you will right click on project and trying to run it.
You can also do it by UI of eclipse , figure out this images. there are a option, if you toggle this button option it will behave disabe/ enable

Unable to debug android app in Eclipse

I have app in eclipse that was running well lately
Now it suddenly stops.
After I hit debug code runs and there is breakpoint in it.
From there on I am unable to debug and go step by step through the code because ther is no pointer showing me current line code at all.
Als o I noticed that all buttons in Run menu are grayed out (Terminate, REsume, Disconnect all of them)
So the only way to stop program running is to shut down eclipse
Any ideas ?
#Tobia
yes i saw the red button but unfortunatelly that did not helped. eclipse is such crap that can not be fixed with 1 red button. i had to downoad 32bit version and now it looks like it is working. 2nd issue now i have: THE ONLY way i ca nstart this crap app is to use -clean -clearPersistedState switches. ANYONE KNOWS IF THIS ECLIPSE CAN RUN NORMALY ?
just hit the red square on the top of the menu. Or also you can go to your device and stop your application, from settings->apps->yourapp->force stop or something like.

Categories

Resources