我正在使用cordova-admob-pro plugin在我的应用程序上展示广告,最近google宣布要求更新android应用程序以定位android oreo(API级别26)或更高。所以我将cordova更新到了最新版本(8),并添加了android平台最新的@ 7.0.1,然后admob插件给出了此错误:
Failed to install 'cordova-plugin-admobpro': Error: ENOENT: no such file or directory, open '(myapppath)\platforms\android\AndroidManifest.xml'
at Object.fs.openSync (fs.js:648:18)
at Object.fs.readFileSync (fs.js:553:33)
at Object.parseElementtreeSync ( (myapppath) \platforms\android\cordova\node_modules\cordova-common\src\util\xml-helpers.js:180:27)
at new AndroidManifest ( (myapppath) \platforms\android\cordova\lib\AndroidManifest.js:29:20)
at AndroidProject.getPackageName (myapppath) \platforms\android\cordova\lib\AndroidProject.js:99:12)
at Api.addPlugin ( (myapppath) \platforms\android\cordova\Api.js:223:57)
at handleInstall (C:\Users\mypc\AppData\Roaming\npm\node_modules\cordova\node_modules\cordova-lib\src\plugman\install.js:594:10)
at C:\Users\mypc\AppData\Roaming\npm\node_modules\cordova\node_modules\cordova-lib\src\plugman\install.js:357:28
at _fulfilled (C:\Users\mypc\AppData\Roaming\npm\node_modules\cordova\node_modules\cordova-lib\node_modules\q\q.js:787:54)
at self.promiseDispatch.done (C:\Users\mypc\AppData\Roaming\npm\node_modules\cordova\node_modules\cordova-lib\node_modules\q\q.js:816:30)
(node:5328) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: ENOENT: no such file or directory, open ' (myapppath) \platforms\android\AndroidManifest.xml'
(node:5328) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
答案 0 :(得分:2)
解决方案正在使用另一个插件 cordova-plugin-admob-free 以及该插件的离子本机。
我为此做了一个演示,并将其发布在github上: ionic-admob-demo