看起来一切都很好,我的代码正确,但是当午餐应用收到此消息时
此错误是什么意思?这与我的appmodule配置有关?还是所有关于缺少安装的信息?
为了给您提供背景信息,我使用Android Studio AVD管理器创建了一个虚拟设备,在虚拟设备中创建了午餐,该设备已被正确识别,然后我又运行了android。
我已经使用“ tns doctor”检查了配置,一切似乎都很好
我和tns run android
一起吃午餐
An uncaught Exception occurred on "main" thread.
java.lang.RuntimeException: Unable to start activity ComponentInfo{org.nativescript.conFusion/com.tns.NativeScriptActivity}: com.tns.NativeScriptException:
Calling js method onCreate failed
Error: Type HomeComponent is part of the declarations of 2 modules: AppRoutingModule and AppModule! Please consider moving HomeComponent to a higher module that imports AppRoutingModule and AppModule. You can also create a new NgModule that exports and includes HomeComponent then import that NgModule in AppRoutingModule and AppModule.
File: "file:///data/data/org.nativescript.conFusion/files/app/tns_modules/@angular/compiler/bundles/compiler.umd.js, line: 11081, column: 12
Error: Type HomeComponent is part of the declarations of 2 modules: AppRoutingModule and AppModule! Please consider moving HomeComponent to a higher module that imports AppRoutingModule and AppModule. You can also create a new NgModule that exports and includes HomeComponent then import that NgModule in AppRoutingModule and AppModule.
File: "file:///data/data/org.nativescript.conFusion/files/app/tns_modules/@angular/compiler/bundles/compiler.umd.js, line: 11081, column: 12
我的appmodule配置
import { NgModule, NO_ERRORS_SCHEMA } from "@angular/core";
import { NativeScriptModule } from "nativescript-angular/nativescript.module";
import { NativeScriptHttpModule } from "nativescript-angular/http";
import { AppRoutingModule } from "./app.routing";
import { NativeScriptUISideDrawerModule } from "nativescript-telerik-ui/sidedrawer/angular";
import { TNSFontIconModule } from 'nativescript-ngx-fonticon';
import { AppComponent } from "./app.component";
import { MenuComponent } from './menu/menu.component';
import { DishdetailComponent } from './dishdetail/dishdetail.component';
import { DrawerComponent } from "./shared/drawer/drawer.component";
import { HomeComponent } from './home/home.component';
import { ContactComponent } from './contact/contact.component';
import { AboutComponent } from './about/about.component';
import { DishService } from './services/dish.service';
import { ProcessHTTPMsgService } from './services/process-httpmsg.service';
import { baseURL } from './shared/baseurl';
import { PromotionService } from "./services/promotion.service";
import { LeaderService } from "./services/leader.service";
// Uncomment and add to NgModule imports if you need to use two-way binding
// import { NativeScriptFormsModule } from "nativescript-angular/forms";
// Uncomment and add to NgModule imports if you need to use the HTTP wrapper
// import { NativeScriptHttpModule } from "nativescript-angular/http";
@NgModule({
bootstrap: [
AppComponent
],
imports: [
NativeScriptModule,
AppRoutingModule,
NativeScriptHttpModule,
NativeScriptUISideDrawerModule,
TNSFontIconModule.forRoot({
'fa': './fonts/font-awesome.min.css'
})
],
declarations: [
AppComponent,
MenuComponent,
DishdetailComponent,
DrawerComponent,
HomeComponent,
ContactComponent,
AboutComponent
],
providers: [
{provide: 'BaseURL', useValue: baseURL},
DishService,
ProcessHTTPMsgService,
PromotionService,
LeaderService
],
schemas: [
NO_ERRORS_SCHEMA
]
})
/*
Pass your application module to the bootstrapModule function located in main.ts to start your app
*/
export class AppModule { }
如果您需要更多详细信息,请告诉我 这是每周课程的一部分
非常感谢您