问题如下:

Failed to install 'ionic-plugin-keyboard': Error: ENOENT: no such file or directory, open '/Users/theo/Projects/mobile/platforms/android/AndroidManifest.xml'
at Object.fs.openSync (fs.js:651:18)
at Object.fs.readFileSync (fs.js:553:33)
at Object.parseElementtreeSync (/Users/theo/Projects/mobile/platforms/android/cordova/node_modules/cordova-common/src/util/xml-helpers.js:180:27)
at new AndroidManifest (/Users/theo/Projects/mobile/platforms/android/cordova/lib/AndroidManifest.js:29:20)
at AndroidProject.getPackageName (/Users/theo/Projects/mobile/platforms/android/cordova/lib/AndroidProject.js:99:12)
at Api.addPlugin (/Users/theo/Projects/mobile/platforms/android/cordova/Api.js:223:57)
at handleInstall (/Users/theo/.nvm/versions/node/v8.1.2/lib/node_modules/cordova/node_modules/cordova-lib/src/plugman/install.js:594:10)
at /Users/theo/.nvm/versions/node/v8.1.2/lib/node_modules/cordova/node_modules/cordova-lib/src/plugman/install.js:357:28
at _fulfilled (/Users/theo/.nvm/versions/node/v8.1.2/lib/node_modules/cordova/node_modules/q/q.js:787:54)
at self.promiseDispatch.done (/Users/theo/.nvm/versions/node/v8.1.2/lib/node_modules/cordova/node_modules/q/q.js:816:30)

这个问题的原因就是新版本的cordova 7.0.0及以上版本对于新的AndroidManifest.xml路径还没有更新,导致找不到AndroidManifest.xml,解决方法如下:

npm uninstall -g cordova
npm install -g cordova@6.5.0

即卸载新版本,安装7.0.0以下的版本,这时候再构建,问题解决。

上面的如果还解决不了的话可以再运行如下命令:

cordova platform rm android
cordova platform add android

通过删除Android的支持再添加回来,问题解决。

原文链接:https://github.com/ionic-team/ionic-plugin-keyboard/issues/304

还有另一种解决办法,这是Cordova官方的解决办法:

在config.xml将路径改为正确路径

<!-- An existing config.xml -->
<edit-config file="AndroidManifest.xml" target="/manifest/application" mode="merge"> <!-- needs to change to -->
<edit-config file="app/src/main/AndroidManifest.xml" target="/manifest/application" mode="merge">

链接:https://cordova.apache.org/announcements/2017/12/04/cordova-android-7.0.0.html

最新文章

  1. noip2016十连测题解
  2. 李洪强经典面试题145-Runloop
  3. a byte of python(摘02)
  4. 如何解决ASP.NET网站&#39;__doPostBack&#39; is undefined的脚本错误
  5. Set Font Properties On Mouse Hover Of Push Button And Text Items At Run time In Oracle Forms
  6. Java NIO 操作总结
  7. android 内部存储相关知识点: getfilestreampath getDir 子文件夹
  8. 重学前端 --- Promise里的代码为什么比setTimeout先执行?
  9. BBS论坛(三)
  10. 用Python实现一个词频统计(词云+图)
  11. 工控随笔_20_西门子_WinCC的VBS脚本_09_常量和流程控制_02
  12. 关于Selenium.common.exceptions.WebDriverException: Message: Invalid locator strategy: css selector 的问题
  13. idea护眼色设置
  14. Spark partitionBy
  15. 30 个 OpenStack 经典面试问题和解答
  16. Python开发【模块】:Celery 分布式异步消息任务队列
  17. Linux解压.tar .tgz .tar.gz .tar.Z等文件
  18. cocos2d-x 3.0 正式版 项目创建
  19. 数据对接—kettle使用之四
  20. ssh-copy-id 安全地复制公钥到远程服务器上

热门文章

  1. CCPC-Wannafly Winter Camp Day8 (Div2, onsite) 补题
  2. [USACO12FEB]牛券Cow Coupons(堆,贪心)
  3. linux中shell编辑小技巧
  4. Bootstarp-table入门(1)
  5. 跨域 (3) window.name
  6. JS中for循环嵌套
  7. mven pom.xml Overriding managed version 问题解决详解
  8. pluginManagement的坑
  9. codevs 5935 小球 x
  10. Anaconda安装PyTorch