2016-11-09 241 views
0

我試圖導出我的應用程序,我運行離子運行android並失敗。離子運行android失敗

這是錯誤

C:\Users\adirz\myapps\sceSchedule>ionic run android 

Running 'run:before' npm script before run 
> [email protected] build C:\Users\adirz\myapps\sceSchedule 
> ionic-app-scripts build 
[02:17:30] ionic-app-scripts 0.0.41 
[02:17:30] build prod started ... 
[02:17:30] clean started ... 
[02:17:30] clean finished in 5 ms 
[02:17:30] copy started ... 
[02:17:30] ngc started ... 
[02:17:31] copy finished in 196 ms 
[02:17:31] lint started ... 
[02:17:32] tslint: C:/Users/adirz/myapps/sceSchedule/src/pages/courses-page/courses-page.ts, line: 5 

      Unused import: 'course' 
     L4: import {CoursesData} from "../../providers/courses-data"; 
     L5: import {course} from "../../models/Course"; 
[02:17:32] tslint: C:/Users/adirz/myapps/sceSchedule/src/pages/tabs/tabs.ts, line: 3 

      Unused import: 'HomePage' 
     L3: import { HomePage } from '../home/home'; 
     L4: import { AboutPage } from '../about/about'; 
[02:17:32] lint finished in 1.50 s 
[02:17:43] Error: Error at C:/Users/adirz/myapps/sceSchedule/.tmp/pages/courses-page/courses-page.ngfactory.ts:736:29 

[02:17:43] Supplied parameters do not match any signature of call target. 
[02:17:43] Error at C:/Users/adirz/myapps/sceSchedule/.tmp/pages/courses-page/courses-page.ngfactory.ts:761:29 
[02:17:43] Supplied parameters do not match any signature of call target. 

[02:17:43] ngc failed 

[02:17:43] ionic-app-script task: "build" 

[02:17:43] Error: Error 

這是我的課程,page.ts

import { Component } from '@angular/core'; 
import {NavController, LoadingController,AlertController} from 'ionic-angular'; 

import {CoursesData} from "../../providers/courses-data"; 
import {course} from "../../models/Course"; 

/* 
    Generated class for the CoursesPage page. 

    See http://ionicframework.com/docs/v2/components/#navigation for more info on 
    Ionic pages and navigation. 
*/ 
@Component({ 
    selector: 'page-courses-page', 
    templateUrl: 'courses-page.html' 
}) 
export class CoursesPage { 
    public semester: string = 'SemA'; 
// public coursesA: Array<any> = []; 
    public coursesB: Array<any> = []; 
    public coursesC:Array<any>=[]; 
    public department:any; 
    public courseSelect: string = ''; 
    public lectureSelect:string= ''; 
    public coursesNames:Array<any>=[]; 
    public LecturesNames:Array<any>=[]; 
    public LectureCourses:Array<any>=[]; 
    public loader = this.loadingCtrl.create({ 
    content: "Please wait...", 
    spinner: 'crescent' 

    }); 
    public data=null; 
    public coursesA:Array<any>=[]; 
    public coursesAD:Array<any>=[]; 
    public coursesChose:Array<any>=[]; 

    constructor(public navCtrl: NavController,private loadingCtrl: LoadingController,public coursesData:CoursesData,public alertCtrl: AlertController) { 

    } 


    ionViewWillEnter() { 
    this.loader.present(); 
     this.onSemChange(); 
    } 
    public getCourses(semester:any){ 
     this.courseSelect=''; 
     this.coursesNames=[]; 
     this.LecturesNames=[]; 
     this.coursesA=[]; 
     console.log(semester); 
    this.coursesData.LoadData(semester) 
     .subscribe(courseList=> { 
      courseList.forEach(course=>{ 
      var newCourse={ 
       id_course:course.id_course , 
       key_course:course.key_course, 
       course_name:course.course_name , 
       course_type:course.course_type , 
       start:course.start , 
       end:course.end , 
       point_course:course.point_course , 
       day:course.Day, 
       class:course.class, 
       lecture_name:course.lecture_name 
      } 
      this.coursesA.push(newCourse); 
      this.coursesNames.push(course.course_name); 
      this.LecturesNames.push(course.lecture_name); 
      }); 
      //this.courseSelect=this.coursesNames[0]; 
      this.coursesAD=this.coursesA; 
      this.coursesNames = this.coursesNames.filter(function(elem, index, self) { 
        return index == self.indexOf(elem); 
       }) 
       console.log(this.coursesA); 


       this.loader.dismiss(); 
       console.log(this.coursesNames); 
     // return this.coursesA; 

     },err=>{ 
      console.log(err); 
     }); 
    } 



