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 ............
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.
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 !!
I'm using appcelerator studio version 4.6.0.201605201934
I'm using a nexus 6P, and windows 10
The phone has debugging enabled, and has MTP mode selected. File-Explorer detects the phone each time it is plugged in and tries to download photos from it.
I have put the google USB folder in the android/sdk/extras/google/usb_driver folder
I can see my device on the command prompt by going to the android/sdk folder
adb devices -l
HOWEVER when i go to appcelerator studio, it does not find the phone - the "run configurations" has an empty list of phones to choose from, and running it leads to it informing me that there is no device connected.
What am I doing wrong?
Have you tried to run the kill-server, and devices commands with the adb path?
In my case:
bash-3.2$ /Applications/Android/android-sdk-macosx/platform-tools/adb kill-server
bash-3.2$ /Applications/Android/android-sdk-macosx/platform-tools/adb devices
List of devices attached
* daemon not running. starting it now on port 5037 *
* daemon started successfully *
If this still doesn't solve your problem, try to add the Vendor ID of the device to the adb_usb.ini file, usually placed:
Windows: C:\Users\YourUser\.android
Mac OS: ~/.android
You can find the Vendor ID at the hardware info on Mac OS here: /Applications/Utilities/System Information
There is also a list of Vendor IDs at the android documentation: https://developer.android.com/studio/run/device.html
Your file will look, like this:
# ANDROID 3RD PARTY USB VENDOR ID LIST -- DO NOT EDIT.
# USE 'android update adb' TO GENERATE.
# 1 USB VENDOR ID PER LINE.
0x18d1
I have been using Titanium for some time and I also have the same issue regardless of what device or USB port I use. I even have the issue with simulators.
So I do the following instead:
# Install the application (replacing the existing one if it exists)
adb install -r build/android/bin/YOURAPP.apk
# Run the application (you could also just open the application on your phone)
adb shell am start -n com.package.name/com.package.name.ActivityName
# Show logs
adb logcat "TiAPI:*" "*:S"
The adb tool can be found in windows 10 at this path
/Users/username/AppData/Local/Android/sdk/platform-tools/adb.exe
The activity name can be found in the build/android/AndroidManifest.xml file.
It's usually: YourAppNameActivity
More information about logcat can be found here:
https://logmatic.io/blog/a-how-to-guide-to-debugging-with-android-logcat/
https://developer.android.com/studio/command-line/logcat.html
I have just installed docker using docker-toolbox 1.8.2 on Windows 10.
Due to due to this issue I had to recreate the docker image using these commands
docker-machine rm default
docker-machine --native-ssh create -d virtualbox default
After that it has been working fine, except for one problem:
When the PC has gone to sleep and then wakes again, the docker commands can no longer connect. Example:
> docker images
An error occurred trying to connect: Get https://192.168.99.100:2376/v1.20/images/json:
dial tcp 192.168.99.100:2376: ConnectEx tcp: A connection attempt failed because the
connected party did not properly respond after a period of time, or established connection
failed because connected host has failed to respond.
However the docker-machine lists the machine as running:
> docker-machine ls
NAME ACTIVE DRIVER STATE URL SWARM
default * virtualbox Running tcp://192.168.99.100:2376
I can also confirm in VirtualBox that the VM screen seems to be active.
I have tried starting and stopping the machine, but that does not help
C:\x> docker-machine stop default
C:\x> docker-machine start default
Starting VM...
Started machines may have new IP addresses. You may need to re-run the `docker-machine env` command.
C:\x> docker-machine env default --shell=powershell
Ironically, the last command hangs, so I never get any environment settings.
The only thing that helps is to restart the whole PC. But that should be unnecessary?
I have also posted this as an issue on the docker github repository,but that was closed. A related issue seems to be this one, but no workaround or solution has been posted for Windows.
After hous of fighting with VirtualBox + Docker Toolbox, I finally found the way, how to make Docker working again (even without restarting all the containers):
Wake up PC from sleep
Try docker images (won`t work)
Open VirtualBox -> Close VM with saving state (CTRL+V)
Run your VM again
Try docker images again (now should work)
Please note: All steps are in VirtualBox only! Running docker-machine restart default will create another host-only adapter, which is something you do not want. If you did it anyway, delete all additionally created adapters (File->Preferences->Network on VirtualBox), then follow steps 1-5.
I have experienced the exact same symptoms on Windows 8.1... The thing is that it's not really a docker-specific issue, but more how Windows manages the VirtualBox network adapters after sleep (I think...). The culprit in my case is that the network adapter's addresses were becoming private after sleep (they became 169.* addresses).
Credits to this guy who gave me the idea: http://lyngtinh.blogspot.ca/2011/12/how-to-disable-autoconfiguration-ipv4.html
Fix:
Start a command prompt as Administrator
Find out the "useful" network adapters: ipconfig /all. The useful ones in my case were the ones labeled "VirtualBox Host-Only Ethernet Adapter" that didn't have private ips (not starting with 169.*).
Run this command and note the "Idx" of the useful VirtualBox network adapters: netsh interface ipv4 show inter.
Run this command to disable the IP auto configuration: netsh interface ipv4 set interface <idx> dadtransmits=0 store=persistent. Replace <idx> with each index found in the previous step.
Restart Windows
Afterwards, I was able to docker-machine start default, then docker-machine env default --shell cmd, put the PC to sleep, wake up and run docker-machine env default --shell cmd again.
I found that removing 'host only adapter' (File->Preferences->Network on VirtualBox), and restart the docker-machine helps.
Not a real solution. But probably better over restart the computer.
Having tried all the other answers here, and having varying but not consistent success, the following seems to reliably bring it back for me after this problem occurs.
Open a powershell/command window (I have most success if I run all docker-machine commands in a powershell window opened as administrator, I don't know if that's important or not) then run (where "dev" is the name of your docker machine instance):
docker-machine ssh dev
Then on the terminal that is opened, run:
sudo shutdown -r now
When the machine restarts, it seems to refresh the network and work correctly. Note, however, that simply running docker-machine restart dev did not have the same effect for me.
Your machine needs to be running before you can do the ssh, so if it's not running, execute docker-machine start dev before trying to SSH.
Had the same problem on Windows 8.1 and docker toolbox 1.12.0
None of the above solutions worked for me, too.
[edited]
Found another way to make docker work after system wake up:
In the docker Quickstart Terminal window, stop docker process Ctrl-C (if it is still running)
Run command docker-compose down
Shut down docker with docker-machine stop default
Exit terminal window Ctrl-D
Run Quickstart Terminal again and do all subsequent steps you need.
This worked for me, on Windows host machine.
Configure your network adapter to
1) Allow the network adapter to wake the computer,
2) Allow a magic packet to wake the computer,
3) Allow IPV6
http://www.worldstart.com/dropped-internet-connection-in-sleep-mode/
Also, on virtual box network settings, go to advanced, and allow promiscuous mode to VM machines, or allow all