I am trying to run my app in debug mode on an Android device from Android Studio. I press the Debug 'app' button and it goes through the build process and then it says "Launch succeeded" in a bubble above the Debug tab, but the app doesn't start running. If I press the Debug button again though it does start and it says "App restart successful without requiring a re-install" in a bubble above the Run tab. Why won't it start the first time? I have "Launch" set to "Default Activity" under the Launch Options. Is there anything else I need to do? Thanks!
Related
When we remove an app from foreground logcat gets full of other stuff.
If you have an app running on your device and you want to attach a debugger to its process then you can hit the "Attach Debugger" button as shown in the image below:
Then select the process you want to debug. You can only do this with your own apps of course.
Android studio changed something and now ALWAYS that i run my app it get stuck in a screen "waiting for debbuger"
then i need to go at "chooser process" and attach the debuger to my app. BUT IT IS VERY ANNOYING mainly because i dont want to debug i just pressed RUN
how can i fix it and stop this bad error at least when i'm not debuging
There is an option of Attach Debugger to Android Process
Looks like you have added your app in Select app to be debugged in Settings -> Developer Options -> Select app to be debugged
To resolve this, simply go to Select app to be debugged and click on No apps
As I wanted to debug my app, I clicked the Debug button. After this, if I was trying to run the app manually, a message appeared saying "Waiting for debugger to attach...". I turned off and turned on the "Debuggable app" option in the Developer settings and rebooted my phone and this dialog disappeared.
But now when I'm trying to click the Run button in Android Studio, the app doesn't run, but lines of log are running at the ADB window (Android monitor). Feels like it's running in the background.
The only way to launch my app and track it is to click the Debug button, set the Breakpoint, run the app manually, click the Debug button again. But I don't want to Debug!
P.S. Sorry for that bad English.
Stop the debugging process and rebuild your project. It works for me. Try it.
I'm trying save compiling time only for debug first app lines code.
There is solution to exit by backPress() and the process still running (and then i can attach debugger to process), but my debug scenario need to check app from start so i need to kill process before debug, which prevent me to attach debugger unless otherwise i'm compiling the app in debug mode.
Does any one know how to prevent compile in debug only for that?
go to settings -> Developer options -> Select app to be debugged -> choose your app
turn on 'Wait for debugger'
then when you launch the app you see this screen:
Now app wait for you to attach debugger and auto start when it's attached
It is actually start the app-process without start launcher activity
My app is no longer starting up automatically when I F11 it in Eclipse; the Emulator starts up, but I then have to go and find my app among the applications list/array to invoke it.
Then, when I get to the place in my app where I've set a breakpoint, instead of hitting the breakpoint (Eclipse is not even going into Debug Perspective), my app suddenly "expires" and the Emulator pops up the dialog:
~~~~~~~~~~~~~~~~~~~~~~~~~
Sorry!
The application FifeOrTheDinosaur (process.com.aXX3AndSpace.FifeOrTheDinosaur_Package) has stopped unexpectedly. Please try again.
Force close
~~~~~~~~~~~~~~~~~~~~~~~~~
But then when I click "Force Close," that dialog goes away, and my app starts up again, from its opening Activity...?!?
It's almost as if my app is not the one being debugged by Eclipse -- Eclipse has lost its connection to it or...???
And every time it crashed, I hit the "Force Close" button, whereupon my app starts up all over again. What could have disconnected my app from the Debugging system, so that it:
1) Doesn't run automatically when I run it; rather, I have to "force" it to start up, and when it enters a breakpoint, Eclipse's Debug Perspective is not invoked
2) Continually starts up my app after it has failed...???
I put a breakpoint on a button click handler prior to that one that is working fine, and it does not drop me into the Eclipse debugger, either...???
Update:
The console says:
1) ] Failed to install .apk on device 'emulator-5554': timeout
2) Launch canceled!
Updated 3/30/2012:
If I run the app from Eclipse and immediately shut it down just as the Emulator is starting to initialize, it flashes up three "command window"-type screens, one right after the other, too fast to read what text they contain. Normally the Emulator window simply goes away, so I don't know if this is a clue for anybody as to what might be happening...
That sounds like the normal behavior of android Apps. If one activity crashes you can still go back to the activity the App started with. And if the breakpoints aren't hit then the error might occure before the code line you want to stop at.
Maybe you could set a breakpoint before you change the activity and then debug from there on.
You could also provide your Log output. Errors like that can always happen if you forgot to declare permissions or activities in your Android Manifest.