Android crashed on waiting for debugger screen - android

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

Related

Android Studio Not able to debug

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.

How to stop android studio from running

How to I stop my code from running in Android Studio? I have tried selecting the program under the Java folder, but the "Terminate Application" button is grayed out. It's really annoying how the long is going crazy even though I have ended the app on my phone...
Here is a screenshot of my screen if it helps:
If you are referring to the lines in the logcat that keep appearing even when you app is stopped, this is normal, your phone keeps running other apps and logging status messages.
To suppress this output try selecting you application in the drop down menu on the right to show only your app's output
From this answer:
You need to select the process com.mycompany.myfirstapp and then press the Terminate Application button.

Regarding improper functionality of emulator in android studio

i am new here, but i checked the site, it does not contain my question, hence not duplicate. Actually, in my android studio v 1.1.0, emulator does not launch default activity automatically when started in android studio. What i mean is that when i click the green (play) button to run my project, my emulator is launched. When it loads and is ready to be unlocked, after unlocking my default activity should run automatically but it does not. Just The Home screen is shown no matter how much i keep waiting. No error reported in LogCat, neither any exception or anything wrong with code. So to run, I have to right click on my activity and click run MainActivity from the available options. So, how do i make the emulator automatically launch my default 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

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