Error while running ionic android build --prod --release (@ionic-native/core/decorators.d.ts, found version 4, expected 3)

I ran the following command:

ionic cordova build android --prod --release

And received the following error:

Error: Metadata version mismatch for module d:/ionic/event/node_modules/@ionic-native/core/decorators.d.ts, found version 4, expected 3
    at StaticSymbolResolver.getModuleMetadata (d:\ionic\event\node_modules\@angular\compiler\bundles\compiler.umd.js:24474:34)
    at StaticSymbolResolver._createSymbolsOf (d:\ionic\event\node_modules\@angular\compiler\bundles\compiler.umd.js:24260:46)
    at StaticSymbolResolver.getSymbolsOf (d:\ionic\event\node_modules\@angular\compiler\bundles\compiler.umd.js:24241:14)
    at d:\ionic\event\node_modules\@angular\compiler\bundles\compiler.umd.js:23023:30
    at Array.forEach (<anonymous>)
    at extractProgramSymbols (d:\ionic\event\node_modules\@angular\compiler\bundles\compiler.umd.js:23022:79)
    at AotCompiler.compileAll (d:\ionic\event\node_modules\@angular\compiler\bundles\compiler.umd.js:22720:47)
    at CodeGenerator.codegen (d:\ionic\event\node_modules\@angular\compiler-cli\src\codegen.js:30:14)
    at Function.NgTools_InternalApi_NG_2.codeGen (d:\ionic\event\node_modules\@angular\compiler-cli\src\ngtools_api.js:61:30)

Here are my dependencies:

"dependencies": {
        "@angular/common": "4.1.2",
        "@angular/compiler": "4.1.2",
        "@angular/compiler-cli": "4.1.2",
        "@angular/core": "4.1.2",
        "@angular/forms": "4.1.2",
        "@angular/http": "4.1.2",
        "@angular/platform-browser": "4.1.2",
        "@angular/platform-browser-dynamic": "4.1.2",
        "@ionic-native/core": "^4.11.0",
        "@ionic-native/file": "4.11.0",
        "@ionic-native/file-transfer": "4.11.0",
        "@ionic-native/google-maps": "4.9.1",
        "@ionic-native/keyboard": "4.11.0",
        "@ionic-native/splash-screen": "4.11.0",
        "@ionic-native/sqlite": "4.11.0",
        "@ionic-native/status-bar": "4.11.0",
        "@ionic-native/transfer": "3.14.0",
        "@ionic/storage": "2.0.1",
        "cordova-android": "6.3.0",
        "cordova-plugin-compat": "1.2.0",
        "cordova-plugin-console": "1.0.5",
        "cordova-plugin-device": "1.1.4",
        "cordova-plugin-file": "4.3.3",
        "cordova-plugin-file-transfer": "1.7.1",
        "cordova-plugin-googlemaps": "1.4.5",
        "cordova-plugin-splashscreen": "~4.0.1",
        "cordova-plugin-statusbar": "2.2.2",
        "cordova-plugin-whitelist": "1.3.1",
        "cordova-sqlite-storage": "~2.0.4",
        "ionic-angular": "3.3.0",
        "ionic-plugin-keyboard": "2.2.1",
        "ionicons": "3.0.0",
        "ng2-translate": "5.0.0",
        "rxjs": "5.5.11",
        "sw-toolbox": "3.6.0",
        "zone.js": "0.8.11"
    }
1 Like

Maybe?

Your Cordova tooling seems to be out of date, which might be causing all kinds of problems.
You can read about how to figure out the current Cordova versions and how to update CLI, platforms and plugins here: How to update Cordova CLI, Platforms and Plugins · ionic.zone

Can i know or getting link which dependencies are used for cordova-android version 6.3.0.

Sorry, what are you asking? What dependencies for cordova-android?

I was wrong. Can i know which version of dependencies are used for cordova-android version 6.3.0.

You repeated the same question as before. What are you asking?

I just wanted to know “cordova-android”: “6.3.0”, support @ionic-native/transfer”: “3.14.0 ?

There is no connection between those at all.

From looking at your dependencies I just saw that you are a) using an Ionic Native package that doens’t match the verison of all your other packages and b) you are using old cordova-android that should not be used any more.

Please tell me is it enough to update cordova android version? or i have to update others.