    public onCourseChange(){ 
    console.log(this.courseSelect); 
    this.coursesA=this.coursesAD; 
    //getCourses(); 
    this.coursesChose=[]; 
    this.LecturesNames=[]; 
    for (let course of this.coursesA) { 
     if (course.course_name==this.courseSelect){ 
     this.coursesChose.push(course); 
     this.LecturesNames.push(course.lecture_name); 
     console.log(this.LecturesNames); 
     }  
    } 
    this.coursesA = this.coursesChose; 
    this.LecturesNames = this.LecturesNames.filter(function(elem, index, self) { 
        return index == self.indexOf(elem); 
       }) 
    console.log(this.LecturesNames); 
    console.log(this.coursesChose); 
    } 

    public onLectureChange(){ 
     this.coursesA=this.coursesAD; 
    //getCourses(); 
    this.LectureCourses=[]; 
    for (let course of this.coursesA) { 
     if (course.lecture_name==this.lectureSelect){ 
     this.LectureCourses.push(course); 
     } 
     this.coursesA = this.LectureCourses; 
    } 
    } 
    public addDep(){} 
    public onSemChange(){ 
    let semester=JSON.stringify({'semester':this.semester}); 
    console.log(semester); 
    this.getCourses(semester); 

    } 
} 

我刪除tmp文件夾它說,仍然我有問題。 我試圖關閉程序並重新啓動和我還是有同樣的問題

tmp文件夾

import { Component } from '@angular/core'; 
import {NavController, LoadingController,AlertController} from 'ionic-angular'; 

import {CoursesData} from "../../providers/courses-data"; 
import {course} from "../../models/Course"; 

/* 
    Generated class for the CoursesPage page. 

    See http://ionicframework.com/docs/v2/components/#navigation for more info on 
    Ionic pages and navigation. 
*/ 
@Component({ 
    selector: 'page-courses-page', 
    templateUrl: 'courses-page.html' 
}) 
export class CoursesPage { 
    public semester: string = 'SemA'; 
// public coursesA: Array<any> = []; 
    public coursesB: Array<any> = []; 
    public coursesC:Array<any>=[]; 
    public department:any; 
    public courseSelect: string = ''; 
    public lectureSelect:string= ''; 
    public coursesNames:Array<any>=[]; 
    public LecturesNames:Array<any>=[]; 
    public LectureCourses:Array<any>=[]; 
    public loader = this.loadingCtrl.create({ 
    content: "Please wait...", 
    spinner: 'crescent' 

    }); 
    public coursesA:Array<any>=[]; 
    public coursesAD:Array<any>=[]; 
    public coursesChose:Array<any>=[]; 

    constructor(public navCtrl: NavController,private loadingCtrl: LoadingController,public coursesData:CoursesData,public alertCtrl: AlertController) { 

    } 


