The following is what I did to setup Ionic in Chrome App for Mobile:
cca create projectname
ionic start projectname_ionic
find projectname/www/* -not -name 'manifest*' | grep -v 'background.js' | xargs rm -rf
cp -r projectname_ionic/www/* projectname/www/
<script src="cordova.js"></script>
at projectname/www/index.html since cca automatically inject it alreadyWhen trying to run the project I get the following error from app.js line 14 -
Uncaught TypeError: Cannot read property 'Keyboard' of undefined
When typing at the console of Chrome dev tools (remote debugging) window.cordova
I do get an existing object, so the problem is that window.cordova.plugins is undefined.
btw the app itself does load up at the mobile and I can switch tabs, but at the Friends tab when I click on a name I do see that it got clicked but nothing happen beside that.
I also tried the following:
ionic platform add android
at projectname_ionic/ before copying the filesAnyone got an idea what should I do?
Thanks in advance!
I started getting the same error after removing plugins directory (I had a hook that was adding the plugins as part of the add platform). There are 3 plugins that ionic adds for a new project. I did not have keyboard and console ones as part of my hook.
Check that you have following cordova plugins:
cordova plugin add com.ionic.keyboard
cordova plugin add org.apache.cordova.console
cordova plugin add org.apache.cordova.device
Once I added missing plugins to the ones added by hook the error was gone.
Also, if node_modules was removed, npm install
will be needed.
It sounds like you're not running this as an actual build -- are you using CADT? Even if you're testing with CADT on a device you will still NOT get window.cordova.plugins
. Once you build the project with cca build
and then install the apk on a device then the window.cordova.plugins
will be defined.
Hatzlacha