Nativescript Socket connection timeouted

徘徊边缘 提交于 2019-12-24 09:16:19

问题


Recently I have started facing a strange issue with Nativescript. When I try to run the android application using tns run android I get following error message

Unable to apply changes on device: HQ64MZ576132. Error is: Socket connection timeouted..

I dont know how to identify the actual issue. To fix this issue, I need to copy app folder from another working nativescript application and then replace all the file from repository and eventually I am back to normal running application. Following is what I am trying to figure out:

  1. How to identify what is causing Socket connection timeouted?
  2. Why replacing the whole app solves the issue even when the files are exactly same which doesnt make sense to me?

Following is my package.json

{
  "description": "NativeScript Application",
  "license": "SEE LICENSE IN <your-license-filename>",
  "readme": "NativeScript Application",
  "repository": "<fill-your-repository-here>",
  "nativescript": {
    "id": "com.travel",
    "tns-android": {
      "version": "5.0.0"
    }
  },
  "scripts": {
    "lint": "tslint \"app/**/*.ts\""
  },
  "dependencies": {
    "nativescript-admob": "^1.4.2",
    "nativescript-appversion": "^1.4.1",
    "nativescript-exit": "^1.0.1",
    "nativescript-grid-view": "^3.4.0",
    "nativescript-purchase": "^2.0.5",
    "nativescript-social-share": "^1.5.0",
    "nativescript-theme-core": "1.0.4",
    "nativescript-toast": "^1.4.6",
    "nativescript-ui-chart": "^3.8.0",
    "nativescript-ui-sidedrawer": "^3.5.1",
    "rxjs": "5.5.2",
    "tns-core-modules": "^5.0.0"
  },
  "devDependencies": {
    "awesome-typescript-loader": "~3.1.3",
    "babel-traverse": "6.4.5",
    "babel-types": "6.4.5",
    "babylon": "6.4.5",
    "copy-webpack-plugin": "~4.3.0",
    "css-loader": "^0.28.11",
    "extract-text-webpack-plugin": "~3.0.2",
    "lazy": "1.0.11",
    "nativescript-dev-sass": "1.3.5",
    "nativescript-dev-typescript": "0.5.1",
    "nativescript-dev-webpack": "^0.16.2",
    "nativescript-worker-loader": "~0.8.1",
    "raw-loader": "~0.5.1",
    "resolve-url-loader": "~2.2.1",
    "sass-loader": "^6.0.7",
    "tns-platform-declarations": "^4.2.0",
    "tslint": "5.8.0",
    "typescript": "2.8.4",
    "uglifyjs-webpack-plugin": "~1.1.6",
    "webpack": "^3.12.0",
    "webpack-bundle-analyzer": "^2.13.1",
    "webpack-sources": "~1.1.0"
  }
}

Thanks


回答1:


This has been a nasty issue which ate most of my days. It was nativescript-admob plugin which was causing application to break. Version 17.0.0 of Google Mobile Ads SDK requires tag in AndroidManifest.xml. You can find more info here https://developers.google.com/admob/android/quick-start#update_your_androidmanifestxml. There is open issue https://github.com/EddyVerbruggen/nativescript-admob/issues/45 which has a temp. You will have to add following line to AndroidManifest.xml

<application>
    <!-- this line needs to be added (replace the value!) -->
    <meta-data android:name="com.google.android.gms.ads.APPLICATION_ID" android:value="ca-app-pub-3940256099942544~3347511713" />

    <activity></activity>
</application>


来源:https://stackoverflow.com/questions/53134843/nativescript-socket-connection-timeouted

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!