在Android上运行NativeScript应用程序时出错

时间:2018-11-02 11:58:06

标签: nativescript nativescript-cli

  

线程“ main”中的异常java.io.IOException:文件已存在。这可能会导致不良行为。
  请更改扩展类之一的名称。

screenshot on Windows

在这里,我使用的是使用JavaScript的nativescript。当我运行tns run android时出错

File:E:\project\mobile application\ngasceapp\platforms\android\app\sr
lete\AutoCompleteAdapter_autocomplete_63_32_AutoCompleteAdapter.java

我删除了hook,node_module和platform文件夹,并尝试仍然遇到相同的错误。

这是package.json文件

 {
      "description": "Application",
      "license": "SEE LICENSE IN <your-license-filename>",
      "readme": "NativeScript Application",
      "repository": "<fill-your-repository-here>",
      "nativescript": {
        "id": "com.max.sagar",
        "tns-ios": {
          "version": "5.0.0-rc-2018-10-11-110051-01"
        },
        "tns-android": {
          "version": "4.2.0"
        }
      },
      "scripts": {
        "lint": "eslint \"app/**/*.js\""
      },
      "dependencies": {
        "moment": "2.22.2",
        "moment-timezone": "^0.5.21",
        "nativescript-accordion": "^5.0.4",
        "nativescript-appavailability": "^1.3.1",
        "nativescript-appversion": "^1.4.1",
        "nativescript-calendar": "^2.0.0",
        "nativescript-cardview": "3.1.1",
        "nativescript-cfalert-dialog": "^1.0.11",
        "nativescript-checkbox": "^3.0.3",
        "nativescript-dev-sass": "^1.6.0",
        "nativescript-email": "1.5.3",
        "nativescript-exoplayer": "^3.4.1",
        "nativescript-fancyalert": "2.0.0",
        "nativescript-floatingactionbutton": "4.1.4",
        "nativescript-fresco": "5.0.0",
        "nativescript-image-cache-it": "^4.0.4",
        "nativescript-insomnia": "1.2.2",
        "nativescript-iqkeyboardmanager": "^1.3.0",
        "nativescript-loading-indicator": "^2.4.0",
        "nativescript-local-notifications": "^2.0.3",
        "nativescript-openfile": "0.0.11",
        "nativescript-orientation": "2.2.1",
        "nativescript-pdf-view": "^2.0.1",
        "nativescript-permissions": "^1.2.3",
        "nativescript-phone": "^1.3.1",
        "nativescript-screen-orientation": "^2.0.0",
        "nativescript-sqlite": "2.2.3",
        "nativescript-theme-core": "^1.0.4",
        "nativescript-ui-autocomplete": "^3.9.0",
        "nativescript-ui-calendar": "^3.6.0",
        "nativescript-ui-dataform": "3.7.3",
        "nativescript-ui-listview": "^3.7.2",
        "tns-platform-declarations": "^4.2.1"
      },
      "devDependencies": {
        "awesome-typescript-loader": "~5.2.1",
        "babel-traverse": "^6.26.0",
        "babel-types": "^6.26.0",
        "babylon": "6.18.0",
        "clean-webpack-plugin": "~0.1.19",
        "copy-webpack-plugin": "~4.5.3",
        "css-loader": "~1.0.0",
        "eslint": "~5.7.0",
        "extract-text-webpack-plugin": "~3.0.2",
        "fs-extra": "^7.0.0",
        "grunt-cache-bust": "^1.7.0",
        "lazy": "1.0.11",
        "nativescript-dev-typescript": "^0.7.4",
        "nativescript-dev-webpack": "^0.16.2",
        "nativescript-worker-loader": "~0.9.1",
        "raw-loader": "~0.5.1",
        "resolve-url-loader": "~3.0.0",
        "sass-loader": "7.1.0",
        "typescript": "^2.8.3",
        "uglifyjs-webpack-plugin": "2.0.1",
        "webpack": "^4.20.2",
        "webpack-bundle-analyzer": "3.0.2",
        "webpack-sources": "1.3.0"
      }
    }

2 个答案:

答案 0 :(得分:1)

nativescript-ui-dataform插件本身具有nativescript-ui-autocomplete@3.9.0作为依赖项。您的nativescript-ui-autocomplete中有package.json作为依赖项,带有^符号,它将安装最新的主要版本3.10.1。因此,您将拥有2个相同插件的版本,这就是问题的原因。

请尝试删除该^符号并将其保留为3.9.0

来源:https://github.com/telerik/nativescript-ui-feedback/issues/802#issuecomment-415662716

答案 1 :(得分:0)

签入您的node_module文件夹。

nativescript-ui-dataform和nativescript-ui-listview也具有node_modules。 删除它们并运行tns再次运行android。

由于这两个组件都具有自动完成功能的依赖性,因此您具有相同的多个副本。