Skip to content
This repository was archived by the owner on Apr 4, 2023. It is now read-only.

Android: Unable to apply changes on device: emulator-xxxx. Error is: Socket connection timed out #1425

Open
felixkrautschuk opened this issue Oct 5, 2019 · 18 comments

Comments

@felixkrautschuk
Copy link

felixkrautschuk commented Oct 5, 2019

The problem seems to be related to the android runtime, because our app used to work when we used tns-android 6.1.0.
After upgrading to tns-android 6.1.1 (and also 6.1.2), the app gets installed on device (or emulator), but then you just see the splash screen for a while, then you see the error message

Installing on device emulator-5554...
Successfully installed on device with identifier 'emulator-5554'.
Unable to apply changes on device: emulator-5554. Error is: Socket connection timed out..

Steps to reproduce:

@loonatic
Copy link

loonatic commented Oct 6, 2019

I'm having this issue aswell. Either on an upgraded project (from 5.4 to 6.1) either on a clean new 6.1 project. Removing the platform folder and doing "tns platform add android@latest" or "tns run android" throws socket timeout.

@EddyVerbruggen
Copy link
Owner

Thanks for reporting this, but I don't know what to do about it. Perhaps your emulator is running out of disk space? Try uninstalling some apps to be sure. And does it happen on a real device as well?

@felixkrautschuk
Copy link
Author

@EddyVerbruggen thanks for your fast reply.
Yes, this is producable on all emulators and physical devices.

@EddyVerbruggen
Copy link
Owner

Did you report your findings in the Android Runtime NativeScript repo? Or maybe there's an issue there already? I really don't know how to help as I can't reproduce this on my machine with your steps, unfortunately.

@felixkrautschuk
Copy link
Author

Right now, there is only this issue in the nativescript-cli repo.
Then I noticed that everything works as expected after uninstalling the firebase-plugin and after rebuilding the app. And I could recreate the whole scenario with your demo-app, so that's why I created this issue here. Strange, that it works for you wothout any problems.

@loonatic
Copy link

loonatic commented Oct 6, 2019

If it helps @EddyVerbruggen, my steps to reproduce it are:

  • deleting platforms folder;
  • changing android version manually to 6.1.1 or 6.1.2 in "package.json" file;
  • executing the "tns run android" command.

@mpsdevs
Copy link

mpsdevs commented Oct 7, 2019

Hey, I am experiencing a similar issue. After installing the nativescript-firbase-plugin (following your video tutorial), I was able to successfully run the app on the iOS simulator, with no worries initializing firebase. However, tns run android does not get past installing the device on the emulator, and the build errors out with a socket connection time out. The app does not start up as I do not get the console.log in my app.component.ts!

Please let me know what additional info I can provide. I did try increasing the memory of my AVD. I do not have Crashlytics or admobs enabled so it does not look like it's either of those services causing it either!

Screen Shot 2019-10-06 at 7 47 25 PM

@felixkrautschuk
Copy link
Author

@EddyVerbruggen are you working on a mac?
I just noticed that this issue orrcurs only when building and building the app on a Windows machine. When doing that on a mac, everything works as expected.

@EddyVerbruggen
Copy link
Owner

@felix-idf Yes I do.

@EddyVerbruggen
Copy link
Owner

@vtrifonov That fix looks promising, thanks!

@Ianc22
Copy link

Ianc22 commented Nov 2, 2019

My two cents. this has been doing my head in for the past week, finally discovered today after pulling the project apart it's when enabling crashlytics as an option, had to disable it for the time being.

App must be crashing on load, shows the splash screen and then just sits there, and then the connection to the emulator eventually times out.... There are no errors logged, which has made this very difficult to track. Not sure how you gonna fix this!

FYI: tns6 update btw... and, like mentioned by @felixkrautschuk this is only happening on Android

@Ianc22
Copy link

Ianc22 commented Nov 2, 2019

Could this possibly be the issue? I've tried setting the version using buildscript.grade but it seems the hooks are overwriting it (not sure, speculating)

According to the documentation below the version used should be :
classpath 'io.fabric.tools:gradle:1.31.2' // Crashlytics plugin

build.gradle spits put
classpath "io.fabric.tools:gradle:1.26.1"

https://firebase.google.com/docs/crashlytics/get-started?platform=android

crashlytics - fabric bug

@Ianc22
Copy link

Ianc22 commented Nov 3, 2019

I can confirm reverting back to 6.1.0 fixes it (for the time being :P)

@Ianc22
Copy link

Ianc22 commented Nov 5, 2019

Hey @EddyVerbruggen

I've done some more digging and found the following, This issue went un noticed for months, it was only when having to clone the project when the issue became apparent.

So, upgraded to android tns 6.1.1 about a month ago and 6.1.2 soon after and obviously had the app running all through that time.

It turns out, having platforms prepared on 6.1.0 and then upgrading to >6.1.1 there are no issues. I've tried tns prepare --force after the upgrades and still it runs without issue.

As soon as I remove platforms though and re build on >6.1.1 we have the behavior pointed out in this issue...

And to confirm still crashlytics...

Hope that helps!

@Ianc22
Copy link

Ianc22 commented Nov 5, 2019

OK so seems a CLI issue,

This fixed it for me!
NativeScript/nativescript-cli#5031 (comment)

@gambheera
Copy link

@EddyVerbruggen Any luck from this issue? Still suffering from this issue and it is a blocker for me to go ahead... :( :( :(

@adekunle11
Copy link

@EddyVerbruggen I have this same issue, i've updated to tns android 6.3.1. plugin version 10.3.3

@NazimMertBilgi
Copy link

I got the same error on Android. I saw that the mistake was caused by Crashlytcs. I removed the plug-in and installed it again and ran npm run config in the corresponding folder. crashlytcs: false

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants