Ionic cordova build android –prod –release 失败,无法解析 './app.module.ngfactory [英] Ionic cordova build android –prod –release fails with Can't resolve './app.module.ngfactory

查看:16
本文介绍了Ionic cordova build android –prod –release 失败,无法解析 './app.module.ngfactory的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 Ionic 3.当我尝试 cordova build android --prod --release 时,构建完成,但已签名的 APK 在启动后显示白屏.当我尝试 ionic cordova build android --prod --release 时,它显示以下错误.

I’m working with Ionic 3. When I try cordova build android --prod --release, a build is done, but the signed APK is showing white screen after splash. When I try ionic cordova build android --prod --release, it is showing the following error.

Main.ts

import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';

import { AppModule } from './app.module';

platformBrowserDynamic().bootstrapModule(AppModule);

app.module.ts

app.module.ts

import { NgModule, ErrorHandler } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { IonicApp, IonicModule, IonicErrorHandler } from 'ionic-angular';
import { MyApp } from './app.component';
import { FormsModule } from '@angular/forms';
import { HttpModule } from '@angular/http';
import { BarcodeScanner } from '@ionic-native/barcode-scanner';
import { AppRate } from '@ionic-native/app-rate';
import { PopoverPage } from '../pages/popover/popover';

import { TabsPage } from '../pages/tabs/tabs';

import { StatusBar } from '@ionic-native/status-bar';
import { SplashScreen } from '@ionic-native/splash-screen';
import { LoginPage } from '../pages/login/login';

import { PostService } from './app.postservice';
import { UrlService } from './app.service';
import { GetService } from './app.getservice';
import { AppVersion } from '@ionic-native/app-version';
import { SlidersPage } from '../pages/sliders/sliders';


@NgModule({
  declarations: [
    MyApp,
    TabsPage,
    LoginPage,
    SlidersPage
  ],
  imports: [
    BrowserModule,
    HttpModule,
     IonicModule.forRoot(MyApp,{
       tabsHideOnSubPages: true
     })
    
  ],
  bootstrap: [IonicApp],
  entryComponents: [
    MyApp,
    LoginPage,
    SlidersPage
  ],
  providers: [
    StatusBar,
    SplashScreen,
    AppVersion,
    AppRate,
    
    BarcodeScanner,
    {provide: ErrorHandler, useClass: IonicErrorHandler},
    {provide: PostService, useClass: PostService},
    {provide: UrlService, useClass: UrlService},
    {provide: GetService, useClass: GetService},
  ],

})
export class AppModule {}

离子信息提供

cli 包:(C:UsersakrraAppDataRoaming pm ode_modules)

cli packages: (C:UsersakrraAppDataRoaming pm ode_modules)

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

全局包:

cordova (Cordova CLI) : 7.1.0

本地包:

@ionic/app-scripts : 3.1.2
Cordova Platforms  : android 6.3.0 windows 5.0.0
Ionic Framework    : ionic-angular 3.9.2

系统:

Node : v9.2.0
npm  : 5.5.1
OS   : Windows 10

环境变量:

ANDROID_HOME : not set

杂项:

backend : legacy

推荐答案

Ionic Cli 在使用 --prod 选项运行时似乎无法报告正确的错误.它正在抛出无法解析'./app.module.ngfactory'"而不是正确的错误消息.

Ionic Cli seems to be having issues with reporting the correct error when running with --prod option. It is throwing "Can't resolve './app.module.ngfactory'" instead of the correct error message.

正在这里这里.

Ionic 的开发人员 Dan Bucholtz 提出了一种解决方法来检索实际的错误消息 这里.

A developer with Ionic Dan Bucholtz suggested a workaround to retrieve the actual error message here.

与此同时,要查看应用程序中的错误并修复它们,请尝试运行:

In the meantime, to see the errors in your application and fix them, try running:

./node_modules/.bin/ngc

您可以运行上述命令来找出您的应用中真正的问题是什么.

You can run the above command to figure out what the real issue in your app is.

这篇关于Ionic cordova build android –prod –release 失败,无法解析 './app.module.ngfactory的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