# Debugging Android in Water (.2369)

**URL:** https://talk.remobjects.com/t/debugging-android-in-water-2369/18625
**Category:** Water
**Created:** [February 4, 2019, 8:18pm UTC](https://talk.remobjects.com/t/debugging-android-in-water-2369/18625 "2019-02-04T20:18:28Z")
**Posts on this page:** 18
**Page:** 1

<div class="post-metadata">

### Author: ![zmattr](https://talk.remobjects.com/user_avatar/talk.remobjects.com/zmattr/32/7989_2.png) [@zmattr](https://talk.remobjects.com/u/zmattr)
#### Post date: [February 4, 2019, 8:18pm UTC](https://talk.remobjects.com/t/debugging-android-in-water-2369/18625/1 "2019-02-04T20:18:28Z")

</div>

If I debug my Android project in Water, then debug a different app in Android Studio, then return to debug my project in Water, the debug session fails in Water.

Things I’ve tried that haven’t worked:

- Restarting Water
- Running `adb kill-server` and `adb start-server`
- Killing Android Studio
- Restarting my laptop

The only thing I found that does work is re-installing Water.

There is no information in the Water.log file. The Build Log in Water shows a normal successful build but then “Last debug session failed.”

This seems to be new as of .2369 – at least I had not noticed it before, and I believe I was able to do this even on .2365 without issue.

---

<div class="post-metadata">

### Author: ![mh](https://talk.remobjects.com/user_avatar/talk.remobjects.com/mh/32/18050_2.png) [@mh](https://talk.remobjects.com/u/mh)
#### Post date: [February 4, 2019, 9:00pm UTC](https://talk.remobjects.com/t/debugging-android-in-water-2369/18625/2 "2019-02-04T21:00:20Z")

</div>

> [@zmattr](#):
>
> The only thing I found that does work is re-installing Water.

Can’t believe that that can make any difference. Reinstalling literally does nothing but copt the same files in place, again. There must be something else going n

> [@zmattr](#):
>
> This seems to be new as of .2369 – at least I had not noticed it before, and I believe I was able to do this even on .2365 without issue.

Hmm, odd, as nothing here has changed in forever.

Can I ask you to attach a second copy of Water _to_ Water (Echoes/.NET Debugger, 4.x Runtime), make sure Break on Exceptions is on, and see if there’s any exception inside Water that gives us more infos?

FWIW, I think there _are_ known issues with debugging Android apps when Android Studio is running, as it hooks into some APIs that prevent anyone else from successfully interactive with them (I forgot the details). but stopping ADS should do the trick, if that were the issue here.

thanx!

---

<div class="post-metadata">

### Author: ![zmattr](https://talk.remobjects.com/user_avatar/talk.remobjects.com/zmattr/32/7989_2.png) [@zmattr](https://talk.remobjects.com/u/zmattr)
#### Post date: [February 4, 2019, 9:35pm UTC](https://talk.remobjects.com/t/debugging-android-in-water-2369/18625/3 "2019-02-04T21:35:56Z")

</div>

> [@mh](#):
>
> FWIW, I think there _are_ known issues with debugging Android apps when Android Studio is running

Yes I’ve experienced these before, but as you said, stopping ADS would fix it.

> [@mh](#):
>
> Can I ask you to attach a second copy of Water _to_ Water (Echoes/.NET Debugger, 4.x Runtime), make sure Break on Exceptions is on, and see if there’s any exception inside Water that gives us more infos?

Happy to help, but I’m not following. What do you mean by attach a second copy of Water to Water?

---

<div class="post-metadata">

### Author: ![mh](https://talk.remobjects.com/user_avatar/talk.remobjects.com/mh/32/18050_2.png) [@mh](https://talk.remobjects.com/u/mh)
#### Post date: [February 4, 2019, 9:58pm UTC](https://talk.remobjects.com/t/debugging-android-in-water-2369/18625/4 "2019-02-04T21:58:57Z")

</div>

Start a second copy of Water. Go to [Debug|Attach to Process](https://docs.elementscompiler.com/Fire/Debugging/Attaching/). Select Platform = Echoes/CLR, Runtime = v4 at the top, then find the first copy of Water in the list and select it. Click “Attach”. Make sure “Stop on Exceptions” is turned on in that second copy of Water. (Also, just to be sure go to [Debug|Manage Ignored Exceptions](https://docs.elementscompiler.com/Fire/Debugging/Exceptions/) and click “Uncheck All”).

Now switch back to the first copy of Water and do whatever needs doing to make it fail.

Hopefully, the second copy of Water will catch the exception, and pause to show you details. Send those to me. (ideally the exception message, and a stack trace. (you can get a full stack trace with typing “`bt`” in the debug console.

thanx,  
marc

---

<div class="post-metadata">

### Author: ![zmattr](https://talk.remobjects.com/user_avatar/talk.remobjects.com/zmattr/32/7989_2.png) [@zmattr](https://talk.remobjects.com/u/zmattr)
#### Post date: [February 5, 2019, 3:27pm UTC](https://talk.remobjects.com/t/debugging-android-in-water-2369/18625/5 "2019-02-05T15:27:35Z")

</div>

> [@mh](#):
>
> Start a second copy of Water. Go to [Debug|Attach to Process](https://docs.elementscompiler.com/Fire/Debugging/Attaching/)

This is strange, but when I “Attach to Process” to the original Water, the original Water process is killed immediately. The only output to Water.log is this:

> 2019-02-05 15:25:27 parameters {  
> “AttachToPID”: 14404,  
> “Mode”: “Echoes”,  
> “SubMode”: “.NET”,  
> “Architecture”: “x86\_64”,  
> “CrossBox”: “Local”,  
> “NETFrameworkVersion”: “v4”  
> }

---

<div class="post-metadata">

### Author: ![mh](https://talk.remobjects.com/user_avatar/talk.remobjects.com/mh/32/18050_2.png) [@mh](https://talk.remobjects.com/u/mh)
#### Post date: [February 5, 2019, 3:28pm UTC](https://talk.remobjects.com/t/debugging-android-in-water-2369/18625/6 "2019-02-05T15:28:47Z")

</div>

hmm, odd.

---

<div class="post-metadata">

### Author: ![mh](https://talk.remobjects.com/user_avatar/talk.remobjects.com/mh/32/18050_2.png) [@mh](https://talk.remobjects.com/u/mh)
#### Post date: [February 5, 2019, 3:31pm UTC](https://talk.remobjects.com/t/debugging-android-in-water-2369/18625/7 "2019-02-05T15:31:17Z")

</div>

I’ll see if someone can reproduce your original issue locally. If not, maybe I can TeamView into your system sometime later today or tomorrow?

---

<div class="post-metadata">

### Author: ![zmattr](https://talk.remobjects.com/user_avatar/talk.remobjects.com/zmattr/32/7989_2.png) [@zmattr](https://talk.remobjects.com/u/zmattr)
#### Post date: [February 5, 2019, 3:33pm UTC](https://talk.remobjects.com/t/debugging-android-in-water-2369/18625/8 "2019-02-05T15:33:00Z")

</div>

Sounds good, thanks.

---

<div class="post-metadata">

### Author: ![mh](https://talk.remobjects.com/user_avatar/talk.remobjects.com/mh/32/18050_2.png) [@mh](https://talk.remobjects.com/u/mh)
#### Post date: [February 5, 2019, 7:33pm UTC](https://talk.remobjects.com/t/debugging-android-in-water-2369/18625/9 "2019-02-05T19:33:53Z")

</div>

Matt,

I’m told we cannot repro this locally, so I’d appreciate if I could debug/inspect what’s going on your machine, at your convenience, via team Viewer. I’ll be around for another 1-2 hours today, and be in around 7-8am Atlantic Time, tomorrow.

Do you have a copy of Visual Studio 2015 or 2017 installed? If so, that’d help me with debugging, since you said the attaching from Water did not work (though I’d like to re-test that part, as well).

thanx,  
marc

---

<div class="post-metadata">

### Author: ![zmattr](https://talk.remobjects.com/user_avatar/talk.remobjects.com/zmattr/32/7989_2.png) [@zmattr](https://talk.remobjects.com/u/zmattr)
#### Post date: [February 7, 2019, 4:37pm UTC](https://talk.remobjects.com/t/debugging-android-in-water-2369/18625/10 "2019-02-07T16:37:25Z")

</div>

Marc, I missed the notification for your reply. Thanks for checking and for offering to Team View. At the moment I have a few critical bugs to fix, and I’m able to avoid this problem until I fix them, so I’d probably better wait. I’ll direct message you to see if/when you’re available to team view in the future if this is still an issue. Thanks again - I greatly appreciate your willingness to help with edge case stuff like this!

---

<div class="post-metadata">

### Author: ![mh](https://talk.remobjects.com/user_avatar/talk.remobjects.com/mh/32/18050_2.png) [@mh](https://talk.remobjects.com/u/mh)
#### Post date: [February 7, 2019, 4:38pm UTC](https://talk.remobjects.com/t/debugging-android-in-water-2369/18625/11 "2019-02-07T16:38:40Z")

</div>

Thanx!

---

<div class="post-metadata">

### Author: ![zmattr](https://talk.remobjects.com/user_avatar/talk.remobjects.com/zmattr/32/7989_2.png) [@zmattr](https://talk.remobjects.com/u/zmattr)
#### Post date: [February 7, 2019, 5:43pm UTC](https://talk.remobjects.com/t/debugging-android-in-water-2369/18625/12 "2019-02-07T17:43:09Z")

</div>

For the sake of updating the thread, the issue may only be indirectly related to Android Studio (or possibly not at all, though there seemed to be a strong correlation). I’ve been debugging all morning and have now hit the same “Debug session failed” wall, but I have not launched Android Studio today.

---

<div class="post-metadata">

### Author: ![mh](https://talk.remobjects.com/user_avatar/talk.remobjects.com/mh/32/18050_2.png) [@mh](https://talk.remobjects.com/u/mh)
#### Post date: [February 7, 2019, 6:48pm UTC](https://talk.remobjects.com/t/debugging-android-in-water-2369/18625/13 "2019-02-07T18:48:53Z")

</div>

odd, but probably good.

I’d be cool to attach and see the error. if you’re free, I could TV in now to se if I can gather more info, if it persists consistently…

---

<div class="post-metadata">

### Author: ![zmattr](https://talk.remobjects.com/user_avatar/talk.remobjects.com/zmattr/32/7989_2.png) [@zmattr](https://talk.remobjects.com/u/zmattr)
#### Post date: [February 7, 2019, 7:09pm UTC](https://talk.remobjects.com/t/debugging-android-in-water-2369/18625/14 "2019-02-07T19:09:56Z")

</div>

I’m not getting the bug at the moment. It does seem to be unrelated to Android Studio, since I just debugged an app on there and it did not cause an issue. I’m on .2365 at the moment. I’ll try upgrading to .2369 again to see if the bug reappears.

---

<div class="post-metadata">

### Author: ![mh](https://talk.remobjects.com/user_avatar/talk.remobjects.com/mh/32/18050_2.png) [@mh](https://talk.remobjects.com/u/mh)
#### Post date: [February 7, 2019, 8:03pm UTC](https://talk.remobjects.com/t/debugging-android-in-water-2369/18625/15 "2019-02-07T20:03:02Z")

</div>

I assume there’s no relevant output in either the Build log or the Debug log, when the launch fails, right?

---

<div class="post-metadata">

### Author: ![zmattr](https://talk.remobjects.com/user_avatar/talk.remobjects.com/zmattr/32/7989_2.png) [@zmattr](https://talk.remobjects.com/u/zmattr)
#### Post date: [February 7, 2019, 8:37pm UTC](https://talk.remobjects.com/t/debugging-android-in-water-2369/18625/16 "2019-02-07T20:37:22Z")

</div>

Nope

---

<div class="post-metadata">

### Author: ![zmattr](https://talk.remobjects.com/user_avatar/talk.remobjects.com/zmattr/32/7989_2.png) [@zmattr](https://talk.remobjects.com/u/zmattr)
#### Post date: [February 19, 2019, 2:31pm UTC](https://talk.remobjects.com/t/debugging-android-in-water-2369/18625/17 "2019-02-19T14:31:57Z")

</div>

> [@zmattr](#):
>
> the issue may only be indirectly related to Android Studio

Again, for the sake of tracking the issue as I notice it… It seems like it is not an Android Studio interaction problem but an ADB interaction problem. A few times a week I suddenly get the “debug failed” message in Water. Restarting Water, re-connecting my device, and `adb kill-server` / `adb start-server` do not fix it. What _does_ fix the problem 100% of the time (so far at least) is launching Android Studio, doing an on-device run from AS, then closing AS and running again from Water.

It seems like possibly a state problem with ADB that Android Studio is fixing for me but Water is not. Again, nothing in the logs, I’m just mentioning symptoms as I see them in case it’s helpful in the future.

---

<div class="post-metadata">

### Author: ![zmattr](https://talk.remobjects.com/user_avatar/talk.remobjects.com/zmattr/32/7989_2.png) [@zmattr](https://talk.remobjects.com/u/zmattr)
#### Post date: [February 25, 2019, 5:36pm UTC](https://talk.remobjects.com/t/debugging-android-in-water-2369/18625/18 "2019-02-25T17:36:02Z")

</div>

I may have stumbled upon the solution to this. When I get the failed debug, `adb kill-server ... adb start-server` does not fix the problem. What does fix it is `adb reconnect`. Perhaps Android Studio includes `adb reconnect` in its ADB initialization but Water does not?
