Debugging in Eclipse/Emulator not hitting breakpoints - android

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

Related

Change default Android emulator when debugging Xamarin.Forms app?

I installed VS2017 a few days ago, created the simple app Build your first Xamarin Forms App, and now I want to debug.
I am having issues with the default Android emulator created by the VS2017 installation (Android_Accelerated_x86_Oreo) so I created a new emulator. This is the screenshot.
How can I change the default so it debugs in the newly-created emulator?
I wanted to point out that I'm new to all of this, so I would like to run it without having to install anything else. I would like to see something run before I install anything else.
I also wanted to point out that I've tried clicking on "Start" on either one of them when not in debug mode, and I get Could not start emulator. Unable to load DLL 'DismApi' error.
The only way it automatically starts is if I hit F5 and the emulator window pops up. Then I go to Tools > Android Device Manager and the default emulator says "Stop" (it's running). If I click on "Stop" and then press "Start", I will get the same error again: Could not start emulator. Unable to load DLL 'DismApi'.
Where you launch the debugger just click the arrow pointing down to open the dropdown. Then select you new device. It will stay as you default device. Please see the image for reference:
Note: You may have to restart Visual Studio for your new device to appear.

Android crashed on waiting for debugger screen

IntelliJ is my android development IDE.
And it help me to generate the apk.
One situation is:
The apk runs well when I debug with real phone.
But if I use run model ,it does not work.
Another situation is that:
The apk runs well the first time ,but if I press the home key long time and kill the app.
Then I go to the app icons board to click my app icon, it will stay on the screen "Waiting for debugger".
The "Waiting for debugger" message is because you have built the app for immediate debug. You pressed the debug button right? The app expects to be able to connect to the debugger immediately on launch. This is really useful if you want to debug something that happens immediately on launch.
If you don't need to debug immediately you can hit the "Play"/"Run" button in Android Studio. The app will still be built in debug mode so you can still start debugging later by pressing the "Attach Debugger" button. Pressing the debug button is like pressing the play button and immediately pressing the "Attach debugger" button.
If you want to test the app in Release mode, you can select "Build Variants" and choose release, you don't normally need this.
Here's an image showing the build variants menu and the run, debug and attach to debugger buttons:
But if I use run model ,it does not work.
I presume you mean with the emulator. The emulator can be tricky to get working, so I'll need more information about what isn't working to help

AVD Manager window blocks Eclipse window on Mac

I'm a complete newbie trying to learn how to write an app. I'm trying to run Hello World using the emulator in Eclipse on my Mac. I launch and unlock the emulator. Android Training then implies that I should click the Run icon in Eclipse. But the ADT Manager window is in front of the Eclipse window and Eclipse is disabled. If I minimize the ADT Manager window it just quits the ADT Manager, and then I must close the emulator window.
I did discover that I can run the app with the Run button without starting the emulator as a separate step, although that takes a long time to get going.
Another Answer implies that I can just rerun the app by clicking the run button again, but I can't do this because the Eclipse window is disabled.
I'm used to being able to use the IDE while a program (Yes, I'm an old programmer) is running. What am I missing?
Duncan
You're right - simply hitting run on the application cold turkey takes forever because the emulator has to initialize. When you click on your AVD Manager (where you can create, edit, and customize the android emulator you'd like to use), Select the emulator you'd like, then click Start.
After waiting for the emulator window to popup, just wait until the UI loads (when you can unlock the emulator).
At this point, it appears that the AVD Manager is still necessary (due to the "loading" type green bar along the bottom seemingly feeding the emulator), but you can just close the window, and the Eclipse window will become clickable again.
Now, you can just leave the emulator running. I typically leave it running for hours at a time (even overnight) and I can usually just click Run as Android Application and everything works perfectly.

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