2017-01-09 2 views
1

私はイオン2 RC4を実行しています。イオンランニングアンドロイドを実行するとアプリは動作しますが、デバイス準備は15-18秒後に実行されます。私はデバイスionic run android --prodで動こうとしましたが、クロムインスペクタでsqliteプラグインがインストールされていないことが示されています。これは真ではありません。別のページに行って戻ってくると、SQLiteから自分のデータが表示されます。Ionic2 RC4、プロダクションモードでプラグインを見つけられません

constructor is called 
main.js:1 Native: tried accessing the SQLite plugin but it's not installed. 
x @ main.js:1 
main.js:1 Install the SQLite plugin: 'ionic plugin add cordova-sqlite-storage' 
x @ main.js:1 
cordova.js:1223 deviceready has not fired after 5 seconds. 
cordova.js:1216 Channel not fired: onFileSystemPathsReady 
main.js:4 Native: deviceready did not fire within 2000ms. This can happen when plugins are in an inconsistent state. Try removing plugins from plugins/ and reinstalling them. 
(anonymous) @ main.js:4 
main.js:4 DEVICE READY FIRED AFTER 2684 ms 
error getting scheduled matches TypeError: Cannot read property 'executeSql' of undefined 
at _ (main.js:1) 
at main.js:1 
at main.js:1 
at new t (polyfills.js:3) 
at e (main.js:1) 
at s (main.js:1) 
at t.<anonymous> (main.js:1) 
at t.value [as executeSql] (main.js:1) 
at t.getScheduledMatches (main.js:9) 
at t.getMatchInfo (main.js:23) 

私はいくつかの異なる場所にデバイスの準備を整えようとしましたが、私は多くの場所でもログインしました。コンソールログはコンストラクタと呼ばれます。

constructor(public timeSince: TimeSinceService, 
    public platform: Platform) { 
    console.log("constructor is called"); //called 

    if(!this.isOpen){    
     this.db = new SQLite(); 
     this.db.openDatabase({name: "aces.db", location: "default"}).then(() => { 
      console.log("open Database"); // not called 

      this.db.executeSql('PRAGMA user_version = 0', []).then(()=>console.log("yesss")) // not called 
      this.db.executeSql('PRAGMA user_version', []).then(data => { 
       if(data.rows.item(0).user_version !== current_version){ 
       console.log("versions do not match"); 
       } 
      }) 

      this.db.executeSql('PRAGMA foreign_keys = ON', []).then(()=>{ 
       let query_matches = 'CREATE TABLE IF NOT EXISTS matches '+ 
           '(id INTEGER PRIMARY KEY AUTOINCREMENT,'+ 
           ...'; 
       let query_comments = 'CREATE TABLE IF NOT EXISTS comments '+ 
          '(id INTEGER PRIMARY KEY AUTOINCREMENT, '+ 
          ...'; 
       let query_points = 'CREATE TABLE IF NOT EXISTS undo'+ 
          '(point_id INTEGER PRIMARY KEY AUTOINCREMENT,'+ 
          ...'; 
       let query_organizations = 'CREATE TABLE IF NOT EXISTS organizations '... 
       let query_users = 'CREATE TABLE IF NOT EXISTS users '+ 
          '(id INTEGER PRIMARY KEY AUTOINCREMENT,'+ 
          ...'; 
       Promise.all([  
        this.db.executeSql(query_matches, {}).then(() => { 
         console.log("table created"); 
        }, (err) => console.error('Unable to execute sql for matches: ', err)), 
        this.db.executeSql(query_comments, {}).then(() => { 
         console.log("comment table created"); 
        }, (err) => console.error('Unable to execute sql for create comment table: ', err)), 
        this.db.executeSql(query_organizations, {}).then(() => { 
        console.log("table organizations created"); 
        }, (err) => console.error('Unable to execute sql: ', err)), 
        this.db.executeSql(query_points, {}).then(() => { 
         console.log("undo table created"); 
        }, (err) => console.error('Unable to execute sql for undo table: ', err)), 
        this.db.executeSql(query_users, {}).then(() => { 
         console.log("table users created"); 
         }, (err) => console.error('Unable to execute sql: ', err)) 
       ]).then(()=> { 
        console.log("called promise all"); 
        this.isOpen = true 
       }) 
      }) 
     }, (error) => console.log("ERROR couldn't open database from sqlite service: ", error)); 
    } 

} 

答えて

2

誰かが同じ問題に遭遇した場合に私自身の質問に答えます。

私はapp.component.ts内でDeviceReady内でrootPageを呼び出す必要がありました。私はそれが誰かに役立つことを願っています。

+1

私は解雇されていないdevicereadyと同じ問題を抱えています。 「call rootPage」とはどういう意味ですか? – Johncl

+1

変数rootPage = TabsPageを宣言するときに値を与えるのではなく、変数rootPageを宣言します。デバイス準備ができたら、rootPageに値を与えます。 – ACES

+0

私は同じ問題を抱えていて、あなたは私の日を救った。どうもありがとう。 –

関連する問題