Error: ionic cordova build android --prod


#1

Error message

[11:05:44]  typescript error
            Can't resolve all parameters for CrmModalComponent in
            C:/Users/45935/Desktop/cnpc-rise-mobile/src/cnpc-rise-core/components/crm-modal/crm-modal.ts: ([object
            Object], [object Object], ?).

Error: The Angular AoT build failed. See the issues above
    at C:\Users\45935\Desktop\cnpc-rise-mobile\node_modules\@ionic\app-scripts\dist\aot\aot-compiler.js:237:55
    at step (C:\Users\45935\Desktop\cnpc-rise-mobile\node_modules\@ionic\app-scripts\dist\aot\aot-compiler.js:32:23)
    at Object.next (C:\Users\45935\Desktop\cnpc-rise-mobile\node_modules\@ionic\app-scripts\dist\aot\aot-compiler.js:13:53)
    at fulfilled (C:\Users\45935\Desktop\cnpc-rise-mobile\node_modules\@ionic\app-scripts\dist\aot\aot-compiler.js:4:58)
    at <anonymous>

crm-modal.ts

import { Component } from '@angular/core';
import {IonicPage, NavController, NavParams } from 'ionic-angular';

import {
  FormGroup,
  FormControl

} from '@angular/forms';
@IonicPage()
@Component({
  selector: 'crm-modal',
  templateUrl: `crm-modal.html`
})
export class CrmModalComponent {

  

}


my app.module.ts

import { BrowserModule } from '@angular/platform-browser';
import { ErrorHandler, NgModule } from '@angular/core';
import { IonicApp, IonicErrorHandler, IonicModule } from 'ionic-angular';
import { SplashScreen } from '@ionic-native/splash-screen';
import { StatusBar } from '@ionic-native/status-bar';

import { MyApp } from './app.component';
import { HomePage } from '../pages/home/home';

@NgModule({
  declarations: [
    MyApp,
    HomePage
  ],
  imports: [
    BrowserModule,
    IonicModule.forRoot(MyApp,{},{
      links: [
        { component: HomePage, name: 'HomePage', segment: 'homepage' }]
    })
  ],
  bootstrap: [IonicApp],
  entryComponents: [
    MyApp,
    HomePage
  ],
  providers: [
    StatusBar,
    SplashScreen,
    {provide: ErrorHandler, useClass: IonicErrorHandler}
  ]
})
export class AppModule {}

my ionic info


    @ionic/cli-utils  : 1.19.0
    ionic (Ionic CLI) : 3.19.0

global packages:

    cordova (Cordova CLI) : not installed

local packages:

    @ionic/app-scripts : 3.1.4
    Cordova Platforms  : none
    Ionic Framework    : ionic-angular 3.9.2

System:

    Node : v8.9.1
    npm  : 5.5.1
    OS   : Windows 10

Environment Variables:

    ANDROID_HOME : not set

Misc:

    backend : pro

why??


#2

there is no Platforms in your project try to add a platform(android ,ios) after that execute this command:
ionic cordova run android --prod


#3

Hi,

Faced similar issues even updating the packages and all other attempts. I was in a hurry that time and finally took the release build using

ionic cordova build android --release instead of --prod.

You can get the output in this way


#4

Thank you , i can use cordova build android --prod successful too,but i want use ionic cordova build android --prod ,beacause the diffrent effects


#5

Tried that too. But the production build showed just a blank screen after splash and app didn’t worked well. That’s why I recommend you to go with release build


#6

Build --prod will create a smaller app and faster to boot up
Build --release will create a production app for store (Android -> not debuggable, more security, …)

So you cannot replace prod by release you need both on your final application.

Now the real question is: how to make build prod working again …