Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Getting "error: closed" twice on "adb reverse"

I am trying to reverse-forward port through ADB, but it just returns cryptic error of error: closed. Normal forwarding works. Session snippet:

$ adb forward tcp:59778 tcp:59778 $ adb forward --list 015d2109ce0c1a0f tcp:59778 tcp:59778 $ adb forward --remove-all $ adb forward --list $ adb reverse --list error: closed error: closed $ adb reverse tcp:59778 tcp:59778 error: closed error: closed 

I am connecting via USB to non-rooted Nexus 7 2012 Android 4.4.4 from Windows 7 Pro x64 on Boot Camp.

like image 857
Konrad Jamrozik Avatar asked Jul 20 '15 20:07

Konrad Jamrozik


People also ask

How do I fix an adb connection error?

In tools menu,Android-> untick enable adb Integration and Then OPEN widows task manager n manually end process adb.exe This also solved my issue as der were multiple adb.exe running. Show activity on this post. Restart the computer. Now, disconnect the device, connect it, Make sure USB debugging Option is enabled.

What is adb reverse command?

$ adb reverse --list. Reverse a TCP port from an emulator or device to localhost.

How do I stop adb port forwarding?

Try adb forward --remove tcp:8080 , or adb forward --remove-all .

What is adb forwarding?

Basically means that the requests on specific port on the host will be forwarded to a specific port on the device.


2 Answers

adb reverse was introduced in Android 5.0

like image 153
Alex P. Avatar answered Nov 07 '22 01:11

Alex P.


Since adb reverse is not supported in Android versions lower than 5.0, you need to use an alternative method, for example connecting via Wi-Fi instead. If you are using React Native, Facebook has added official documentation to connect to the development server via Wi-Fi. Quoting the instructions for MacOS, but they also have them for Linux and Windows:

Method 2: Connect via Wi-Fi

You can also connect to the development server over Wi-Fi. You'll first need to install the app on your device using a USB cable, but once that has been done you can debug wirelessly by following these instructions. You'll need your development machine's current IP address before proceeding.

You can find the IP address in System Preferences → Network.

Make sure your laptop and your phone are on the same Wi-Fi network. Open your React Native app on your device. You'll see a red screen with an error. This is OK. The following steps will fix that. Open the in-app Developer menu. Go to Dev Settings → Debug server host for device. Type in your machine's IP address and the port of the local dev server (e.g. 10.0.1.1:8081). Go back to the Developer menu and select Reload JS.

like image 28
Jesús Carrera Avatar answered Nov 07 '22 02:11

Jesús Carrera