Crashlytics connection refused - failed to connect to failed to connect to api.crashlytics.com

Hemal from Crashlytics here. Can you check if any ad-blocking software is interfering with the connection?


I had the same problem on Xiaomi M4. As was mentioned above if you don't have any ad-blocking application then the main reason is /ets/hosts file.

You can check this guess from command line:

adb shell # run a shell there
cat /etc/hosts | grep crashlytics # print file content and filter it by 'crashlytics' word

and if you see something like this list of lines then it's that problem which you are looking for:

127.0.0.1 api.crashlytics.com
127.0.0.1 apps.crashlytics.com
127.0.0.1 beta.crashlytics.com
127.0.0.1 blog.crashlytics.com
127.0.0.1 calendar.crashlytics.com
127.0.0.1 crashlytics.com
127.0.0.1 docs.crashlytics.com
127.0.0.1 download.crashlytics.com
127.0.0.1 e.crashlytics.com
127.0.0.1 report.crashlytics.com
127.0.0.1 reports.crashlytics.com
127.0.0.1 settings.crashlytics.com
127.0.0.1 support.crashlytics.com
127.0.0.1 try.crashlytics.com
127.0.0.1 www.crashlytics.com

To fix this problem you should comment them. The idea how to do that I found here, but I couldn't edit file by vi. So I just pulled, changed and pushed back the hosts file. Be attentive: your device must be rooted to do this.

adb pull /etc/hosts ./<your_computer_directory> # get hosts file from device 

just comment lines like this:

#127.0.0.1 api.crashlytics.com
#127.0.0.1 apps.crashlytics.com
#127.0.0.1 beta.crashlytics.com
#127.0.0.1 blog.crashlytics.com
#127.0.0.1 calendar.crashlytics.com
#127.0.0.1 crashlytics.com
#127.0.0.1 docs.crashlytics.com
#127.0.0.1 download.crashlytics.com
#127.0.0.1 e.crashlytics.com
#127.0.0.1 report.crashlytics.com
#127.0.0.1 reports.crashlytics.com
#127.0.0.1 settings.crashlytics.com
#127.0.0.1 support.crashlytics.com
#127.0.0.1 try.crashlytics.com
#127.0.0.1 www.crashlytics.com

You can't push it back without root rules. So push it into some tmp user directory:

adb push ./<your_computer_directory>/hosts /mnt/sdcard/hosts

Then enter as root and replace /etc/hosts file:

adb shell # run a shell there
su # become the root (don't miss confirmation request!)
mount -o remount,rw /system # allow to write
cp /mnt/sdcard/hosts /etc/hosts
rm /mnt/sdcard/hosts
mount -o remount,ro /system # get things back to normal
exit # unroot
nslookup YourBlockedAdSite.Net # check if it works
exit # good bye

Profit!


Faced same problem, AdAway blocked crashlytics.com. Just added this host to white list.