简体   繁体   中英

Error using cordova plugin

I'm trying to show ads in a cordova app with the admob cordova plugin (from https://github.com/appfeel/admob-google-cordova ). I've been trying with:

cordova plugin add com.admob.google
cordova plugin add https://github.com/appfeel/admob-google-cordova

But I'm getting this error:

Fetching plugin "com.admob.google" via plugin registry
npm http GET http://registry.cordova.io/com.admob.google
npm http 304 http://registry.cordova.io/com.admob.google
Installing "com.admob.google" for android
Failed to install 'com.admob.google':TypeError: Cannot read property '1' of undefined
    at findall (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/node_modules/elementtree/lib/elementpath.js:283:20)
    at Object.find (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/node_modules/elementtree/lib/elementpath.js:321:24)
    at Element.find (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/node_modules/elementtree/lib/elementtree.js:123:22)
    at ElementTree.find (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/node_modules/elementtree/lib/elementtree.js:273:21)
    at resolveParent (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/util/xml-helpers.js:180:22)
    at Object.module.exports.graftXML (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/util/xml-helpers.js:74:22)
    at ConfigFile_graft_child [as graft_child] (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/plugman/util/config-changes.js:589:30)
    at PlatformMunger_apply_file_munge [as apply_file_munge] (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/plugman/util/config-changes.js:170:38)
    at PlatformMunger.add_plugin_changes (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/plugman/util/config-changes.js:270:14)
    at /usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/plugman/util/config-changes.js:393:14
TypeError: Cannot read property '1' of undefined
    at findall (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/node_modules/elementtree/lib/elementpath.js:283:20)
    at Object.find (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/node_modules/elementtree/lib/elementpath.js:321:24)
    at Element.find (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/node_modules/elementtree/lib/elementtree.js:123:22)
    at ElementTree.find (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/node_modules/elementtree/lib/elementtree.js:273:21)
    at resolveParent (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/util/xml-helpers.js:180:22)
    at Object.module.exports.graftXML (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/util/xml-helpers.js:74:22)
    at ConfigFile_graft_child [as graft_child] (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/plugman/util/config-changes.js:589:30)
    at PlatformMunger_apply_file_munge [as apply_file_munge] (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/plugman/util/config-changes.js:170:38)
    at PlatformMunger.add_plugin_changes (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/plugman/util/config-changes.js:270:14)
    at /usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/plugman/util/config-changes.js:393:14

I'm the maintainer of this plugin. It was a bug produced when res/values/strings.xml wasn't existing in android platform (the plugin was trying to append this file). It's been solved. Right now should work with version 1.0.7 already plublished in cordova plugin registry.

Try

cordova plugin add cordova-plugin-admob-simple

and see https://github.com/sunnycupertino/cordova-plugin-admob-simple for docs.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM