Monaca Onsen UI Discord Chat Github Repo

Dialogflow (fka Api.ai): error during build



  • Hi!
    I’m trying to develop an app that uses Dialogflow and it gives an error when building for Android:

    Discovered plugin "cordova-plugin-apiai" in config.xml. Adding it to the project
    Installing "cordova-plugin-apiai" for android
    Error during processing of action! Attempting to revert...
    Failed to install 'cordova-plugin-apiai': Error: Uh oh!
    ENOENT: no such file or directory, open '/private/tmp/monaca/5b104b68e788851845dba6ce/project/plugins/cordova-plugin-apiai/www/lib/q.js'
        at Object.fs.openSync (fs.js:646:18)
        at Object.fs.readFileSync (fs.js:551:33)
        at install (/private/tmp/monaca/5b104b68e788851845dba6ce/project/platforms/android/cordova/lib/pluginHandlers.js:173:36)
        at ActionStack.process (/private/tmp/monaca/5b104b68e788851845dba6ce/project/platforms/android/cordova/node_modules/cordova-common/src/ActionStack.js:56:25)
        at PluginManager.doOperation (/private/tmp/monaca/5b104b68e788851845dba6ce/project/platforms/android/cordova/node_modules/cordova-common/src/PluginManager.js:114:20)
        at PluginManager.addPlugin (/private/tmp/monaca/5b104b68e788851845dba6ce/project/platforms/android/cordova/node_modules/cordova-common/src/PluginManager.js:144:17)
        at /private/tmp/monaca/5b104b68e788851845dba6ce/project/platforms/android/cordova/Api.js:243:74
        at _fulfilled (/private/tmp/monaca/5b104b68e788851845dba6ce/project/platforms/android/cordova/node_modules/q/q.js:854:54)
        at self.promiseDispatch.done (/private/tmp/monaca/5b104b68e788851845dba6ce/project/platforms/android/cordova/node_modules/q/q.js:883:30)
        at Promise.promise.promiseDispatch (/private/tmp/monaca/5b104b68e788851845dba6ce/project/platforms/android/cordova/node_modules/q/q.js:816:13)
    Failed to restore plugin "cordova-plugin-apiai" from config.xml. You might need to try adding it again.
    

    Note that I’m using the latest Cordova version (7.1.0) and imported the official Dialogflow client (dialogflow-cordova-client).
    As a test, I’ve imported the project mentioned in this great article and it works although it uses a very old Cordova version (6.2.0).
    Anyone knows how to fix this? Thanks in advance!


  • Monaca

    @rcpinheiro Hi based on your build error, I think you didn’t import the plugin properly. It seems like you imported the plugin via config.xml file. Please import the plugin through the GUI instead by going to Configure --> Manage Cordova Plugins. Then, click on Import Cordova Plugin button.



  • Thanks for the reply but that’s not it, I have the plugin loaded that way (ApiAiSDK 1.7.4).
    It seems there’s a compatibility problem between the plugin and Cordova 7.1.0 (or Monaca) since the same plugin works with Cordova 6.2.0.


  • Monaca

    @rcpinheiro I’ve tested this plugin with Cordova 7.1 and the builds were successful for both iOS and Android. If you have made any configuration related to this plugin in config.xml file, please remove it. That might be the reason why your build failed.