    ionViewWillEnter() { 
    this.loader.present(); 
     this.onSemChange(); 
    } 
    public getCourses(semester:any){ 
     this.courseSelect=''; 
     this.coursesNames=[]; 
     this.LecturesNames=[]; 
     this.coursesA=[]; 
     console.log(semester); 
    this.coursesData.LoadData(semester) 
     .subscribe(courseList=> { 
      courseList.forEach(course=>{ 
      var newCourse={ 
       id_course:course.id_course , 
       key_course:course.key_course, 
       course_name:course.course_name , 
       course_type:course.course_type , 
       start:course.start , 
       end:course.end , 
       point_course:course.point_course , 
       day:course.Day, 
       class:course.class, 
       lecture_name:course.lecture_name 
      } 
      this.coursesA.push(newCourse); 
      this.coursesNames.push(course.course_name); 
      this.LecturesNames.push(course.lecture_name); 
      }); 
      //this.courseSelect=this.coursesNames[0]; 
      this.coursesAD=this.coursesA; 
      this.coursesNames = this.coursesNames.filter(function(elem, index, self) { 
        return index == self.indexOf(elem); 
       }) 
       console.log(this.coursesA); 


       this.loader.dismiss(); 
       console.log(this.coursesNames); 
     // return this.coursesA; 

     },err=>{ 
      console.log(err); 
     }); 
    } 



    public onCourseChange(){ 
    console.log(this.courseSelect); 
    this.coursesA=this.coursesAD; 
    //getCourses(); 
    this.coursesChose=[]; 
    this.LecturesNames=[]; 
    for (let course of this.coursesA) { 
     if (course.course_name==this.courseSelect){ 
     this.coursesChose.push(course); 
     this.LecturesNames.push(course.lecture_name); 
     console.log(this.LecturesNames); 
     }  
    } 
    this.coursesA = this.coursesChose; 
    this.LecturesNames = this.LecturesNames.filter(function(elem, index, self) { 
        return index == self.indexOf(elem); 
       }) 
    console.log(this.LecturesNames); 
    console.log(this.coursesChose); 
    } 

    public onLectureChange(){ 
     this.coursesA=this.coursesAD; 
    //getCourses(); 
    this.LectureCourses=[]; 
    for (let course of this.coursesA) { 
     if (course.lecture_name==this.lectureSelect){ 
     this.LectureCourses.push(course); 
     } 
     this.coursesA = this.LectureCourses; 
    } 
    } 
    public addDep(){} 
    public onSemChange(){ 
    let semester=JSON.stringify({'semester':this.semester}); 
    console.log(semester); 
    this.getCourses(semester); 

    } 
} 

761:29我真的沒有,但29行,我有

line public loader = this.loadingCtrl.create({ 
    content: "Please wait...", 
    spinner: 'crescent' 

    }); 
+0

你能從'/.tmp/pages/courses-page/courses-page.ngfactory.ts:736發佈相關線路:29'? –

+0

當然。我沒有736,但我添加了我的文章,你可以看到我放了 –

+0

736:29意味着錯誤是在行736,字符29.但錯誤是不是在你的courses-page.ts,它在課程-page.ngfactory.ts。這個文件是由angular 2編譯器創建的,似乎有錯誤。如果您可以向我們展示來自生成的文件的相關行,這將有所幫助。 –

回答

2

作爲一個臨時解決方案,您可以編輯您的package.json文件和--dev標誌添加到生成步驟。這將關閉AoT編譯器,您可以繼續處理您的應用程序。

更換

"build": "ionic-app-scripts build"

"build": "ionic-app-scripts build --dev"

+0

謝謝!有用!!!!!但這是最好的方法?你說這是臨時解決方案。 –

+0

是的,這只是一個臨時解決方案。當您構建應用程序時,角度2編譯器優化您的代碼,使其運行速度更快。例如,編譯器有時會發現使用'ionic serve'時看不到的其他錯誤。所以你應該只使用--dev標誌,直到找到導致錯誤的原因。 –

+0

謝謝你,你解決了我的問題!!!!! –

1

嘗試在您的課程頁中添加addDep,因爲錯誤提示addDep缺失。

[20:33:25] Property 'addDep' does not exist on type 'CoursesPage'. 
    [20:33:25] Error at C:/Users/adirz/myapps/sceSchedule/.tmp/pages/courses-page/courses-page.ngfactory.ts:889:42 
    [20:33:25] Property 'addDep' does not exist on type 'CoursesPage'. 
+0

謝謝,這是我的錯。 –

+0

你能再次檢查我的文章嗎?它再次失敗 –