Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make it possible to connect to the dev server on a physical Android device (dx serve) #3444

Closed
Andrew15-5 opened this issue Dec 23, 2024 · 12 comments · Fixed by #3634
Closed
Labels
cli Related to the dioxus-cli program
Milestone

Comments

@Andrew15-5
Copy link
Contributor

Feature Request

Currently, only a virtual Android device supports hot-reloading etc. but not a physical one.

Implement Suggestion

I already have a branch with a working version, but I don't have time to make a PR. Should be free in a week or so.

@semicolon-10
Copy link

@Andrew15-5 May i know how are you serving on physical device? dx serve --platform ios .. and then what variable you pass?

@Andrew15-5
Copy link
Contributor Author

dx serve --platform android

@semicolon-10
Copy link

Hmm.. But default this command runs on virtual device i.e emulator. Not on physical device for me!

@Andrew15-5
Copy link
Contributor Author

You have to connect your physical device so that adb devices sees it. Better yet, disconnect the emulator first.

@jkelleyrtp jkelleyrtp added this to the 0.6.2 milestone Jan 7, 2025
@jkelleyrtp jkelleyrtp added the cli Related to the dioxus-cli program label Jan 7, 2025
@semicolon-10
Copy link

You have to connect your physical device so that adb devices sees it. Better yet, disconnect the emulator first.

Hmm.. I ask for ios. adb for android!.

@Andrew15-5
Copy link
Contributor Author

Hmm.. I ask for ios. adb for android!.

This issue is for Android, and so is the fix. You should ask somewhere else. @jkelleyrtp was testing the iOS, but I don't remember if the physical device already works, or it has the exact same issue as Android.

@jkelleyrtp
Copy link
Member

Fixed in #3586

I also attempted iOS code-signing so we can deploy to ios devices but my old prototype isn't working anymore, sadly.

@Andrew15-5
Copy link
Contributor Author

@jkelleyrtp, I've checked the latest version with and without patched crates.io, and it doesn't work. While my branch still works. All because I added the automatic adb reverse command on start and stop of the dx serve. Are you against embedding these commands, since you didn't add them in your PR?

P.S. I would've appreciated a heads-up on that you are making another implementation for this, as I made it clear that I have a fix (linked in the OP), and I'll make a PR this month (during our last meeting call).

@jkelleyrtp
Copy link
Member

@jkelleyrtp, I've checked the latest version with and without patched crates.io, and it doesn't work. While my branch still works. All because I added the automatic adb reverse command on start and stop of the dx serve. Are you against embedding these commands, since you didn't add them in your PR?

P.S. I would've appreciated a heads-up on that you are making another implementation for this, as I made it clear that I have a fix (linked in the OP), and I'll make a PR this month (during our last meeting call).

I didn't set up anything fancy with adb reverse - just exposed the devserver on 0.0.0.0 and pass the network address to the client instead of localhost. It only works for devices connected via WiFi which may be why it's not working for you.

I'd be down to support the proper adb reverse approach if you're still interested in adding it.

@Andrew15-5
Copy link
Contributor Author

just exposed the devserver on 0.0.0.0 and pass the network address to the client instead of localhost.

Is this all just in the Rust code for dx?

It only works for devices connected via WiFi which may be why it's not working for you.

If it works via Wi-Fi, then how can be the cause of it not working? Do you just need to dx serve --platform android or something else? Passing the host IP doesn't fix it, and passing remote device IP makes the program error in a bad way.

Without a working instruction, this issues isn't fixed, so it must be reopened. So far, instruction unclear.

I'd be down to support the proper adb reverse approach if you're still interested in adding it.

Okey-dokey.

@jkelleyrtp jkelleyrtp reopened this Jan 23, 2025
@jkelleyrtp
Copy link
Member

The PRs #3621 and #3586 don't exactly work if you have funky network settings so we still need an adb reverse strategy, so I'm re-reopening this issue.

@Andrew15-5
Copy link
Contributor Author

I wrote a short explanation of my specific situation/setup here, but the TL;DR is that with some VPN setups (on the host) the local-ip-address crate is using Netlink something something (I don't understand that) which in turn returns a VPN-specific "local IP", which I assume probably isn't actually accessible from outside. So if this crate were to still use the 192.168.. IP, then the issue would've been solved (for my setup), but it isn't, and I'm not sure if we can do something about that.

So in the end, we (I) return to the same thing: use adb reverse command that allow to bypass all this complexity (on the host-local network setup). It should help eliminate a lot if not all of the network-related issues when it comes to connecting to an Android device.

I already made a new branch with a similar patch, but it's built on top of the latest commit. Will make a PR soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cli Related to the dioxus-cli program
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants