"Couldn't adb reverse" when trying to open app via USB


#1

Hello folks,

I am developing a CRNA with Expo on my Windows laptop, and I am running into several major issues.

When I started 2 days ago, I already couldn’t load my app with my Android phone (Honor 8 with Android 7.0), because trying to scan the QR code was always giving me the same error message on my phone (although both my PC and my phone are on the same WiFi network) :

“Something went wrong.
Could not load exp://192.168.55.1:19000. Network response timed out.”

I decided to load it using USB instead, so I activated the USB debugging function on my phone, downloaded ADB version 1.0.31 from this link (https://adb.clockworkmod.com/), and used the expo start --localhost --android command, as seen in this topic (Run Expo on Android device via USB?), and guess what… It was running perfectly fine !
The app was loading on my phone, it was reloading automatically when I saved some changes in the code, great.

But today (2 days later), I go back on my laptop to continue developing, I plug in my phone, activate USB debugging, etc. and run the exact same command… And now I have this “couldn’t adb reverse” error message in the terminal :

The adb devices command still shows that my phone is connected though. On top of that, I have this error message displayed on my phone in the Expo app :

“Something went wrong.
Could not load exp://localhost:19000.”

I have absolutely no idea why the USB mode suddenly stopped working : I don’t remember touching anything within the settings of Expo or on my computer that could have caused the issue in only 2 days.

I tried reinstalling Expo on both my PC and cellphone, reinstalling the ADB driver on my computer, creating a new project to see if it would work… Nothing does the trick, I’m kinda desesperate : I can’t load my app by any means now.

Could you guys please help me find a solution (if not for both the LAN and the USB problem, at least for one of them :pray::pray:) ?

EDIT : The main issue (USB problem) is still there, but I managed to solve the WiFi issue in a few steps.

First, the IP adress that Expo was using to host the app’s server was wrong : it was selecting the first one it found when doing ipconfig whereas it actually wasn’t the one of my WiFi network. More info about this issue here (github.c om/react-community/create-react-native-app/issues/144).
Then, I changed the visibility of my laptop on the WiFi network from “public” to “private”.
Finally, I opened the 19000, 19001, 19002 ports within the firewall’s rules. More info about this here (stackoverflow.c om/a/44600431/1443984).

Now I can open my app in my phone using Expo via QR code.


#2

Okay, I’ll just reply to myself since I have actually found the solution to both of my problems !

As far as the WiFi problem is concerned (“Something went wrong. Could not load exp://192.168.55.1:19000. Network response timed out.”) :

First, the IP adress that Expo was using to host the app’s server was wrong : it was selecting the first one it found when executing ipconfig whereas it actually wasn’t the one of my WiFi network. More info about this issue here (github.c om/react-community/create-react-native-app/issues/144).
Then, I changed the visibility of my laptop on the WiFi network from “public” to “private”.
Finally, I opened the 19000, 19001, 19002 ports within the firewall’s rules. More info about this here (stackoverflow.c om/a/44600431/1443984).

Now I can open my app in my phone using Expo via QR code.

And now for the USB problem (it’s actually really stupid…) :

I actually already had an ADB driver pre-installed on my computer (Android Composite ADB Interface), even before getting started in this whole development thing. But I didn’t know that since typing adb in the command prompt was returning the adb is not recognized as an internal or external command message, certainly because it was not added to the Path variable. That’s why, thinking I didn’t have any ADB driver on my computer, I downloaded one from https://adb.clockworkmod.com/ on Sunday night.

This driver is actually outdated (version 1.0.31), and doesn’t support the adb reverse command, which is the reason why it wasn’t working today. So I eventually uninstalled it, and the Android Composite ADB Interface alone does the job just fine.
What surprises me is that when the USB hosting was working, on Sunday night, I had already installed the outdated ADB from clockworkmod. I think that since I had not yet rebooted my PC, Expo was still using my ‘stock’ ADB driver (Android Composite ADB Interface) when calling adb reverse, and not the problematic one I had just installed.

The moral of the story is : before installing a random software that you find on the internet, always double check that you don’t already have something that does the job better on your computer :grin:


closed #3

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.