ionic3構建過程中遇到的找不到AndroidManifest.xml的問題

來源:互聯網
上載者:User

標籤:obj   遇到   post   image   node   hand   新版本   log   failed   

問題如下:

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 cordovanpm install -g [email protected]

即卸載新版本,安裝7.0.0以下的版本,這時候再構建,問題解決。

原文連結: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

ionic3構建過程中遇到的找不到AndroidManifest.xml的問題

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.