When my Android application is already running and I change the code I get the "Hot Code Replace Failed" dialog.
I'm wondering what the correct response is (terminate or disconnect) if I want Eclipse to update my code on the device when I encounter it.
What is the difference between terminate and disconnect?
Also, I'm wondering if I click the "Do not show error when hot code replace is not supported", what will Eclipse do in the future when this scenario occurs?
Depending on the VM used (Dalvik in this case), some code changes can be made whilst debugging that will 'hot deploy' or 'hot replace'. This means that the code changes will immediately take effect on the emulator and you can test them without the need to re-deploy your app. This sort of hot re-deployment is more commonly used when working with enterprise applications that may take 10 minutes to build and deploy and so wastes a lot of time during development.
The HotSpot VM (the VM usually used on PCs) allows only simple code replacement and fails if you try to add/rename a field member or method. I'm not sure what sort of support the Dalvik VM provides but if you make a change it does not support you'll get that dialog box.
Now, as for the buttons:
If you check the box, it will always Continue.
I'm wondering what the correct response is (terminate or disconnect) if I want Eclipse to update my code on the device when I encounter it.
There's no direct way to have Eclipse update your running code on the emulator when you encounter this dialog as the Dalvik VM does not suppot hot swap, i.e. the update of running code. You'll have to redeploy the app to your emulator manually.
What is the difference between terminate and disconnect?
Terminate will terminate the app being debugged on the emulator/device.
Disconnect will just disconnect the debugger, and leave the app running on the emulator/device.
Also, I'm wondering if I click the "Do not show error when hot code replace is not supported", what will Eclipse do in the future when this scenario occurs?
It "won't show error when hot code replace is not supported" obviously ;) -- i.e. it won't warn you and any changes you do will not be hot-swapped into the running app (because the Dalvik VM doesn't support hot-swapping like Oracle's JVM for example).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With