(v20 update error) Uncaught Error: Java.net.ConnectException: Failed to connect to localhost ~

#1

Hi,

Once I ‘open on Android’, this screen pops up.

If I click the ‘view error log’
Screenshot from 2017-08-24 19-03-52

  • I confirmed that internet on emulator is online.
  • I deleted cache and data but still doesn’t work.

Any other suggestion?

I haven’t continued to develop my app since v20 update :disappointed_relieved:

Thanks

0 Likes

#2

I could open the browser of http://localhost:19001/
Here is the output

{“name”:“app name”,“description”:“No description”,“slug”:“stylee”,“privacy”:“public”,“sdkVersion”:“19.0.0”,“version”:“1.0.0”,“orientation”:“portrait”,“primaryColor”:"#cccccc",“icon”:"./assets/icons/app-icon.png",“notification”:{“icon”:"./assets/icons/notification-icon.png",“color”:"#000000",“iconUrl”:“http://localhost:19002/assets/./assets/icons/notification-icon.png"},“loading”:{“icon”:"./assets/icons/loading-icon.png",“hideExponentText”:false,“iconUrl”:“http://localhost:19002/assets/./assets/icons/loading-icon.png”},“packagerOpts”:{“hostType”:“tunnel”,“lanType”:“ip”,“dev”:true,“strict”:false,“minify”:false,“urlType”:“exp”,“urlRandomness”:“y9-g46”},“ios”:{“supportsTablet”:true},“xde”:true,“developer”:{“tool”:“xde”},“env”:{},“bundleUrl”:“http://localhost:19002/node_modules/expo/AppEntry.bundle?platform=ios&dev=true&strict=false&minify=false&hot=false&assetPlugin=expo/tools/hashAssetFiles”,“debuggerHost”:“localhost:19002”,“mainModuleName”:“node_modules/expo/AppEntry”,“logUrl”:“http://localhost:19001/logs”,“iconUrl”:"http://localhost:19002/assets/./assets/icons/app-icon.png”}

0 Likes

#3

Have you run adb reverse for your emulator?

1 Like

#4

For `adb reverse’,

Android Debug Bridge version 1.0.32
Revision debian

 -a                            - directs adb to listen on all interfaces for a connection
 -d                            - directs command to the only connected USB device
                                 returns an error if more than one USB device is present.
 -e                            - directs command to the only running emulator.
                                 returns an error if more than one emulator is running.
 -s <specific device>          - directs command to the device or emulator with the given
                                 serial number or qualifier. Overrides ANDROID_SERIAL
                                 environment variable.
 -p <product name or path>     - simple product name like 'sooner', or
                                 a relative/absolute path to a product
                                 out directory like 'out/target/product/sooner'.
                                 If -p is not specified, the ANDROID_PRODUCT_OUT
                                 environment variable is used, which must
                                 be an absolute path.
 -H                            - Name of adb server host (default: localhost)
 -P                            - Port of adb server (default: 5037)
 devices [-l]                  - list all connected devices
                                 ('-l' will also list device qualifiers)
 connect <host>[:<port>]       - connect to a device via TCP/IP
                                 Port 5555 is used by default if no port number is specified.
 disconnect [<host>[:<port>]]  - disconnect from a TCP/IP device.
                                 Port 5555 is used by default if no port number is specified.
                                 Using this command with no additional arguments
                                 will disconnect from all connected TCP/IP devices.

...

when I run adb reverse tcp:8081 tcp:8081,
it prints
1)

adb server is out of date.  killing...
* daemon started successfully *
** daemon still not running
error: cannot connect to daemon: Connection refused
error: cannot connect to daemon: Connection refused
adb server is out of date.  killing...
* daemon started successfully *
  1. or nothing.

thanks for the support…!!

0 Likes

#5

If anyone is encountering is this issue,

  1. from your console, adb reverse tcp:8081 tcp:8081
  2. Restart your project and emulator. (Do this until you don’t see the error anymore)

Seems like Expo solved this issue on update. :slight_smile:

So happy

0 Likes