簡體   English   中英

科爾多瓦構建失敗(phonegap)

[英]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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM