简体   繁体   中英

Cordova build failed (phonegap)

In my app i want to add google plus login. I am following this github project. After that I add <gap:plugin> tag in config.xml but after this when i try to build app for android platform by using cordova build command it gives me an error. Error snapshot given below.

建立错误

I have two questions related to this question.

Question1: When we create app using cordova by cordova create hello com.example.hello HelloWorld then many config.xml files created.

First in= Hello--> config.xml
Second in= hello-->platforms-->android-->res-->xml-->config.xml

So in which config.xml I need to add <gap:plugin> tag?

I am adding tag like this.

<gap:plugin name="cordova-plugin-googleplus" source="npm">
  <param name="REVERSED_CLIENT_ID" value="myreversedclientid" />
</gap:plugin>



Question2: Why is this error occurred when i try to build app using cordova build command? (This error only occurred when i include gap:plugin tag in config.xml) (position of xml-->Hello--> config.xml) (for error look at error snapshot).



Here is my config.xml file.

<?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>

You shouldn't need to add the plugin manually, you can just do

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

This should add the plugin. To check your installed plugins, do

cordova plugin list
<gap:plugin name="nl.x-services.plugins.googleplus" version="1.0.7" />

include only this line into your config.xml for adding google+ plugin.

You will find all plugin information for Phonegap Plugins here. google+ is third party plugin for phonegap, so I will recommend you to read API for plugin first. You will find details at given link for plugins.

And you need to add plugins into your root config.xml which you posted. No need to add it to platform config.xml

Check if you also installed the "Google Repository". sample load

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM