The preview app on Android won't connect to the server

Which IP addresses are listed on the connection refused screen? And what’s the output of ifconfig on your computer?

Can you also, while local preview is running, do telnet localhost 12124 and telnet <your public ip> 12124 and report what happens in both cases? Ideally both should look like this:

$ telnet 192.168.1.135 12124
Trying 192.168.1.135...
Connected to 192.168.1.135.
Escape character is '^]'.
                                       < -- here I press enter
Connection closed by foreign host.

Ok:
Which IP addresses are listed on the connection refused screen?
127.0.0.1:12124: Connection refused
192.168.1.12:12124: No route to host

And what’s the output of ifconfig on your computer?

lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> mtu 16384
	options=1203<RXCSUM,TXCSUM,TXSTATUS,SW_TIMESTAMP>
	inet 127.0.0.1 netmask 0xff000000 
	inet6 ::1 prefixlen 128 
	inet6 fe80::1%lo0 prefixlen 64 scopeid 0x1 
	nd6 options=201<PERFORMNUD,DAD>
gif0: flags=8010<POINTOPOINT,MULTICAST> mtu 1280
stf0: flags=0<> mtu 1280
en0: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
	ether 84:38:35:4f:99:0e 
	inet6 fe80::14a2:60da:6491:286b%en0 prefixlen 64 secured scopeid 0x4 
	inet 192.168.1.12 netmask 0xffffff00 broadcast 192.168.1.255
	inet6 2a01:cb04:137:6200:c86:b612:3fb9:cd7b prefixlen 64 autoconf secured 
	inet6 2a01:cb04:137:6200:e9a3:cca3:ed8c:c20e prefixlen 64 autoconf temporary 
	nd6 options=201<PERFORMNUD,DAD>
	media: autoselect
	status: active
en1: flags=963<UP,BROADCAST,SMART,RUNNING,PROMISC,SIMPLEX> mtu 1500
	options=60<TSO4,TSO6>
	ether 32:00:12:cf:60:00 
	media: autoselect <full-duplex>
	status: inactive
bridge0: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
	options=63<RXCSUM,TXCSUM,TSO4,TSO6>
	ether 32:00:12:cf:60:00 
	Configuration:
		id 0:0:0:0:0:0 priority 0 hellotime 0 fwddelay 0
		maxage 0 holdcnt 0 proto stp maxaddr 100 timeout 1200
		root id 0:0:0:0:0:0 priority 0 ifcost 0 port 0
		ipfilter disabled flags 0x2
	member: en1 flags=3<LEARNING,DISCOVER>
	        ifmaxaddr 0 port 5 priority 0 path cost 0
	nd6 options=201<PERFORMNUD,DAD>
	media: <unknown type>
	status: inactive
p2p0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 2304
	ether 06:38:35:4f:99:0e 
	media: autoselect
	status: inactive
awdl0: flags=8943<UP,BROADCAST,RUNNING,PROMISC,SIMPLEX,MULTICAST> mtu 1484
	ether 12:e6:8f:f5:5b:ab 
	inet6 fe80::10e6:8fff:fef5:5bab%awdl0 prefixlen 64 scopeid 0x8 
	nd6 options=201<PERFORMNUD,DAD>
	media: autoselect
	status: active
utun0: flags=8051<UP,POINTOPOINT,RUNNING,MULTICAST> mtu 2000
	inet6 fe80::304c:ff75:4b66:33c7%utun0 prefixlen 64 scopeid 0x9 
	nd6 options=201<PERFORMNUD,DAD>

while local preview is running,

telnet localhost 12124: OK

telnet my_public_ip 12124:

telnet: connect to address my_public_ip: Operation timed out
telnet: Unable to connect to remote host

This means that Fuse is able to build the project just fine, and it’s able to start the server on port 12124. We’ve also ruled out that this has anything to do with your phone, or the connection between your phone and your computer. The only question left is why the server is not able to accept connections on your public IP.

I’m starting to run out of ideas here. Are you 100% sure that your firewall is off, and that you don’t have any other rules or configurations set up that could block this? Could you perhaps try to reboot your computer?

Ok, it worked with the empty project (after a first failed attempt).
With my full project (14Mb) I’m getting :

127.0.0.1:12124: Connection refused
192.168.1.12:12124: Reached end of stream

Ok, if the empty app worked, can you see if one created with fuse create example MyExample works too?

Also, can you please run the following diagnostic on your full project:
fuse host-preview --compile-only <name of unoproj>?

Yes:

The example project works on the device.

I get errors as if packages were missing, for example:

MainView.uno(17.45): E3107: Uno.Permissions.Permissions does not contain a member called 'Request'. Could you be missing a package reference?
MainView.uno(17,46,17,53): Error E3107: Uno.Permissions.Permissions does not contain a member called 'Request'. Could you be missing a package reference?

Right, it looks like I’ve missed what’s the actual problem here. It looks like the problem is that you have added some target specific code that doesn’t build for the .net target. You need to make sure your project compiles in local preview first.

I see, will try to solve those errors first (in another post then); thanks !