"Device not found" when debugging in Visual Studio with Elements 10

android
cooper

(Matt Robertson) #1

I have an Android app project in Oxygene. I just recently updated from 9.3.103.2211 to 10.0.0.2351. When I run a debug in Visual Studio now, the project builds fine but then shows Error debugging project: Unknown device 'HT72V0201615'.

The same project debugs fine in Water, so the issue seems to be a VS one and not something with the project settings. Any ideas as to what might be causing this? I saw that there was a move from Crossbox 1 to Crossbox 2 in the Elements 10 update but I’m not sure what issues this could cause.


(marc hoffman) #2

There’s been drastic changes to how all of this works in Elements 10, with the move to CrossBox 2, yes. Although technically Android never went thru Crossbox 1 (that was only for Mac/iOS), it is now all abstracted under the same roof and under CrossBox 2.

What’s most odd iOS that all of tis logic is shared between Fire, Water and Visual Studio now, so it’s very weird that it would work in Water and not Visual Studio, at the same time. Can you show me a scree shot of what you see in the CrossBox popup/menu in both Water and VS? Does the Android device show in either/both? When you run add devices -l in a console window, was output do you get?

thanx,
marc


(Matt Robertson) #3

What CrossBox popup are you referring to?

I assume that was a typo and you meant adb not add. If so, this is the output:

List of devices attached
HT72V0201615           device product:marlin model:Pixel_XL device:marlin transport_id:1

(marc hoffman) #4

The menu/comboox where you select the Android device.

Auto-correct, yeah :frowning:

Ok, that part does look good :frowning:


(Matt Robertson) #5

Gotcha. This is from Water.

Here is the VS screenshot:


(marc hoffman) #6

