Connection problem in android app and server


Following instructions in , given sample android application works fine but when using it for locally hosted it doesn't connect to my server

Updated in android source code
final String COUNTLY_SERVER_URL = "";
final String COUNTLY_APP_KEY = "ca312d765a02280c675d5b38181d1a72f99e2537"; //test server
Countly.sharedInstance().init(appC, COUNTLY_SERVER_URL, COUNTLY_APP_KEY);

What is wrong and what is missing in either server configuration or android application?
or Is DNS mandatory ?


So this address is only local for your computer. You can use this only on your computer.

As app is probably running outside your computer, you would need to use your computers IP address for that network where device is connected. So if your computer and device are both in same local network, you can use your local network ip address.
If device is outside your network, then you would need to use your external ip address and additionally probably open up ports, if they are not open already.

That is why local installations are bad (and we can't provide support for local network configurations), an they would not really work in real life scenarios and it is recommended to better get a virtual machine on cloud or something like that and test with that.


I am using single computer and Ubuntu is installed in virtual machine/box and it uses same IP. For android I am using virtual device to test it


Can you connect to your Ubuntu server from Android using via a sample Android app?


No that is what I am stuck with. Application in Android Virtual device on the same computer was unable to connect with countlly server hosted in Ubuntu installed on virtual box. I also tried to connect via Android phone and changed IP like using wifi i.e. same network but no success.

Can some one please tell which port countly uses as i need to add with IP to check out once more.
I think problem might be in project configuration of countlly server.


Yes, so possibly Virtual Box is probably the key here.

It should have separate network interface and thus different IP address. So your Android Virtual device and Countly are not on the same computer, so they can't connect through localhost. You need to find IP address of Virtual box in the Lan.

In similar way you can try to access Countly through browser on your real computer not Virtual, it should not work.

But as I said, if you are going to track real apps with real users, there is no way this would work, so maybe save yourself some trouble and try proper setup with remote server for Countly