I have no idea. I just noticed things that look strange. I would start with making sure that all the Ionic Native packages are the same version, as I posted in my first post. If you fixed that and it didn’t help, let us know.

it is latest version @ionic-native/transfer”: “3.14.0

It is called @ionic-native/file-transfer now: https://ionicframework.com/docs/native/file-transfer/

Also noted in the changelog of 4.0.0: https://github.com/ionic-team/ionic-native/blob/master/CHANGELOG.md#code-refactoring

d:\ionic\event>npm outdated
Package                            Current  Wanted  Latest  Location
@angular/common                      4.1.2   4.1.2   6.1.1  ionic-hello-world
@angular/compiler                    4.1.2   4.1.2   6.1.1  ionic-hello-world
@angular/compiler-cli                4.1.2   4.1.2   6.1.1  ionic-hello-world
@angular/core                        4.1.2   4.1.2   6.1.1  ionic-hello-world
@angular/forms                       4.1.2   4.1.2   6.1.1  ionic-hello-world
@angular/http                        4.1.2   4.1.2   6.1.1  ionic-hello-world
@angular/platform-browser            4.1.2   4.1.2   6.1.1  ionic-hello-world
@angular/platform-browser-dynamic    4.1.2   4.1.2   6.1.1  ionic-hello-world
@ionic-native/splash-screen         3.10.2  3.10.2  4.11.0  ionic-hello-world
@ionic-native/sqlite                3.14.0  3.14.0  4.11.0  ionic-hello-world
@ionic-native/status-bar            3.10.2  3.10.2  4.11.0  ionic-hello-world
@ionic/storage                       2.0.1   2.0.1   2.1.3  ionic-hello-world
cordova-android                      6.4.0   6.4.0   7.1.1  ionic-hello-world
cordova-plugin-camera                2.4.1   2.4.1   4.0.3  ionic-hello-world
cordova-plugin-console               1.0.5   1.0.5   1.1.0  ionic-hello-world
cordova-plugin-device                1.1.4   1.1.4   2.0.2  ionic-hello-world
cordova-plugin-file                  4.3.3   4.3.3   6.0.1  ionic-hello-world
cordova-plugin-googlemaps            1.4.5   1.4.5   2.3.8  ionic-hello-world
cordova-plugin-splashscreen          4.0.3   4.0.3   5.0.2  ionic-hello-world
cordova-plugin-statusbar             2.2.2   2.2.2   2.4.2  ionic-hello-world
cordova-plugin-whitelist             1.3.1   1.3.1   1.3.3  ionic-hello-world
ionic-angular                        3.3.0   3.3.0   3.9.2  ionic-hello-world
ionicons                             3.0.0   3.0.0   4.3.0  ionic-hello-world
rxjs                                 5.1.1   5.1.1   6.2.2  ionic-hello-world
typescript                           2.3.3   2.3.3   3.0.1  ionic-hello-world
zone.js                             0.8.11  0.8.11  0.8.26  ionic-hello-world

d:\ionic\event>ionic cordova build android --prod --release
Running app-scripts build: --prod --platform android --target cordova
[01:03:08]  build prod started ...
[01:03:08]  clean started ...
[01:03:08]  clean finished in 2 ms
[01:03:08]  copy started ...
[01:03:09]  deeplinks started ...
[01:03:09]  deeplinks finished in 669 ms
[01:03:09]  ngc started ...
Error: Metadata version mismatch for module d:/ionic/event/node_modules/@ionic-native/core/decorators.d.ts, found version 4, expected 3
    at StaticSymbolResolver.getModuleMetadata (d:\ionic\event\node_modules\@angular\compiler\bundles\compiler.umd.js:24474:34)
    at StaticSymbolResolver._createSymbolsOf (d:\ionic\event\node_modules\@angular\compiler\bundles\compiler.umd.js:24260:46)
    at StaticSymbolResolver.getSymbolsOf (d:\ionic\event\node_modules\@angular\compiler\bundles\compiler.umd.js:24241:14)
    at d:\ionic\event\node_modules\@angular\compiler\bundles\compiler.umd.js:23023:30
    at Array.forEach (<anonymous>)
    at extractProgramSymbols (d:\ionic\event\node_modules\@angular\compiler\bundles\compiler.umd.js:23022:79)
    at AotCompiler.compileAll (d:\ionic\event\node_modules\@angular\compiler\bundles\compiler.umd.js:22720:47)
    at CodeGenerator.codegen (d:\ionic\event\node_modules\@angular\compiler-cli\src\codegen.js:30:14)
    at Function.NgTools_InternalApi_NG_2.codeGen (d:\ionic\event\node_modules\@angular\compiler-cli\src\ngtools_api.js:61:30)
    at d:\ionic\event\node_modules\@ionic\app-scripts\dist\aot\aot-compiler.js:182:73
