离子释放版本错误2模块

时间:2018-07-13 14:30:39

标签: angular ionic-framework ionic3

尝试运行命令时出现以下错误 “离子cordova构建android --prod --release”

Type AcknowledgePage in C:/Projects/MobileApps/DOTPicking/src/pages/acknowledge/acknowledge.ts is part of
            the declarations of 2 modules: AppModule in C:/Projects/MobileApps/DOTPicking/src/app/app.module.ts and
            AcknowledgePageModule in C:/Projects/MobileApps/DOTPicking/src/pages/acknowledge/acknowledge.module.ts!
            Please consider moving AcknowledgePage in
            C:/Projects/MobileApps/DOTPicking/src/pages/acknowledge/acknowledge.ts to a higher module that imports
            AppModule in C:/Projects/MobileApps/DOTPicking/src/app/app.module.ts and AcknowledgePageModule in
            C:/Projects/MobileApps/DOTPicking/src/pages/acknowledge/acknowledge.module.ts. You can also create a new
            NgModule that exports and includes AcknowledgePage in
            C:/Projects/MobileApps/DOTPicking/src/pages/acknowledge/acknowledge.ts then import that NgModule in
            AppModule in C:/Projects/MobileApps/DOTPicking/src/app/app.module.ts and AcknowledgePageModule in
            C:/Projects/MobileApps/DOTPicking/src/pages/acknowledge/acknowledge.module.ts.

我试图从声明中删除页面,但这只会导致另一个错误。有没有简单的方法可以解决我刚才忽略的错误?当我删除它们时,基本上只是告诉我将它们重新添加。

 import { BrowserModule } from '@angular/platform-browser';
    import { ErrorHandler, NgModule } from '@angular/core';
    import { IonicApp, IonicErrorHandler, IonicModule } from 'ionic-angular';
    import { Device } from '@ionic-native/device';
    import { AndroidPermissions } from '@ionic-native/android-permissions';
    import { HttpModule } from '@angular/http';
    import { MachinePage } from '../pages/machine/machine'
    import { MyApp } from './app.component';
    import { LoginPage } from '../pages/login/login';
    import { StatusBar } from '@ionic-native/status-bar';
    import { SplashScreen } from '@ionic-native/splash-screen';
    import { LoginServiceProvider } from '../providers/login-service/login-service';
    import { DeviceStatusServiceProvider } from '../providers/device-status-service/device-status-service';
    import { EnvironmentService } from '../environments/environment.service'
    import { ModalServiceProvider } from '../providers/modal-service/modal-service';
    import { MachineService } from '../providers/machine-service/machine-service';
    import { ListPage } from '../pages/list/list'
    import { GetworkPage } from '../pages/getwork/getwork'
    import { StagingPage } from '../pages/staging/staging'
    import { PickingServiceProvider } from '../providers/picking-service/picking-service';
    import { WeighpalletPage } from '../pages/weighpallet/weighpallet'
    import { ValidationServiceProvider } from '../providers/validation-service/validation-service';
    import { AcknowledgePage } from '../pages/acknowledge/acknowledge';
    import { NavigationMenuServiceProvider } from '../providers/navigation-menu-service/navigation-menu-service';
    import { PickPage } from '../pages/pick/pick';
    import { ScanlpPage } from '../pages/scanlp/scanlp'
    import { PickServiceProvider } from '../providers/storage-service/pick-service';
    import { ListServiceProvider } from '../providers/storage-service/list-service';
    import { SessionServiceProvider } from '../providers/storage-service/session-service';
    import { StorageHelper } from '../providers/storage-service/storage-helper';
    import { ReversePipe } from '../pipes/reverse/reverse';


    @NgModule({
      declarations: [
        MyApp,
        LoginPage,
        MachinePage,
        ListPage,
        GetworkPage,
        StagingPage,
        WeighpalletPage, 
        AcknowledgePage,
        PickPage,
        ScanlpPage,
        ReversePipe
      ],
      imports: [
        BrowserModule,
        IonicModule.forRoot(MyApp),
        HttpModule
      ],
      bootstrap: [IonicApp],
      entryComponents: [
        MyApp,
        LoginPage,
        MachinePage,
        ListPage,
        GetworkPage,
        StagingPage,
        WeighpalletPage, 
        AcknowledgePage,
        PickPage,
        ScanlpPage
      ],
      providers: [
        StatusBar,
        SplashScreen,
        { provide: ErrorHandler, useClass: IonicErrorHandler },
        Device,
        AndroidPermissions,
        LoginServiceProvider,
        EnvironmentService,
        ModalServiceProvider,
        MachineService,
        DeviceStatusServiceProvider,
        SessionServiceProvider,
        PickingServiceProvider,
        ValidationServiceProvider,
        NavigationMenuServiceProvider,
        PickServiceProvider,
        ListServiceProvider,
        StorageHelper
      ]
    })
    export class AppModule { }

1 个答案:

答案 0 :(得分:1)

Ionic App发行版本的构建步骤:-

步骤1:-以管理员身份打开cmd,然后运行以下命令:-

"keytool -genkey -v -keystore my-release-key.keystore -alias alias_name -keyalg RSA -keysize 2048 -validity 10000"

**第二步:-**运行命令

ionic build android --release

它将创建“ android-release-unsigned.apk”

步骤3:-在步骤1上方,命令将创建“ my_private_key.keystore” 确保将此文件保存在安全的地方,如果丢失,将无法向您的应用提交更新!

要对未签名的APK进行签名,请运行JDK中也包含的jarsigner工具:

"$ jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore my-release-key.keystore HelloWorld-release-unsigned.apk alias_name"

第4步:-要查找别名,请运行以下命令:-

"keytool -keystore my_private_key.keystore -list -v" at the root directory where keystore is placed.

第5步:-通过zip对齐生成的APK zipalign工具位于android-sdk / build-tools / {version} /文件夹中。

例如:-C:\ Users \ Karanvir \ AppData \ Local \ Android \ sdk1 \ build-tools \ 25.0.2>

zipalign -v 4 android-release-unsigned.apk android_release_signed.apk

密钥库的密码:-android @ 123(此处为密钥库的密码)。

享受!!!