android - Cordova Admob Pro - PLAY_SERVICES_VERSION 错误
问题描述
我正在我的项目上设置 Cordova Admob Pro ( https://github.com/floatinghotpot/cordova-admob-pro ),并且在构建 ( https://build.phonegap.com )时出现错误
错误:
Could not get unknown property 'PLAY_SERVICES_VERSION' for object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler
.
我的代码:
function adSetter(){
alert(navigator.userAgent);
var admobid = {};
// select the right Ad Id according to platform
if( /(android)/i.test(navigator.userAgent) ) {
admobid = { // for Android
banner: 'ca-app-pub-6869992474017983/9375997553',
interstitial: 'ca-app-pub-6869992474017983/1657046752'
};
} else if(/(ipod|iphone|ipad)/i.test(navigator.userAgent)) {
admobid = { // for iOS
banner: 'ca-app-pub-6869992474017983/4806197152',
interstitial: 'ca-app-pub-6869992474017983/7563979554'
};
} else {
admobid = { // for Windows Phone
banner: 'ca-app-pub-6869992474017983/8878394753',
interstitial: 'ca-app-pub-6869992474017983/1355127956'
};
}
if(AdMob) AdMob.createBanner( {
isTesting:true, //Remove this Before publishing your app
adId:admobid.banner,
position:AdMob.AD_POSITION.BOTTOM_CENTER,
autoShow:true} );
}
function onDeviceReady(){
alert("device ready");
adSetter();
}
window.load=function(){
document.addEventListener("deviceready", onDeviceReady, false);
}
配置:
<plugin name="cordova-plugin-admobpro" spec="^2.35.3">
<variable name="PLAY_SERVICES_VERSION" value="16.0.0" />
</plugin>
<engine name="android" spec="~7.1.4" />
<engine name="ios" spec="~4.5.5" />
解决方案
推荐阅读
- javascript - 当formatOnSave为真时,如何在Visual Studio代码中的javascript文件中格式化json?
- vb.net - 文件同步 Visual Studio 2015 报错
- html - 如何将一段文本与一堆可点击的精灵图像对齐在同一行?
- angular - 找不到“数字”类型的不同支持对象“1”。NgFor 仅支持绑定到 Iterables,例如 Arrays
- django - Django:在一段时间后更新模型属性
- javascript - 在斜杠(“/”)字符之前和之后反转字符串
- selenium - Selenium:如何断言图像显示在网页的某个部分下
- javascript - var {todo}= require("./models/todo"); 有什么区别?和 var todo=require("./models/todo");
- r - R Boot函数在包装在函数中时产生错误
- reactjs - 使用数组映射函数将 JSX 格式化为渲染