![](/img/trans.png)
[英]Phonegap/Cordova BUILD FAILED ArrayIndexOutOfBoundsException: 1
[英]Cordova build failed (phonegap)
在我的应用程序中,我想添加google plus登录名。 我正在关注这个 github项目。 之后,我在config.xml中添加<gap:plugin>
标记,但是在此之后,当我尝试使用cordova build
命令为android平台构建应用程序时,它给了我一个错误。 错误快照如下。
我有两个与此问题有关的问题。
问题1:当我们由cordova create hello com.example.hello HelloWorld
使用cordova创建应用程序时,请cordova create hello com.example.hello HelloWorld
然后会创建许多config.xml文件。
首先进入= Hello-> config.xml
第二个=你好->平台-> android-> res-> xml-> config.xml
那么我需要在哪个config.xml
中添加<gap:plugin>
标记?
我正在添加这样的标签。
<gap:plugin name="cordova-plugin-googleplus" source="npm">
<param name="REVERSED_CLIENT_ID" value="myreversedclientid" />
</gap:plugin>
问题2:当我尝试使用cordova build
命令构建应用程序时,为什么会发生此错误? (仅当我在config.xml中包含gap:plugin
标记时才发生此错误)(xml-> Hello-> config.xml的位置)(有关错误,请查看错误快照)。
这是我的config.xml文件。
<?xml version='1.0' encoding='utf-8'?>
<widget id="com.example.hello" version="0.0.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<name>HelloWorld</name>
<description>
A sample Apache Cordova application that responds to the deviceready event.
</description>
<author email="dev@cordova.apache.org" href="http://cordova.io">
Apache Cordova Team
</author>
<content src="index.html" />
<plugin name="cordova-plugin-whitelist" version="1" />
<access origin="*" />
<allow-intent href="http://*/*" />
<allow-intent href="https://*/*" />
<allow-intent href="tel:*" />
<allow-intent href="sms:*" />
<allow-intent href="mailto:*" />
<allow-intent href="geo:*" />
<platform name="android">
<allow-intent href="market:*" />
</platform>
<platform name="ios">
<allow-intent href="itms:*" />
<allow-intent href="itms-apps:*" />
</platform>
<gap:plugin name="cordova-plugin-googleplus" source="npm">
<param name="REVERSED_CLIENT_ID" value="myreversedclientid" />
</gap:plugin>
</widget>
您不需要手动添加插件,只需执行
$ cordova plugin add cordova-plugin-googleplus --variable REVERSED_CLIENT_ID=myreversedclientid
这应该添加插件。 要检查已安装的插件,请执行
cordova plugin list
<gap:plugin name="nl.x-services.plugins.googleplus" version="1.0.7" />
仅将此行包含在您的config.xml中以添加google +插件。
您将在此处找到有关Phonegap 插件的所有插件信息。 google +是phonegap的第三方插件,因此,我建议您先阅读该插件的API。 您将在给定的插件链接中找到详细信息。
并且您需要将插件添加到发布的根config.xml中。 无需将其添加到平台config.xml
检查您是否还安装了“ Google Repository”。 样品负荷
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.