nativescript-cli: Cannot set property 'socket' of null
From @RoyiNamir on August 12, 2018 9:42
After upgrading our project to 4.2 , we’ve experiencing socket connections problems to a real device when tns run android
Worth to mention that tns run android does work with emulators ( both Geny & AVD) , but it doesn’t work with real devices ( my Galaxy s8+ and a colleague’s Galaxy s8 , non rooted regular device)
C:\projects-web-storm\digital\dsapp1>tns info
√ Getting NativeScript components versions information...
√ Component nativescript has 4.2.1 version and is up to date.
√ Component tns-core-modules has 4.2.0 version and is up to date.
√ Component tns-android has 4.2.0 version and is up to date.
× Component tns-ios is not installed.
When tns run android :
we get :
Unable to apply changes on device: ce031713a8d0149e0d. Error is: Socket connection timeouted..
Executing after-watch hook from C:\projects-web-storm\digital\dsapp1\hooks\after-watch\nativescript-dev-sass.js
Executing after-watch hook from C:\projects-web-storm\digital\dsapp1\hooks\after-watch\nativescript-dev-typescript.js
Stopping tsc watch
Executing after-watch hook from C:\projects-web-storm\digital\dsapp1\hooks\after-watch\nativescript-dev-webpack.js
TypeError: Cannot set property 'socket' of null
at Timeout.tryConnect [as _onTimeout] (C:\Users\royin\AppData\Roaming\npm\node_modules\nativescript\lib\services\livesync\android-livesync-tool.js:298:51)
at ontimeout (timers.js:482:11)
at tryOnTimeout (timers.js:317:5)
at Timer.listOnTimeout (timers.js:277:5)
–> Video showing the problem <–
The app IS installed but not invoked. ( it used to work) before upgrade. We have to tap the launch icon in order to see the app running PackageID is the same in all files ( manifest / packagejson)
BTW - if you want a real project that produces it , I can send privately.
Windows machine , Android , Antivirus & firewall is disabled , uninstalled App from device.
Copied from original issue: NativeScript/NativeScript#6180
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Comments: 32 (20 by maintainers)
@tsonevn This also happens when the nativescript id in
package.jsonis different from one in the manifest / gradle file. I had to keep them different as I wanted different package names for iOS & Android.Hi @shiv19 , I have doubled the time we wait for the socket connection to be established in the master branch. You can try the fix with the
nextversion. Just install CLI like thisnpm i -g nativescript@next.If that doesn’t help please check if the application is started on the device, before the message appears. If the application is not started at all unify the values of 1
nativescript.idkey inpackage.json2applicationIdinapp/App_Resources/Android/app.gradle3appIdinapp/App_Resources/Android/settings.json(this one might not exist if you don’t use NS Sidekick) It they are different the CLI can’t work properly.@tsonevn Im still getting the error after upgrading to 4.2.4. Any workaround for this issue?
Hey everyone, We’ve merged an improvement in the error message shown by CLI in this case that suggests some ideas what might cause the error. The new message is available in CLI’s rc version (
npm i -g nativescript@rc) and should be released with CLI 6.3.3 version.@nwalker See that 3rd point in previous reply. That explains how we have settings.json in that project. I used sidekick on that project recently when we changed the icons.
@tsonevn @DimitarTachev Hope this log file helps. 🤞🏻 log.txt
@RoyiNamir, the app id clarification was related to the “org.nativescript.apps-livesync” comments above. That’s just a socket related string containing the app id concatenated with “-livesync” and it’s not causing the exception.
Regarding your specific problem, you should be also able to use
xxx.myApp.Somethingwith NativeScript 4.2.2 but as I already mentioned, the lowercase package name is the recommended approach 😃We will need more info from @farfromrefug and @nikopolv in order to further investigate their issues as I don’t believe thay are related to custom activities with some strange naming. I hope we will get more details for the
failed to connect to socket 'localabstract:org.nativescript.apps-livesync': Connection refusederror from their trace logs.@Fatme @tsonevn I am still seeing this with 4.2.2 The first run works. But then if I run it again it fails. In my logcat I keep on seeing this: failed to connect to socket ‘localabstract:org.nativescript.apps-livesync’: Connection refused
I am getting this almost all the time 😒 I can’t even update my apps.
Happening on emulator and device