【问题标题】:Error while running nativescript application on Android在 Android 上运行 nativescript 应用程序时出错
【发布时间】:2019-04-06 16:12:26
【问题描述】:

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

这里我使用的是使用 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 和平台文件夹并尝试仍然遇到同样的错误。

这是 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"
      }
    }

【问题讨论】:

  • 我可以知道你的package.json中有什么吗?
  • 我上传了 package.json 文件作为答案,因为 stackoverflow 无法处理大代码
  • 在这种情况下,您可以使用问题中的编辑选项。将其发布为答案不是正确的选择。

标签: nativescript nativescript-cli


【解决方案1】:

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

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

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

【讨论】:

    【解决方案2】:

    检查您的 node_module 文件夹。

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

    由于它们两个组件都具有自动完成的依赖关系,因此您拥有相同的多个副本。

    【讨论】:

      猜你喜欢
      • 2021-12-18
      • 2020-11-27
      • 1970-01-01
      • 1970-01-01
      • 2016-09-04
      • 2021-03-03
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多