Hm ok. So both VS and Water see the device fine. Strange. let me do some code review, to see what paths this might be hitting. Do note that I’m not familiar with the VS side of things (just the shared back-end, end Water), so if this is a VS side problem, I’ll need to defer tis to the VS team tomorrow or Wednesday :(.


(marc hoffman) #7

Oh, side question: does running in the emulators work, or same/similar error?


(Matt Robertson) #8

Here’s a strange update. I changed the target to an emulator and then immediately back to my Pixel XL (without actually attempting to debug) and now the output is different but still failing.

In the Build output I see this:

========== Build: 1 succeeded or up-to-date, 0 failed, 0 skipped ==========
Running C:\[path]\adb.exe -s HT72V0201615 install -r C:\[path]\[app].apk
Success

But in the debug output:

Starting: Intent { cmp=/com.accordancebible.accordance.SplashActivity }
Error type 3
Error: Activity class {/com.accordancebible.accordance.SplashActivity} does not exist.

The program 'com.accordancebible.Accordance.apk: C:\[path]\com.accordancebible.Accordance.apk' has exited with code -1 (0xffffffff).

To state the obvious, this class does in fact exist and launches fine in Water.


(marc hoffman) #9

Yeah, no idea from my side, I’ll need to have the VS team debug this. The error message is from my code in CrossBox, and the ID is correct. The only way I’d emit this error is if the device was not in my list. But then, the men u in Visual Studio is driven by the exact same list, so of it shows there, it has to be in the list. I’m stumped.

One last shot, try switching to an Emulator, run (whether it works or not, does not matter) and back. Does it work then? My only guess here is that (since the VS men doesn’t show the ID, just the name), maybe the ID stored in the “active device” setting is somehow not the exact right now, and re-setting it would fix it :crossed_fingers:t3:. Also, can you send me the .elements and .elements.user file?

(but really, if this were wrong, it’d fail in Water too. as I said, strange…)


(Matt Robertson) #10

Glad you asked - it seems to be working correctly in an emulator.

EDIT:
Actually no it’s not, I’m getting the same Activity Not Found error as on the device. I happened to have an instance running in my non-cold boot emulator and thought that it had launched correctly at first.

No luck - same error.


(marc hoffman) #11

Very strange, but that is progress, as it does get a lot further now, and finds the device, and at least deploys. This is what I was hoping for with the above steps; on the down side, we now will never find out what changed to “fix” it, when you switched back and forth.

if this happens again in the future, can you back up the old project and .user file, do the trick again, and then compare/send me both versions? Maybe there’s an invisible extra character in the ID that throws it off. somehow…

Error: Activity class {/com.accordancebible.accordance.SplashActivity} does not exist.
To state the obvious, this class does in fact exist and launches fine in Water.

Hmm. That error comes form the one-device system though, so it’s “impossible” that, at this stage and for this error, it makes a difference whether the app ws launched form Water of VS.

VS and Water do use different code paths for determining the “startup activity” Are you 100% sure the above quoted name is correct and does not differ from what Water might use (slightly different namespace, etc)? Can you check the Water.log file (in AppData\Local\RemObjects Software\Elements? it should show the exact startup parameters Water passed to the debugger, looking something like this:

parameters {
  "SubMode": "Android",
  "Architecture": "jvm",
  "EnvironmentVariables": {
  },
  "Arguments": [
  ],
  "AndroidDeviceID": "84B7N16505000621",
  "AndroidPackageName": "com.remobjects.androidapplication44",
  "CaptureOutput": true,
  "MonoExePathOverride": "/Users/mh/Code/Fire/Bin/Build/macOS/Fire.app/Contents/Resources/Mono/bin/mono",
  "StrictBreakpoints": false,
  "UseMixedDebugger": false,
  "CrossBox": "Local",
  "AndroidMainActivityName": "com.remobjects.androidapplication44.MainActivity",
  "Detach": false,
  "Mode": "Cooper",
  "LocalExecutable": "/Users/mh/Test Projects/com.remobjects.androidapplication44/Bin/Debug/com.remobjects.androidapplication44.apk"
}

(marc hoffman) #12

“Good”


(Matt Robertson) #13

I can do better than that :slight_smile: The code is in a VCS. Here’s the only change. This line was absent before and present after the switch:

<CrossBoxDeviceInternalID>HT72V0201615</CrossBoxDeviceInternalID>

(Matt Robertson) #14
parameters {
  "Arguments": [
  ],
  "EnvironmentVariables": {
  },
  "Mode": "Cooper",
  "SubMode": "Android",
  "CaptureOutput": true,
  "CrossBox": "Local",
  "LocalExecutable": "C:\\Users\\mattr\\Code\\Accordance\\android\\AccordanceAndroid\\com.accordancebible.Accordance\\bin\\Debug\\com.accordancebible.accordance.apk",
  "Architecture": "jvm",
  "AndroidDeviceID": "HT72V0201615",
  "AndroidPackageName": "com.accordancebible.accordance",
  "AndroidMainActivityName": "com.accordancebible.accordance.SplashActivity",
  "UseMixedDebugger": false,
  "Detach": false,
  "StrictBreakpoints": true
}

(marc hoffman) #15

Well, if not was absent then VS wouldn’t have know what device to run on. What’s more likely to have happened is that after your last checkout you selected the device and at that time it got set badly, somehow. And when you toggled to Emulator and back, it got set properly. That bad intermediate state we’ll never know :(.

Damn, that does look right. I’m assuming the / is a display issue from the Android/Java runtime, but it could be that VS adds that by mistake — thats something I’ll have to have the VS team look at tomorrow/wednesday, I’m afraid :(.

Are you good until then, using Water?


(Matt Robertson) #16

I hadn’t made any changes to the repo before this one - I actually had just happened to check before starting all of this. Here are the two side-by-side.

Previous:

<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <PropertyGroup>
    <AndroidDeviceName>HT72V0201615</AndroidDeviceName>
    <AndroidDevice>HT72V0201615</AndroidDevice>
    <AndroidMinVersion>21</AndroidMinVersion>
    <AndroidPlatformName>android-27</AndroidPlatformName>
    <CrossBoxDeviceID>HT72V0201615</CrossBoxDeviceID>
    <CrossBoxDevice>Pixel XL</CrossBoxDevice>
    <CrossBox>Local</CrossBox>
  </PropertyGroup>
</Project>

Current:

<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <PropertyGroup>
    <AndroidDeviceName>HT72V0201615</AndroidDeviceName>
    <AndroidDevice>HT72V0201615</AndroidDevice>
    <AndroidMinVersion>21</AndroidMinVersion>
    <AndroidPlatformName>android-27</AndroidPlatformName>
    <CrossBoxDeviceID>HT72V0201615</CrossBoxDeviceID>
    <CrossBoxDevice>Pixel XL</CrossBoxDevice>
    <CrossBox>Local</CrossBox>
    <CrossBoxDeviceInternalID>HT72V0201615</CrossBoxDeviceInternalID>
  </PropertyGroup>
</Project>

Perhaps it was pulling the CrossBoxDeviceID but also needed CrossBoxDeviceInternalID?


(marc hoffman) #17

Hm, curious. I missed the Internal part for my last reply.

checking… That’s not a setting I use from my code, must be a VS specific thing. I’ll have the VS team check into that too. Seems unnecessary. CrossBoxDeviceID is what should drive this. (That said, this doesn’t really explain why it still shows the actual correct device ID in the error message. very strange…)


(Matt Robertson) #18

Thanks for looking into this Marc!


(marc hoffman) #19

Of course!