Error while running nativescript application on Android

639 views Asked by At

Exception in thread 'main' java.io.IOException: File already exists. This may lead to undesired behavior.
Please change the name of one of the extended classes.

screenshot on Windows

Here I'm using nativescript using javascript. When I run tns run android getting error

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

I remove hook,node_module and platform folder and try still getting same error.

Here is package.json file

 {
      "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

There are 2 answers

0
Manoj On

nativescript-ui-dataform plugin itself has [email protected] as dependency. You have nativescript-ui-autocomplete as dependency in your package.json with ^ symbol that will install the most recent major version which is 3.10.1. So you will have 2 versions of same plugin and that is the reason for the issue.

Try removing that ^ symbol and keep it as 3.9.0.

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

0
Narendra On

Check in your node_module folder.

nativescript-ui-dataform and nativescript-ui-listview are also having node_modules. Delete them and run tns run android again.

As they both components have dependencies of autocomplete, you are having multiple copies of the same.