[01:03:17]  copy finished in 9.08 s

Am i missing something???

Is this a different project now? Those dependencies don’t match what you posted before.

I have updated all. i was checked “npm outdated” and then updated all.

What is your package.json now after that?

{
    "name": "ionic-hello-world",
    "version": "0.0.0",
    "author": "Ionic Framework",
    "homepage": "http://ionicframework.com/",
    "private": true,
    "scripts": {
        "clean": "ionic-app-scripts clean",
        "build": "ionic-app-scripts build",
        "lint": "ionic-app-scripts lint",
        "ionic:build": "ionic-app-scripts build",
        "ionic:serve": "ionic-app-scripts serve"
    },
    "dependencies": {
        "@angular/common": "4.1.2",
        "@angular/compiler": "4.1.2",
        "@angular/compiler-cli": "4.1.2",
        "@angular/core": "4.1.2",
        "@angular/forms": "4.1.2",
        "@angular/http": "4.1.2",
        "@angular/platform-browser": "4.1.2",
        "@angular/platform-browser-dynamic": "4.1.2",
        "@ionic-native/core": "^4.11.0",
        "@ionic-native/file": "^4.11.0",
        "@ionic-native/file-path": "^4.11.0",
        "@ionic-native/file-transfer": "^4.11.0",
        "@ionic-native/google-maps": "^4.9.1",
        "@ionic-native/splash-screen": "3.10.2",
        "@ionic-native/sqlite": "^3.14.0",
        "@ionic-native/status-bar": "3.10.2",
        "@ionic-native/transfer": "^3.14.0",
        "@ionic/storage": "2.0.1",
        "cordova-android": "^6.4.0",
        "cordova-plugin-camera": "^2.4.1",
        "cordova-plugin-compat": "^1.2.0",
        "cordova-plugin-console": "1.0.5",
        "cordova-plugin-device": "1.1.4",
        "cordova-plugin-file": "^4.3.3",
        "cordova-plugin-file-transfer": "^1.7.1",
        "cordova-plugin-filepath": "^1.4.2",
        "cordova-plugin-googlemaps": "^1.4.5",
        "cordova-plugin-ionic-webview": "^2.0.2",
        "cordova-plugin-splashscreen": "~4.0.1",
        "cordova-plugin-statusbar": "2.2.2",
        "cordova-plugin-whitelist": "1.3.1",
        "cordova-sqlite-storage": "^2.3.3",
        "ionic-angular": "3.3.0",
        "ionic-plugin-keyboard": "~2.2.1",
        "ionicons": "3.0.0",
        "ng2-translate": "^5.0.0",
        "npm": "^6.3.0",
        "rxjs": "5.1.1",
        "sw-toolbox": "3.6.0",
        "zone.js": "0.8.11"
    },
    "devDependencies": {
        "@ionic/app-scripts": "^3.1.11",
        "typescript": "2.3.3"
    },
    "cordovaPlugins": [
        "cordova-plugin-whitelist",
        "cordova-plugin-console",
        "cordova-plugin-statusbar",
        "cordova-plugin-device",
        "cordova-plugin-splashscreen",
        "ionic-plugin-keyboard"
    ],
    "cordovaPlatforms": [],
    "description": "ecommerce: An Ionic project",
    "cordova": {
        "plugins": {
            "cordova-plugin-console": {},
            "cordova-plugin-device": {},
            "cordova-plugin-splashscreen": {},
            "cordova-plugin-statusbar": {},
            "cordova-plugin-whitelist": {},
            "ionic-plugin-keyboard": {},
            "cordova-plugin-camera": {},
            "cordova-plugin-file": {},
            "cordova-sqlite-storage": {},
            "cordova-plugin-filepath": {},
            "cordova-plugin-file-transfer": {},
            "cordova-plugin-compat": {},
            "cordova-plugin-ionic-webview": {}
        },
        "platforms": []
    }
}

Those are still 3.x - although before some of these already were on 4.x!

package.json now

{
    "name": "ionic-hello-world",
    "version": "0.0.0",
    "author": "Ionic Framework",
    "homepage": "http://ionicframework.com/",
    "private": true,
    "scripts": {
        "clean": "ionic-app-scripts clean",
        "build": "ionic-app-scripts build",
        "lint": "ionic-app-scripts lint",
        "ionic:build": "ionic-app-scripts build",
        "ionic:serve": "ionic-app-scripts serve"
    },
    "dependencies": {
        "@angular/common": "4.1.2",
        "@angular/compiler": "4.1.2",
        "@angular/compiler-cli": "4.1.2",
        "@angular/core": "4.1.2",
        "@angular/forms": "4.1.2",
        "@angular/http": "4.1.2",
        "@angular/platform-browser": "4.1.2",
        "@angular/platform-browser-dynamic": "4.1.2",
        "@ionic-native/core": "^4.11.0",
        "@ionic-native/file": "^4.11.0",
        "@ionic-native/file-path": "^4.11.0",
        "@ionic-native/file-transfer": "^4.11.0",
        "@ionic-native/google-maps": "^4.9.1",
        "@ionic-native/splash-screen": "^4.11.0",
        "@ionic-native/sqlite": "^4.11.0",
        "@ionic-native/status-bar": "^4.11.0",
        "@ionic/storage": "2.0.1",
        "cordova-android": "^6.4.0",
        "cordova-plugin-camera": "^2.4.1",
        "cordova-plugin-compat": "^1.2.0",
        "cordova-plugin-console": "1.0.5",
        "cordova-plugin-device": "1.1.4",
        "cordova-plugin-file": "^4.3.3",
        "cordova-plugin-file-transfer": "^1.7.1",
        "cordova-plugin-filepath": "^1.4.2",
        "cordova-plugin-googlemaps": "^1.4.5",
        "cordova-plugin-ionic-webview": "^2.0.2",
        "cordova-plugin-splashscreen": "~4.0.1",
        "cordova-plugin-statusbar": "2.2.2",
        "cordova-plugin-whitelist": "1.3.1",
        "cordova-sqlite-storage": "^2.3.3",
        "ionic-angular": "3.3.0",
        "ionic-plugin-keyboard": "~2.2.1",
        "ionicons": "3.0.0",
        "ng2-translate": "^5.0.0",
        "npm": "^6.3.0",
        "rxjs": "5.1.1",
        "sw-toolbox": "3.6.0",
        "zone.js": "0.8.11"
    },
    "devDependencies": {
        "@ionic/app-scripts": "^3.1.11",
        "typescript": "2.3.3"
    },
    "cordovaPlugins": [
        "cordova-plugin-whitelist",
        "cordova-plugin-console",
        "cordova-plugin-statusbar",
        "cordova-plugin-device",
        "cordova-plugin-splashscreen",
        "ionic-plugin-keyboard"
    ],
    "cordovaPlatforms": [],
    "description": "ecommerce: An Ionic project",
    "cordova": {
        "plugins": {
            "cordova-plugin-console": {},
            "cordova-plugin-device": {},
            "cordova-plugin-splashscreen": {},
            "cordova-plugin-statusbar": {},
            "cordova-plugin-whitelist": {},
            "ionic-plugin-keyboard": {},
            "cordova-plugin-camera": {},
            "cordova-plugin-file": {},
            "cordova-sqlite-storage": {},
            "cordova-plugin-filepath": {},
            "cordova-plugin-file-transfer": {},
            "cordova-plugin-compat": {},
            "cordova-plugin-ionic-webview": {}
        },
        "platforms": []
    }
}

Now npm outdated

