创建一个导出并包含的新 NgModule

Create a new NgModule that exports and includes

我正在开发 ionic 3。我的项目运行正常,但每当我尝试构建 Android 版本时,我都会遇到此错误。

app.module.ts 中删除 ClassesPage

Note : Better keep entire content of your question into the Whosebug instead of any other reference.

根据错误,您在两个文件中声明了 ClassesPage(即 app.module.tsclasspageModule.ts)。由于您正在使用 lazy-loading,因此无需导入 app.module.ts 中的页面。为此,您需要 remove/comment ClassesPage 来自 app.module.ts 文件 declarationsentryComponents 块。

还观察到,您添加了与ClassesPage相同的其他页面。如果 lazy-loading 存在,那么您也需要从 app.module.ts 文件中 comment/remove 这些。

请在此处找到延迟加载的详细说明https://ionicacademy.com/ionic-3-lazy-loading/

您已在两个模块中添加了 ClassesPage:AppModule 和 ClassesPageModule。有两种解决方案: 1.> 如果你只需要一个模块中的组件,那么只导入那个或 2.> 在单独的第三个模块中导入 ClassesPage,添加声明和导出,然后将这个第三个模块导入到 AppModule 和 ClassesPageModule。

但是如果我没记错的话,你只是在ClassesPageModule中使用了ClassesPage。所以如果你从 AppModule 中删除 ClassesPage 会更好。同时将 ClassesPage 添加到 ClassesPageModule 的 bootstrap。