Fire doesn't see any Android devices

fwiw, this one no longer needs you to install the external 9.3 compiler, as i had described abovd. it should work or if the box. but ofc you CAN use it with 9.3 if you prefer; if you do, make sure to enable “legacy xbuild tool chain”as well, since EBuild isn’t functional in 9.3

I’m having the same problem. Any date on when this is going to be fixed? I really can’t use Fire at all at the moment, since it won’t let me run on any device (emulated or real).

i can send you a build; what’s your username? It’s going to be a couple more weeks before we have a stable/public v10 build, at least.

Update: never mind, got it. I’ve uploaded Friday’s build to you at https://secure.remobjects.com/portal/downloads/personal. Note that you can combine that with the stable v9.3 compiler if you prefer (see previous messages), but using the v10 should be fine at this stage.

Sorry to take so long to respond; been busy with some things over the last week.

The new build does indeed see my physical Android device; however it still does not see the virtual devices that I set up in Android Studio.

Hmm, that uses the exact same logic. Do they show in add devices?

Finally coming back to this—sorry, some stuff came up which monopolized my attention for a while. I notice that this build of Fire is no longer in beta, so I updated everything, and… it now works! Fire is able to connect to the Android emulator. Huzzah! There is still one thing I’d suggest improving, though—virtual devices are only visible to Fire while the emulator is currently running. If the emulator is not yet running, the device does not show up in Fire’s list. This is annoying, since the easiest way to start a virtual device is through Android Studio, which will cause Fire to complain if it is open while Fire tries to debug an app. Fortunately, it’s possible to start the emulator manually via the command line, and it would be great if Fire could do this automatically.

To list all virtual devices on a machine:

~/Library/Android/sdk/tools/emulator -list-avds

To start a virtual machine:

~/Library/Android/sdk/tools/emulator -avd [name of avd]

Thanks!
Charles

Glad to hear it’s all working for you now!

Agreed, and this is actually on my list of things to add; I actually started working o that a coupe, weeks back but got thrown off by the VDM in Android Studio not working properly to set up test emulators, me for me, so I deferred the issue I til I have time to sort that out :(. But it’s something I do wanna add.

Step one :wink:

1 Like

One problem with making this UI work seamlessly here is that I can’t seem to match up the listed emulators with the detected booted devices, since the use different IDs:

device emulator-5554          device product:sdk_gphone_x86 model:Android_SDK_built_for_x86 device:generic_x86 transport_id:4
emulator Nexus_5X_API_P
emulator Nexus_S_API_26

in this case, Nexus_S_API_26 is the booted-up emulator-5554.

That means, I could provide UI to boot Emulator up, and it would eventually then show as separate device, but I’ve no way to “connect” the two and know which of the booted/connected devices matches up to the unbooted Emulator the user picked :(. any suggestions?

Unless I can solve this, the best I can do is provide a separate “here’s a list of emulators. pick one to boot up” UI that’s not integrated with the device picker seamlessly :(.

Hmm, when starting the emulator with the -verbose flag, I noticed that this was logged:

emulator: control console listening on port 5554, ADB on port 5555

I wonder if the device name for the emulator is always emulator- with the port number postpended?

ahh. good catch. i can use that to match up the emulator i did boot myself. but it won’t take care of recognizing/matching one that is already booted when afire starts, or gets started manually by the user. but this might be “good enough” for the common case…

Okay, after playing with this some more, I can confirm that the name always seems to correspond to the port number that it’s listening on. Furthermore, the emulator command has a -port option that allows you to manually select the port to use when starting the emulator up. The constraints are that the port number needs to be between 5554 and 5584 inclusive, and that not only the port number but also the port number plus one (so, 5555 for 5554) need to be free. So if you scan for a pair of ports that work, you can start the emulator with the desired port, and then you know what the device name’s going to be.

yeah, that solves the same problem as checking the boot message. but it doesn’t help match up booted devices. unrelated, where did you find the parameters for ‘emulator’ documented? it doesn’t show a list afaict?

I’ve figured out how to get the AVD name for already-booted devices! If you connect to the port number given by the adb device name, you can query the device’s avd name like so:

➜  ~ ~/Library/Android/sdk/platform-tools/adb devices
List of devices attached
emulator-5554	device

➜  ~ telnet localhost 5554
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
Android Console: Authentication required
Android Console: type 'auth <auth_token>' to authenticate
Android Console: you can find your <auth_token> in 
'/Users/[redacted]/.emulator_console_auth_token'
OK
auth [redacted]
Android Console: type 'help' for a list of commands
OK
avd name
Nexus_6_Nougat
OK

To answer your other question, emulator -help-all dumps all documentation for the emulator command.

Cool. Now we’re talking! I’ll get this hooked top tomorrow, then. thanx!

My pleasure. This might just be the inspiration I need to finally write that mobile app I’ve had the idea for floating around in my head for years, and with the ability to write Swift for Android, I may be able to make it easily cross-platform at that.

1 Like

Done, pending a lot of testing (and porting the Telnet part to .NET, for use in Water ;).

I’d love to send you a new build later today to get your feedback, both on the general flow of how it works, and also to see if you run into any problems I haven’t seen here. Can you remind me what your login username on remobjects.com is?

One issue I haven’t fully solved is, that after booting the emulator and getting the port, there seems to be some window of time where the is not actually ready to receive an install yet :(. I’ve added a delay of 1sec for now, and that seems to solve the issue for me so far — would like to hear your results there. (if it fails, with “device offline”, just hitting run again will work.

The new build will also have massive improvement to the build tool chain for Android that I added today, improving caching of build phases such as PreDex, Resource processing and APK Packaging, if inputs haven’t changed. (a “nothing changed” build now takes less than .5s here on my 12" MacBook ;).

I’d love to send you a new build later today to get your feedback, both on the general flow of how it works, and also to see if you run into any problems I haven’t seen here. Can you remind me what your login username on remobjects.com is?

Just my usual—CharlesS (perhaps ‘charless’ on this board since it seems to display it in all lowercase when I click on the profile button).

One issue I haven’t fully solved is, that after booting the emulator and getting the port, there seems to be some window of time where the is not actually ready to receive an install yet :(. I’ve added a delay of 1sec for now, and that seems to solve the issue for me so far — would like to hear your results there. (if it fails, with “device offline”, just hitting run again will work.

Do you mean the thing where the emulator sits on “Waiting for debugger” indefinitely and then Fire claims it can’t connect to it? I ran into that the first couple times I tried pushing a Hello World app to the emulator, but when I started investigating to make a report, I suddenly stopped being able to reproduce it anymore. If it’s a narrow enough time window, that might explain it (perhaps something was slowing down the emulator’s boot process on my first couple of attempts, making it more feasible for me to get the project compiled before it was ready).

The new build will also have massive improvement to the build tool chain for Android that I added today, improving caching of build phases such as PreDex, Resource processing and APK Packaging, if inputs haven’t changed. (a “nothing changed” build now takes less than .5s here on my 12" MacBook ;).

Nice, faster builds are always appreciated.

No, this is earlier. Essentially I call emulator -avd Foo -verbose to boot. Eventually the emulator says control console listening on port XXXX. I take parse the port from that and basically pass back to the highr level IDE saying “ok emulator-XXXX is not booted, go do your thing”, and the Idea will then deploy (via adb) and launch. Without delay, deployment (adb install) fails “device offline”. with the 1sec delay I have. to see it fail.

The “Waiting for debugger” issue is unrelated, thats between the Debug Engine and adb, and outside of mt code :(. I’ll have to have the debug engine team have a look at that, if that’s still a thing — I haven’t see that happen in a. while.

:wink: