ionic-team / ionic-starter-super

The Ionic 2 Super Starter 🎮
Other
376 stars 142 forks source link

An Android apk couldn't be done with "ionic cordova build android --prod --release" #138

Closed happy2discover closed 6 years ago

happy2discover commented 7 years ago

I'm submitting a ... (check one with "x") [x] bug report [ ] feature request [ ] support request => Please do not submit support requests here, use one of these channels: https://forum.ionicframework.com/ or http://ionicworldwide.herokuapp.com/

Current behavior:

Error: 
Type CardsPage in .../src/pages/cards/cards.ts is part of the declarations of 2 modules: CardsPageModule in .../src/pages/cards/card.module.ts and CardsPageModule in .../src/pages/cards/cards.module.ts! 

Please consider moving CardsPage in .../src/pages/cards/cards.ts to a higher module that imports CardsPageModule in .../src/pages/cards/card.module.ts and CardsPageModule in .../src/pages/cards/cards.module.ts. 

You can also create a new NgModule that exports and includes CardsPage in .../src/pages/cards/cards.ts then import that NgModule in CardsPageModule in .../src/pages/cards/card.module.ts and CardsPageModule in .../src/pages/cards/cards.module.ts.

at syntaxError (...\node_modules\@angular\compiler\bundles\compiler.umd.js:1729:34)
at CompileMetadataResolver._addTypeToModule (...\node_modules\@angular\compiler\bundles\compiler.umd.js:15728:31)
at ...\node_modules\@angular\compiler\bundles\compiler.umd.js:15616:27
at Array.forEach (<anonymous>)
at CompileMetadataResolver.getNgModuleMetadata (...\node_modules\@angular\compiler\bundles\compiler.umd.js:15607:54)
at addNgModule (...\node_modules\@angular\compiler\bundles\compiler.umd.js:24403:58)
at ...\node_modules\@angular\compiler\bundles\compiler.umd.js:24414:14
at Array.forEach (<anonymous>)
at _createNgModules (...\node_modules\@angular\compiler\bundles\compiler.umd.js:24413:26)
at analyzeNgModules (...\node_modules\@angular\compiler\bundles\compiler.umd.js:24288:14)

Expected behavior:

An Android apk could be done.

Steps to reproduce:

ionic cordova build android --prod --release

Related code:

Other information:

Ionic info: (run ionic info from a terminal/cmd prompt and paste output below):

cli packages:

    @ionic/cli-utils  : 1.12.0
    ionic (Ionic CLI) : 3.12.0

global packages:

    cordova (Cordova CLI) : 7.1.0

local packages:

    @ionic/app-scripts : 3.0.0
    Cordova Platforms  : android 6.3.0
    Ionic Framework    : ionic-angular 3.7.1

System:

    Android SDK Tools : 26.1.1
    Node              : v8.6.0
    npm               : 5.4.2
    OS                : Windows 10

Misc:

    backend : pro
janpio commented 7 years ago

Any changes to the code done before trying to build?

happy2discover commented 7 years ago

@janpio No Changes. An Android apk could be done with "ionic cordova build android". But it failed plus "--prod --release".

janpio commented 7 years ago

Is it --prod or --release that is causing the problem?

happy2discover commented 7 years ago

@janpio It is --prod. Build successful with --release.

janpio commented 7 years ago

Does it work for iOS?

happy2discover commented 7 years ago

@janpio The same error as Android.

happy2discover commented 7 years ago

@janpio I might find out the reason. There is an unnecessary "card.module.ts". I deleted it and got "BUILD SUCCESSFUL".