Janki Sata
Janki Sata

Reputation: 51

getting 2-3 popups while running cordova app given in description and then browser stucks

gap_init:2 
gap:[null,"CoreAndroid","messageChannel","CoreAndroid1594682113"] 
gap:[null,"CoreAndroid","show","CoreAndroid1594682114"]

I am trying to develop Cordova app with angular js 2.0 I have created Cordova hello world and angular js 2.0 hello world then I have merged both the things

But while running the app these popups are generated and then nothing happens

Upvotes: 0

Views: 332

Answers (1)

Parth Ghiya
Parth Ghiya

Reputation: 6949

You make project using angular-cli, You make one cordova project Then in your angular-cli.json file -> change the path to cordova's www folder.

Then when you do ng prod build, your resources would be copied to cordova's www folder.

I wrote one cordova hook for the same,

const fs = require('fs');
const execSync = require('child_process').execSync;



module.exports = function(context) {
    const basePath = context.opts.projectRoot;
    const baseWWW = basePath + '/www';

process.chdir('../bmi-surgical-app');
console.log(`New directory: ${process.cwd()}`);

    execSync("ng build --prod --base-href .",{stdio:[0,1,2]});

    var files = fs.readdirSync(baseWWW);
    for (var i = 0; i < files.length; i++) {
      if (files[i].endsWith('.gz')) {
        fs.unlinkSync(baseWWW + '/' + files[i]);
      }
    }
    fs.writeFileSync(baseWWW + '/.gitignore', `# Ignore everything in this directory

*
# Except this file
!.gitignore
`);


};

However many better options are available like NativeScript & Ionic 2.

Upvotes: 1

Related Questions