【问题标题】:Cordova build failed (phonegap)Cordova 构建失败(phonegap)
【发布时间】:2016-07-06 18:26:26
【问题描述】:

在我的应用程序中,我想添加 google plus 登录。我关注this github项目。之后,我在 config.xml 中添加了 <gap:plugin> 标签,但是在此之后,当我尝试使用 cordova build 命令为 android 平台构建应用程序时,它给了我一个错误。下面给出了错误快照。

我有两个与此问题相关的问题。

问题1:当我们使用cordova create hello com.example.hello HelloWorld 使用cordova 创建应用程序时,会创建许多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>

【问题讨论】:

  • 发布您的 config.xml
  • @sunil sunil 我在我的问题中添加了 config.xml

标签: android xml cordova phonegap-plugins phonegap-build


【解决方案1】:

你应该不需要手动添加插件,你可以这样做

$ cordova plugin add cordova-plugin-googleplus --variable REVERSED_CLIENT_ID=myreversedclientid

这应该添加插件。要检查您安装的插件,请执行

cordova plugin list

【讨论】:

  • github.com/EddyVerbruggen/cordova-plugin-googleplus 在此链接中的第 5 点他们说需要在安装应用程序后在 config.xml 中添加插件标签????
  • 如果你使用的是phonegap(现在是cordova),你不是。您可能想了解一下 phonegap 和 cordova 的历史,以了解它们是什么。
【解决方案2】:
<gap:plugin name="nl.x-services.plugins.googleplus" version="1.0.7" />

在 config.xml 中仅包含这一行以添加 google+ 插件。

您将在此处找到 Phonegap Plugins 的所有插件信息。 google+ 是 phonegap 的第三方插件,所以我建议你先阅读插件的 API。您将在给定的插件链接中找到详细信息。

您需要将插件添加到您发布的根 config.xml 中。无需添加到平台config.xml中

【讨论】:

    【解决方案3】:

    检查您是否还安装了“Google 存储库”。sample load

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2014-09-08
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-04-20
      • 1970-01-01
      • 2018-10-07
      • 1970-01-01
      相关资源
      最近更新 更多