Could not run adb reverse: Command failed: /home/sofiane/Android/Sdk//platform-tools/adb -s 192.168.1.2:5555 reverse tcp:8081 tcp:8081
When i use port : 8081
adb tcpip 8081
adb connect 192.168.1.2:8081
I have this error :
And when i use port : 5555
adb tcpip 5555
adb connect 192.168.1.2:5555
I have this error :
If you are connected to an Android device over wifi you must do as advised in the last suggestion on the error screen (because adb -s ip:port reverse ... seems not to work):
With your app open, shake the device until you see the developer menu.
Go to "Dev Settings".
Set "Debug server host & port for device" to your development machine's IP at port 8081.
Make sure you have connected on the same network, like in my case I connected my laptop through my phone's hotspot. Of course you also need to have internet access and make sure you have successfully installed your app to your phone using react-native run android. If you have successfully installed your app you may now remove the attached USB cable.
Then on
Windows, just open your terminal (CMD), then type ipconfig, and then press enter.
You will then see the list of your IP configuration.
Your private ip address is the IPv4 Address, something like 192.168.0.10.
On your react native project, run react-native start to start the metro bundler.
When the metro bundler started it will say Running Metro Bundler on port 8081 <- this is the port that you have to connect through.
On your device go to device setting then to "Debug server host & port for device", then type the computer's private IP address plus the port where metro bundler is running, for example: 192.168.0.10:8081.
Click on save then try to reload your app again.
As stated on react-native docs
devices have to be on same wifi in order to work, then go to settings through app by shaking it and in menu select "Dev Settings": Just add pc local address to "Debug server host & port for device" like so 10.0.1.1:8081.
As well adb reverse tcp:8081 tcp:8081 may be required.
In the beginning connect your mobile to pc and run app using react-native run:android command. then run adb shell input keyevent 82 command. It will display a popup window and select Dev Settings.And then go to debug server host &port for device. Then Enter your wifi host ip which is also connect with your PC (use this link to get wifi IP get local IP of the connected wifi)
and get the value of Your Local IP is:*************
and after that IP address add : 8081
if you want to live reload through the wifi use this adb shell input keyevent 82
command and select live reload option.
I had same problem on Windows, I solved it by adding rule for port 8081.
in your case, this may help you:
sudo ufw allow 5555/tcp
What I do when I'm having troubles with the wi-fi connection because my PC at work has firewall rules that changes all the time.
Turn on my "mobile hotspot", to share my connection, with the mobile connected to the wi-fi.
Connect my notebook on the shared network from mobile.
Get the IP that the mobile has generated.
Set "Debug server host & port for device" to that IP at port 8081.
I was able to do without having to connect device and installing app initially.
Open project in Android Studio
Open "Device Manager" in Android Studio
Click "Pair using Wi-Fi" in Device Manager Android Studio
On device -> Settings -> Developer Options -> Wireless debugging -> Enable wireless debugging
On device -> Settings -> Developer Options -> Wireless debugging -> Pair using QR code -> Scan QR code showing in android
Run adb devices from terminal or equivalent to list the device on the same network
run react-native run-android deviceId=xxxxxxxx with xxxxxx the device name of your adb device on same wifi network showing in terminal
There you will have app debuggable from wifi
I had faced the same issue over trying to connect android 4.4 device for debugging with react native application .
you have to disable firewall
then connect over again , it works fine
Happy coding !!
Related
I am trying to use a mobile device to view the app served by create react app. When I open the IP:PORT recommended by CRA's "On Your Network", the page never loads on my mobile device.
I am working on Windows 10 laptop, using WSL2 with Ubuntu. My network is all wifi, no ethernet cables. My code is on the Ubuntu file system and I run npm start from the same location in a WSL terminal from VS Code with the WSL extension.
I am able to see the app using http://localhost:3000 with browsers on my Windows machine (Chrome, Edge).
I noticed cmd.exe ipconfig lists the IP address that corresponds to "On Your Network" as "Ethernet adapter vEthernet (WSL)". This IP address (172.17.144.244) is different than what ipconfig shows as "Wireless LAN adapter Wi-Fi" (192.168.1.23). I also tried 192.168.1.23:3000 on my mobile device, but it didn't work either.
Some other posts on SO recommend removing a firewall setting that blocks NodeJS applications. I scrolled through the many applications listed in the firewall settings and found nothing for NodeJS apps.
Since WSL2 uses a virtual NIC what you need is enable port forwarding in the Firewall otherwise your server in WSL2 won't be seen by external PCs in your network.
I recommend reading the entire thread but in resume you can start using this script:
https://github.com/microsoft/WSL/issues/4150#issuecomment-504209723
I had the same issue. So instead of trying to restart the Windows, try to open the Powershell terminal, shut down the WSL, and then start it again. it solves to me.
Command to shut down: wsl --shutdown
Command to start: to start: wsl
Source: https://github.com/microsoft/WSL/issues/4885#issuecomment-803881561
I found a tool that fixes this problem: https://github.com/icflorescu/expose-wsl
First you need to run the command in the wsl terminal
npx expose-wsl#latest
and it gives you an ip address of your pc 192.168.0.130 for example, with that ip you can access the project from devices on the same network.
When running npm start:
.
.
.
On Your Network: http://172.48.228.88:3000
enter on mobile device:
http://192.168.0.130:3000
and works.
Note: You have to allow the port through the Windows firewall. In my case the firewall should allow access to 'C:\Program Files\WindowsApps\MicrosoftCorporationII.WindowsSubsystemForLinux_1.0.3.0_x64__...\wslhost.exe'
You can run your app in Docker instead and use Docker for Windows, enabled for WSL2. It somehow manages dynamic dynamically forward the ports, without having you to change anything in Windows.
I was also having the problem with hot reloading in WSL2 . I tried almost every solution present on github , stackoverflow and where not , from CHOKIDAR_USEPOLLING=true to setting FAST_REFRESH= false in .env file to changing network setting using netsh.... but none of them worked for me and after 2 days of searching solutions and trying to fix it .. finally reverted to wsl 1.
Just run this command on Powershell for now.
wsl --set-version Ubuntu-20.04 1
Consider Nginx for Windows.
I prefer this solution because I'm more familiar configuring web servers and reverse proxies than Windows networking and Powershell.
After unzipping the distribution, for example at C:\somepath\nginx-1.22.1, I add the following reverse proxy configuration to C:\somepath\nginx-1.22.1\conf\nginx.conf
...
http {
...
server {
listen 11500;
server_name wsl2_server;
charset utf-8;
location / {
proxy_pass http://localhost:11500/;
}
}
...
As you can see, I have a web server running on port 11500 in WSL2. When my mobile device requests "lan_ip_of_laptop:11500/", it then forwards to localhost:11500 and WSL2 server completes the request.
This is probably easy but I am a noob in networks so please help!
Basically I am trying to display lidar points from my Velodyne VLP-16 on ROS installed on Ubuntu 18.04 which is in turn installed via Parallels Desktop on my macOS.
So I plugged the velodyne's ethernet cable to my MacBook via a usb-C-to-ethernet adapter and set this on my mac:
I can type in my browser this address 192.168.1.201 and I can see the velodyne interface. So it works.
When I now go to "Ubuntu on Mac" via Parallels Desktop and do not change anything in Network->Settings->Wired->Connected so I can see these settings:
... I can still see the velodyne interface via a browser on Ubuntu by typing the 192.168.1.201 address as I can on macOS.
The only problem is that when I wanna run
roslaunch velodyne_pointcloud VLP16_points.launch
it says that:
[ INFO] [1592867527.026682801]: Opening UDP socket: port 2368
[ WARN] [1592867528.028658170]: Velodyne poll() timeout
[ERROR] [1592867528.029191798]: DriverNodelet::devicePoll - Failed to poll device.
so it does not work.
I have tried to look up something similar but I failed cos my knowledge in networks is very limited. Following this tutorial I could not get this command through cos it says:
maciej#ubuntu:~$ sudo ifconfig eth0 192.168.3.100
[sudo] password for maciej:
SIOCSIFADDR: No such device
eth0: ERROR while getting interface flags: No such device
Interestingly, when I change the IP address on "Ubuntu on Mac" to this:
I cannot see the Velodyne interface in my browser on Ubuntu, but I still can on my macOS.
I will just add that when I follow the mentioned tutorial on Ubuntu installed on a PC (not via Parallels Desktop on mac), everything works.
Please help bosses!
After a thorough examination of the network traffic both on macOS and on the emulated Ubuntu using Wireshark on both ends, I realised that there is no Network adapter present in the virtual machine configuration.
Following the answer from Desktop Parallel support, I did:
Ubuntu on Mac -> configure -> hardware -> add device -> network 2 -> source: USB...
and when you check now in Wireshark, you will see the traffic coming from the USB adapter and the ROS driver, via an adequate port, will capture the packets.
Device is connected, Package Server is running, there was issue of port 8081,
That's why I started this using react-native run-android and react-native start --port 8089.
But still unable to run my first app
please help, thanks in advance :)
Have the same issue witch happens after every run-android . This line from https://facebook.github.io/react-native/docs/running-on-device-android.html
helps , i press reload and it works but next time -same thing
adb reverse tcp:8081 tcp:8081
or
sudo adb reverse tcp:8081 tcp:8081
There are two ways to connect to development server.
Via wifi if your mobile and pc is in same network.
Via usb cable.
For num 1 go through following checklist.
Check if your machine and mobile device is connected to same wifi network.
Open the react native menu in mobile device by typing this command "adb shell input keyevent 82" (your device must be connected to your machine via usb cable when using this command).
Click the option that stated "dev server" or something like that.
Enter your machines ip address along with the port number. In my case it is 192.168.0.10:8081
Reload the application and bingo.
For number 2 you can enter this command in the terminal "adb reverse tcp:8081 tcp:8081" .That will do the rest.
if you have a virtual device after you run react-native start
open a new terminal and go to your app directory and type adb connect 127.0.0.1:62001 then type adb devices
now you should see your device
after that go to your emulator or real device and shake it(in vitual device ctrl+0) and go to dev setting and ............
How can i access homestead from genymotion emulator ?
i add this line into emulator hosts file, but not work :
192.168.10.10 myapp.app
Here's how I did it on Windows 10:
Check if homestead works
My homestead is running on the ip 192.168.10.10 and has multiple sites. Each have been added to my Windows machine's hosts file to be available from specific domains.
For example in my C:\Windows\System32\drivers\etc\hosts file i have added the following lines:
192.168.10.10 app1.dev
192.168.10.10 app2.dev
This means when browsing http://app1.dev in my Windows machine it should be showing my site. If this is not working for you, then check homestead's official docs how to do this properly. The setup will vary on the version of homestead you are using.
Configure adb for Genymotion
I have Android SDK installed and setup on my Windows machine. You need to configure Genymotion for adb to work from the Windows command line. In Genymotion go to Settings > ADB > Use custom Android SDK tools and browse to your Windows machine's Android SDK directory. For me it was C:/dev/tools/android
Edit emulator devices hosts file
As the emulator is accessing the same network as your Windows machine, then your homestead's ip will also be available from the emulator. Thus you can add the same lines as you added in your Windows machine's hosts file.
1.Open the commandline and run the following commands to edit the hosts file:
adb root
adb remount
adb pull /system/etc/hosts hosts
2.The hosts file should now be present in the folder where you excecuted the pull command. Edit the file with a text editor and add the sites you want to access. For example i added:
192.168.10.10 app1.dev
192.168.10.10 app2.dev
3.Send the hosts file back to the emulator
adb push hosts /system/etc/hosts
4.Browse to your site in the emulator browser. For example: http://app1.dev You should see your homestead site now!
What to try if site is not reached from browser
1.Check that you added an empty line after the last site in the hosts file.
2.Close and reopen the emulator browser
3.Restart the emulator
Homestead runs using virtual box [or vmware] .I have used oracle virtual box .Just to be clear ,it's ubuntu os running on virtual box .So ipv4 of ethernet adapter for virtualbox host only network will work for you .On windows,
open "cmd" and run :
ipconfig
and search for "Ethernet adapter VirtualBox Host-Only Network"
and then ipv4 pest the ip with port no [8000 default],on your emulator's browser .In my case it's.
192.168.56.1:8000
Note: please check if your homestead environment working properly.
My genyotion version is : 2.5.4.
I think you have solved the problem but it may help others, Thank you.
I am trying to open port 22 on osx so I can connect to localhost using ssh. This is my current situation:
ssh localhost
ssh: connect to host localhost port 22: Connection refused
I have generated a key and tossed it into my authorized_keys file like so:
sh-keygen -t dsa -P '' -f ~/.ssh/id_dsa
cat ~/.ssh/id_dsa.pub >> ~/.ssh/authorized_keys
A "Network Utility" port scan confirms that 22 (and surprisingly 23) are closed.
Context: I am working on getting Hadoop set up locally. In my configuration, I am running services on localhost:####s and need to open communications to them via ssh.
How can I open 22? or could I be up against another issue (improperly generated key perhaps?)
I think your port is probably open, but you don't have anything that listens on it.
The Apple Mac OS X operating system has SSH installed by default but
the SSH daemon is not enabled. This means you can’t login remotely or
do remote copies until you enable it.
To enable it, go to ‘System Preferences’. Under ‘Internet & Networking’ there is a ‘Sharing’ icon. Run that. In the list
that appears, check the ‘Remote Login’ option. In OS X Yosemite and up, there is no longer an 'Internet & Networking' menu; it was moved to Accounts. The Sharing menu now has its own icon on the main System Preferences menu. (thx #AstroCB)
This starts the SSH daemon immediately and you can remotely login
using your username. The ‘Sharing’ window shows at the bottom the name
and IP address to use. You can also find this out using ‘whoami’ and
‘ifconfig’ from the Terminal application.
These instructions are copied from Enable SSH in Mac OS X, but I wanted to make sure they won't go away and to provide quick access.
I'm using OSX 10.11.6 and this article works for me.
There are 3 solutions available for these.
1) Enable remote login using below command
- sudo systemsetup -setremotelogin on
2) In Mac, go to System Preference -> Sharing -> enable Remote Login
that's it. 100% working solution
3) Final and most important solution is - Check your private area network connection . Sometime remote login isn't allow inside the local area network.
Kindly try to connect your machine using personal network like mobile network, Hotspot etc.
If you try to enable remote login from a terminal window, you may get a "full disk permission issue". Alternatively, You can enable it from Apple Icon -> System Preferences -> Sharing
I am using Mac-bigSur and this is how I enable it on my machine
You can allow access to specific users also.
As per macOS 10.14.5, below are the details:
Go to
system preferences > sharing > remote login.
I couldn't solve the problem; Then I did the following and the issue was resolved:
Refer here:
sudo launchctl unload -w /System/Library/LaunchDaemons/ssh.plist
(Supply your password when it is requested)
sudo launchctl load -w /System/Library/LaunchDaemons/ssh.plist
ssh -v localhost
sudo launchctl list | grep "sshd"
46427 - com.openssh.sshd