Im creating a hybrid mobile app using cordova .
I add the cordova-contacts and cordova-calendar plugins to the project and these are getting reflected in the android.json and the features are being listed under platforms/android/res/xml/config.xml .
I build the apk using
grunt build --platform=android
After i get the android-debug.apk on decompiling , I find that the Manifest file contains all the read and write permissions and the plugins seem to be present.
But in the js viewModels of the hybrid app, the plugins are not being found .
Error : Undefined
var options = new ContactFindOptions()
Steps followed :
In the cordova project ,
cordova plugin add cordova-plugin-contacts
Verified that the changes are seen in config and .json files .
Is there any linkage steps which I have missed ? Is it necessary that the cordova plugins be available in the Gruntfile.js ?
UPDATE : Cordova plugin versions ::
cordova-plugin-calendar:4.5.5, cordova-plugin-contacts:2.2.1
On browsing some more , have found that certain versions of the plugin were pointing to incorrect js files. Is it the same case here ?
The packaging done by grunt to create an apk is such that , when the app is installed and deployed on a device , cordova.js is injected into the base html page.
Then inside cordova.js we find the getPathPrefixMethod() which is recursing through all the script tags to find cordova.js . This path prefix is used for finding the cordova_plugins.js as well.
If we add explicit cordova.js script tags , our plugins will most likely not get picked up.
During debugging with emulator and chrome , noticed the issue.
Hope this helps. Thanks .