Enable debugging without relaunching app in Android Studio - android

This is, by far, the most missed feature for me.
When using eclipse, in the devices view I was able to enable debug for specific app without relaunching.
I can't find such a feature in Android Studio. Relaunching the app all over in the debug mode is real pain. Is there a way to enable it in the middle of the process like it is possible in eclipse?

There is an icon for that on the main toolbar which is called Attach debugger to Android process (highlighted in red in the image below):
The same option can also be found on the Run menu.
Once you click this, a list of processes from attached devices will be displayed. Simply choose the one you want to debug and you're set :)

Related

Android Emulator Scroll Down Doesn't Work in Home Page

I am new in Android Studio. I am using Android Emulator for call rest API for my backend. Before, i scroll down basicly in main android page. But after i wanted to tried scroll down, as if i right clicked, Home Setting, Widgets and Wallpaper pop-up show me. What is the solution about that. I never changed any setting.
Thanks for reply.
It looks like your emulator is frozen. It happens quite often.
I would suggest you to try these:
Restart your computer and try to run your app in the emulator. After it successfully runs, now try to clear the app cache.
If that didn't help, create another emulator. I recommend to choose different device and API level than the current emulator device but it is not necessary. This should solve your problem.
Tips
If you want to clear data, clear cache, uninstall app, clear cache and restart the app and so many such actions from android studio without touching your emulator then you can use ADB Idea plugin.
For that, in android studio go to Settings -> Plugins
search for ADB Idea in marketplace. Install it.
You need to restart android studio.
To use it:
You can press shift key in your keyboard twice and search for Adb in search window. You will get all the options from the plugin
From android studio menu... Tools -> ADB Idea and then you will see all the options available.

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

How to configure which project to debug?

I want to run two different Android apps from Eclipse (in two different types of Emulators) simultaneously but step through one of them, in which I've set breakpoints.
How do I configure which of the two apps is the one being debugged? It's not possible to debug both simultaneously, is it (with breakpoints in each project)?
If you take a look at this image, you can see that the "Devices" tab in the DDMS perspective has a "Bug" icon (the first one). If you highlight your running app (in whichever emulator it is) and click that button, debugging will become enabled for that app. If you have any breakpoints set in your code it will hit them and the debug view will open. That's the easiest way to debug a running application. I find this is the best approach because running the whole app in debug mode is slow. It's better to start debugging once you are close to where you actually want to step through.
You can also do this on an actual device, but you will need to set the debuggable="true" flag in the manifest, otherwise your app won't show in the list.

Android: How to stop emulation

I'm coming from Visual studio and C# and am new to Android (and eclipse) so quite ignorant of basic functionality.
I've written a short app and ran it under the emulator. No problems.
Now I've made some changes and want to test them. In VS I'd stop the application debug run before making code changes, and after the code changes run again.
I can't find the 'stop' debug button in eclipse. How do I run my app after I've made changes?
What you can do is press the [Escape] key on your keyboard or the 'Back' button within the Emulator to close your app then rebuild and run it in Eclipse, which should bring it up as active in the Emulator.
You can just run it again and the code changes will apply.
But else you'll find it under the Debug-window (Window->Show View->Debug) and there is a "terminate" button in the top right corner of your screen.
You might need to close the app inside the emulator though..
There is deference between just running the application and debugging, you can pres play in ellipse and that will run the app but what you can also do is to switch the perspective in debug view (to switch go to the right top corner, and change from java to debug perspective)
in debug mode you can also set break points, just like in visual studio the only difference here is you must change perspective

Categories

Resources