d:\ionic\event>npm outdated
Package                            Current  Wanted  Latest  Location
@angular/common                      4.1.2   4.1.2   6.1.1  ionic-hello-world
@angular/compiler                    4.1.2   4.1.2   6.1.1  ionic-hello-world
@angular/compiler-cli                4.1.2   4.1.2   6.1.1  ionic-hello-world
@angular/core                        4.1.2   4.1.2   6.1.1  ionic-hello-world
@angular/forms                       4.1.2   4.1.2   6.1.1  ionic-hello-world
@angular/http                        4.1.2   4.1.2   6.1.1  ionic-hello-world
@angular/platform-browser            4.1.2   4.1.2   6.1.1  ionic-hello-world
@angular/platform-browser-dynamic    4.1.2   4.1.2   6.1.1  ionic-hello-world
@ionic/storage                       2.0.1   2.0.1   2.1.3  ionic-hello-world
cordova-android                      6.4.0   6.4.0   7.1.1  ionic-hello-world
cordova-plugin-camera                2.4.1   2.4.1   4.0.3  ionic-hello-world
cordova-plugin-console               1.0.5   1.0.5   1.1.0  ionic-hello-world
cordova-plugin-device                1.1.4   1.1.4   2.0.2  ionic-hello-world
cordova-plugin-file                  4.3.3   4.3.3   6.0.1  ionic-hello-world
cordova-plugin-googlemaps            1.4.5   1.4.5  2.3.10  ionic-hello-world
cordova-plugin-splashscreen          4.0.3   4.0.3   5.0.2  ionic-hello-world
cordova-plugin-statusbar             2.2.2   2.2.2   2.4.2  ionic-hello-world
cordova-plugin-whitelist             1.3.1   1.3.1   1.3.3  ionic-hello-world
ionic-angular                        3.3.0   3.3.0   3.9.2  ionic-hello-world
ionicons                             3.0.0   3.0.0   4.3.0  ionic-hello-world
rxjs                                 5.1.1   5.1.1   6.2.2  ionic-hello-world
typescript                           2.3.3   2.3.3   3.0.1  ionic-hello-world
zone.js                             0.8.11  0.8.11  0.8.26  ionic-hello-world

Same error show

d:\ionic\event>ionic cordova build android --prod --release
Running app-scripts build: --prod --platform android --target cordova
[12:57:08]  build prod started ...
[12:57:09]  clean started ...
[12:57:09]  clean finished in 50 ms
[12:57:09]  copy started ...
[12:57:11]  deeplinks started ...
[12:57:12]  deeplinks finished in 387 ms
[12:57:12]  ngc started ...
Error: Metadata version mismatch for module d:/ionic/event/node_modules/@ionic-native/core/decorators.d.ts, found version 4, expected 3
    at StaticSymbolResolver.getModuleMetadata (d:\ionic\event\node_modules\@angular\compiler\bundles\compiler.umd.js:24474:34)
    at StaticSymbolResolver._createSymbolsOf (d:\ionic\event\node_modules\@angular\compiler\bundles\compiler.umd.js:24260:46)
    at StaticSymbolResolver.getSymbolsOf (d:\ionic\event\node_modules\@angular\compiler\bundles\compiler.umd.js:24241:14)
    at d:\ionic\event\node_modules\@angular\compiler\bundles\compiler.umd.js:23023:30
    at Array.forEach (<anonymous>)
    at extractProgramSymbols (d:\ionic\event\node_modules\@angular\compiler\bundles\compiler.umd.js:23022:79)
    at AotCompiler.compileAll (d:\ionic\event\node_modules\@angular\compiler\bundles\compiler.umd.js:22720:47)
    at CodeGenerator.codegen (d:\ionic\event\node_modules\@angular\compiler-cli\src\codegen.js:30:14)
    at Function.NgTools_InternalApi_NG_2.codeGen (d:\ionic\event\node_modules\@angular\compiler-cli\src\ngtools_api.js:61:30)
    at d:\ionic\event\node_modules\@ionic\app-scripts\dist\aot\aot-compiler.js:182:73
[12:57:37]  copy finished in 27.68 s

according to “npm outdated”, should i update cordova-android at latest version 7.1.1 ? . Can’t i build this project at cordova-android version 6.4.0? Another thing, @ionic native packages are not showing in “npm outdated” result.
@ionic-native/transfer and @ionic-native/file-transfer are same? at last i was uninstall “@ionic-native/transfer” from this project.
When i build without “–prod” mode this project generate apk file but does not work in mobile. just show white screen in mobile.

Hm ok, so seems my hunch was not correct.

One thing I would try is to use https://update.ionic.zone/ with my package.json and update the whole project to the newest ionic-angular version. Shouldn’t be too much work.