“Waiting for Debugger” without be on debug mode - android

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

Related

Do you want to terminate the process 'app' - Android Studio

Today, I update my Android Studio(4.1.1)
When I changes in my code and click on "Run App" then dialog shows Do you want to terminate the process 'app' and there are 3 options Terminate, Disconnect, Cancel.
Can you tell me what are difference in these because if click anyone then app restart.
Which option is best?
There is best option. What you have to select depends on what you want to achieve.
This dialog only makes sense if you have already started the app before. If you now run again the app Android Studio want's to know what to do with the existing running app as an there can be only one running instance of an app at a time.
Terminate
This will directly exit the app without saving and data or anything else.
The app process will just be terminated.
Disconnect
Close the connection between the debugger in Android Studio and the app as the debuggee.
Afterwards the app will continue to run just without attached debugger.
Cancel
Do nothing and just close the dialog
Command , (Setting or Preference)
Version Controll > Confirmation > "when files are created"
add or delete option check!!
I was having the same problem. Here is the simple solution that worked for me. Check Remember, don't ask again then press Disconnects. Lastly close your emulator and run the app again.

Starting an app in debug mode from another app

I am launching App B from App A with intent. I want to see debug mode logs in App B. If I launch App B directly I can do it. But if I have to launch it from App A, I cannot use debug. Is there a workaround for this.
To see logs:
Make sure you have Logcat opened and go to combo to switch between your debug apps are running currently to see each app's logs.
To enable debug mode:
You need to have both projects opened together and once you have launched App-B from App-A as you are doing, when App-B will be opened, you can attach debug mode from "Attach Debugger to Android Process" button on its own "Android Project B":
Tested on Android Studio 3.4
If it is not this, maybe we need more details...
There are two ways to do this. The official way is to set your breakpoint and then use this in your onCreate method:
Debug.waitForDebugger();
This pauses the app until a debugger is attached, at which point it will hit your breakpoint.
Alternatively you can put a sleep timer in your onCreate method, (e.g. TimeUnit.SECONDS.sleep(30)), which pauses your app long enough for you to attach a debugger.

App is running on Android Monitor but not on android

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.

Attach Eclipse debugger to restarted application

I am testing the onsave/onrestore mthods of my android application.
To do this I phone my device and see that it kills the process and then I hang up. :)
I see that it restarts the application.
Question is: how do I cause it to restart in debug mode so I can step through the restore process?
Is there a way to tell it to automatically attach to the debugger when starting up?
Use android.os.Debug.waitForDebugger();
Basically, start via debugging. Exit out of your app. Set some break points. Enter back into your app (make sure that this line is hit, so put it in your onCreate or somewhere else) and it will re-attach to the running debugger.
I don't think there is a way to ensure the app restarts in debug mode. But if you are debugging your own app and don't mind adding debug code for testing you might want to add a Thread.sleep(5000) or something like this at an appropriate place in your startup methods. This should give you enough time to reconnect the debugger via the DDMS. Remove when you are done, of course ;)
There is a configuration option in Android settings > developer options > debugging > select app to be debugged. What it does is calling the eclipse debugger every time certain application is opened, if it's connected to the adb and the app's project is open.
Programmatically: Use waitForDebugger(). Documentation here.
Note that the method returns as soon as the debugger attaches, so it's best practice to place a breakpoint right after that call. Additionally, you can test the debugger attachment status using isDebuggerConnected().
In Eclipse: Open the DDMS perspective of eclipse, select the freshly-restarted app on your device, and then select the debug option. This will attach the debugger to the restarted instance.
On the Device: There is a configuration option under some* handsets that allows you to select an app to be debugged when USB debugging is configured. It's under the Developer Options in your device settings. This will attach the debugger automatically.
*For example, my Galaxy S4 has it, my HTC Rezound does not. I believe it might be a Jelly Bean specific option.

Why has the Eclipse Debugger/Emulator disconnected from my app?

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.

Categories

Resources