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

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.

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.

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.

How to gracefully terminate an app on Android emulator with Eclipse (on Mac)

I am trying to end my app gracefully on an Android emulator without causing a crash or killing the app.
Having read numerous posts on how to terminate or crash an app on Android, here's what I've tried:
Switched the emulator to another app
Clicked the Hang up on call button and Make a call button on the emulator
Added finish(); System.exit(0); to my onPause event in the app
Clicked on the root of my program in the Debug perspective in Eclipse and clicked the red square on the menu icon row to terminate, did same and disconnected as well.
Each time I start up the app after any of the above, the tracking code is considering the above chosen method a crash.
So I'm trying to figure out how to gracefully end my app and restart it without incurring a 'crash'.
Any ideas?
Big thanks

Prevent "Scheduling restart of crashed service" for widget when debugger on breakpoint

I've set up Eclipse (3.7.2) with the Android Development Toolkits (16.0.1), including Dalvik Debug Monitor Service (16.0.1), as directed in different more or less official tutorials.
If I write a "standard" Android application, with a launcher Activity, then I can set breakpoints in my code, run it on a Virtual Android Device, and the break points break as expected, and I can spend my whole night debugging code if I want.
The problem comes when instead of a "standard" Android application, I start playing around with an Android home screen widget, which does not have a launcher Activity. If I want to debug my code, I still can set breakpoints easily. Let's say I put a breakpoint straight in the onUpdate of my implementation of my AppWidgetProvider, and I test it by adding an instance of my widget to the AVD. The breakpoint doesn't break. I figure, this is because in the Debug Configurations, the launch action for my widget is "do nothing", as there is no Activity I can select.
Googling around, I found that when my AVD was running, I could go to the DDMS view in Eclipse, and in its Devices tab, I could select my widget process, and click on a cute green bug "debug selected process". If after that, I create an instance of my widget in the AVD, then the execution does break on my breakpoint.
But here comes my next problem: when this happens, I have about a few seconds in the debugger, before Android decides that my widget process has hung (which is true), and should be shot (which is not true)! Therefore my question is: how to prevent the system from shooting my process stopped at a breakpoint?
Note: In the log I get that sort of notification:
06-11 17:02:19.900: W/ActivityManager(59): Scheduling restart of crashed service [...]
Start a service that doesn't run on the main thread (such as IntentServcie) from your widget receiver (onUpdate()). Do all your work there.

Eclipse android error

Everytime I start the emulator from eclipse, I get the following error in my console.
[2010-09-13 17:04:51 - DeviceMonitor]Sending jdwp tracking request failed!
[2010-09-13 17:18:49 - DeviceMonitor]Sending jdwp tracking request failed!
The application works fine, but I am concerned as to why I see this error. Please help
I believe this is coming from the Usage Stats option. I just installed ADT, did a test run and got this error, as well. I went to Window >> Preferences >> Android >> Usage Stats then checked it on. Tried another test and voila! No error!
Kind of annoying, I can imagine...
This is caused after the emulator is closed while eclipse is still running.
When you first run the emulator after starting eclipse, a connection is established between it and eclipse. This connection is used to send messages back and forth between the two programs, and so eclipse can track the progress of the emulator.
When the emulator is closed, the connection is lost, and any attempt by eclipse to send a message results in the error messages you describe.
As Koby said this message comes if you close the emulator after running an application. First of all between successive application running on emulator you don't need to close the emulator. First before running the application you start the emulator by clicking window-->Android SDK and AVD Manager and click on the emulator you want to launch and click on 'start' button and then click on 'Launch' to launch the emulator. After the emulator launches unlock the emulator and keep that emulator minimized. And if you want to run an application go for 'run as android app' and you can see that on the emulator when maximized. After running that application if you want to make some changes in the application you don't need to close the emulator. you press the home button after running the application and keep the emulator minimized. Make the changes on the code and again go for running the application. Thus you can avoid that error message and save time for launching the emulator. if you got that error message then also the application will work properly but you cannot see the messages like uploading app-->installing .apk-->and the success messages. But these will be happening on the background. One way to overcome this is to restart the eclipse.

Categories

Resources