在Admob SDK的新更新中,现在我们需要将谷歌播放服务项目导入到我们的项目中来实现应用程序的广告展示和赚取利润。我正在使用Apache Cordova/ Phonegap创建一个应用程序,并且我用它创建了Android项目,一切都很好。然后我打开Cordova生成的Android项目,导入了Google Play服务lib项目,并添加了我需要展示广告的所有本地代码,然后......太好了! 在模拟器上测试正常,设备上更好!但是现在,当我更新cordova /www文件夹中的代码并尝试运行命令时:
cordova build android
,我总是会遇到构建错误。所以每次我需要更新我的代码并更新Android项目时,我都需要删除Cordova生成的本地Android项目中插入的所有Google Play服务引用和代码,运行构建命令,然后再次添加所有内容,这有点烦人。有人已经通过这个问题吗?有没有更好的解决方案?我得到的错误是这个:BUILD FAILED
/Users/matheus/Development/adt-bundle-mac/sdk/tools/ant/build.xml:601: Invalid file: /Users/matheus/Development/google-play-services_lib/build.xml
Total time: 1 second
Error code 1 for command: ant with args: debug,-f,/Users/matheus/Development/phonegap_projects/TabFipeFree/platforms/android/build.xml,-Dout.dir=ant-build,-Dgen.absolute.dir=ant-gen
Error: /Users/matheus/Development/phonegap_projects/TabFipeFree/platforms/android/cordova/build: Command failed with exit code 2
at ChildProcess.whenDone (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/cordova/superspawn.js:131:23)
at ChildProcess.EventEmitter.emit (events.js:98:17)
at maybeClose (child_process.js:753:16)
at Process.ChildProcess._handle.onexit (child_process.js:820:5)