Question

I am in the process of debugging an android application using android studio. I commented out certain lines and attached it to the ADB. But when debugging it still executes the commented lines! this is completely strange.

How do I fix this?

Have tried closing and reopening Android Studio, didn't help.

Was it helpful?

Solution

Sometimes this happens to me when Android Studio is not running new code. I usually cannot pin it down on one specific thing (ADB, Android Studio, Build process, etc) so I go for the scorched earth approach.

Uninstall the app via ADB:

adb uninstall <package_name>

Restarting Android Studio may help, but also running a Build > Clean Project

clean


If you have changed any Gradle settings or files you may have to sync those up, so try Syncing Project with your Gradle files.

sync


If this all really doesn't work, a restart of your emulator/physical testing device and computer may be in order.

OTHER TIPS

This happened to me, and if I commented out the lines using these /* */ instead of the ctrl+/ shortcut, then it started working again.

On a physical test device i fixed this problem by manually uninstalling my app from the device, restarting the android studio ide and reinstalling. Prior to this I tried other solutions. Syncing project did not help. Cleaning did not help.

This type of problem, execution of commented code is very subtle and does not inspire confidence in the software as a tool to build with. I have never worked with such an ide before which has so many problems.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top