phonegap-build / PushPlugin

This repository is deprecated head to phonegap/phonegap-push-plugin
https://github.com/phonegap/phonegap-plugin-push
MIT License
1.31k stars 1k forks source link

Error: grafting xml at selector "plugins" - Phonegap 3.0 #44

Open eoinmorgan opened 10 years ago

eoinmorgan commented 10 years ago

The plugman install method for 3.0 fails to insert xml into the AndroidManifest.xml and Config.xml files. Cordova also fails to insert the xml if I use the new CLI install method to add the plugin to the /plugins folder and allow phonegap to auto-load it on build. I couldn't get it to work after tinkering with the plugin.xml file, so maybe something else is going on with the new version?

I also can't get it to work using the manual instructions instead of the automatic build, but I don't think you can do that any more with the new version, anyway.

jdhiro commented 10 years ago

This is fixed in pull request #39 . I've been hoping one of the repo maintainers would pull this in, but I haven't seen any activity in here.

raix commented 10 years ago

:+1:

raix commented 10 years ago

@jdhiro Can confirm that your pr works with version 3 - Thanks! Not sure whats going on with "core"/adobe - should have made this package v3 ready

jdhiro commented 10 years ago

@raix Thanks for verifying.

I have two theories what's going on with Adobe. Either they are preparing changes as part of their upcoming PhoneGap Build 3.0 rollout, or they are backing away from plugin development since PGB 3.0 can use custom plugins. Either way, it's a little disheartening to see the lack of engagement here.

svdoever commented 10 years ago

I did the following to get the plugin install to complete on an android/wp8 platform install (installed using cordova-cli):

Make sure your file [APPFOLDER]\platforms\android\res\xml\config.xml has an (empty) xml node . This was not available in the initially created config.xml. So make sure your config.xml looks something like:

<?xml version='1.0' encoding='utf-8'?>
<widget id="io.cordova.helloCordova" version="2.0.0" xmlns="http://www.w3.org/ns/widgets">
    <name>Hello Cordova</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" />
    <feature name="App">
        <param name="android-package" value="org.apache.cordova.App" />
    </feature>
    <access origin="*" />
    <preference name="useBrowserHistory" value="true" />
    <preference name="exit-on-suspend" value="false" />
    <preference name="fullscreen" value="true" />
    <preference name="webviewbounce" value="true" />
    <plugins>
    </plugins>
</widget>

If an install failed before I removed the following files:

Then execute in your command prompt the following command:

cordova plugin add https://github.com/phonegap-build/PushPlugin.git -d

This results in the following output:

C:\Users\serge\Dropbox\Projects\PhonegapApps\EventPusher>cordova plugin add https://github.com/phonegap-build/PushPlugin.git -d
Calling plugman.fetch on plugin "https://github.com/phonegap-build/PushPlugin.git"
Fetching plugin from location "https://github.com/phonegap-build/PushPlugin.git"...
Fetching plugin via git-clone command: git clone "https://github.com/phonegap-build/PushPlugin.git" "plugman-tmp1376868499006"
Plugin "https://github.com/phonegap-build/PushPlugin.git" fetched.
Copying fetched plugin over "C:\Users\serge\Dropbox\Projects\PhonegapApps\EventPusher\plugins\com.adobe.plugins.PushPlugin"...
skipping existing file: pushAPNS.rb
skipping existing file: pushGCM.rb
skipping existing file: beep.wav
skipping existing file: index.html
skipping existing file: jquery_1.5.2.min.js
skipping existing file: PushNotification.js
cp: dest file already exists: C:\Users\serge\Dropbox\Projects\PhonegapApps\EventPusher\plugins\com.adobe.plugins.PushPlugin\MIT-LICENSE

cp: dest file already exists: C:\Users\serge\Dropbox\Projects\PhonegapApps\EventPusher\plugins\com.adobe.plugins.PushPlugin\MIT-LICENSE
cp: dest file already exists: C:\Users\serge\Dropbox\Projects\PhonegapApps\EventPusher\plugins\com.adobe.plugins.PushPlugin\plugin.xml

cp: dest file already exists: C:\Users\serge\Dropbox\Projects\PhonegapApps\EventPusher\plugins\com.adobe.plugins.PushPlugin\MIT-LICENSE
cp: dest file already exists: C:\Users\serge\Dropbox\Projects\PhonegapApps\EventPusher\plugins\com.adobe.plugins.PushPlugin\plugin.xml
cp: dest file already exists: C:\Users\serge\Dropbox\Projects\PhonegapApps\EventPusher\plugins\com.adobe.plugins.PushPlugin\README.md

skipping existing file: genericpush.tests.js
skipping existing file: HtmlReporter.js
skipping existing file: HtmlReporterHelpers.js
skipping existing file: ReporterView.js
skipping existing file: SpecView.js
skipping existing file: SuiteView.js
skipping existing file: TrivialReporter.js
skipping existing file: index.html
skipping existing file: jasmine.css
skipping existing file: jasmine.js
skipping existing file: test-runner.js
skipping existing file: android-support-v13.jar
skipping existing file: CordovaGCMBroadcastReceiver.java
skipping existing file: GCMIntentService.java
skipping existing file: PushHandlerActivity.java
skipping existing file: PushPlugin.java
skipping existing file: gcm.jar
skipping existing file: AppDelegate+notification.h
skipping existing file: AppDelegate+notification.m
skipping existing file: PushPlugin.h
skipping existing file: PushPlugin.m
skipping existing file: PushNotification.js
Plugin "com.adobe.plugins.PushPlugin" fetched.
Calling plugman.install on plugin "C:\Users\serge\Dropbox\Projects\PhonegapApps\EventPusher\plugins\com.adobe.plugins.PushPlugin" for platform "android" with options "{"www_dir":"C:\\Users\\serge\\Dropbox\\Projects\\PhonegapApps\\EventPusher\\platforms\\android\\.staging\\www","cli_variables":{}}"
Starting installation of "com.adobe.plugins.PushPlugin"...
Calling plugman.install on plugin "C:\Users\serge\Dropbox\Projects\PhonegapApps\EventPusher\plugins\com.adobe.plugins.PushPlugin" for platform "wp8" with options "{"www_dir":"C:\\Users\\serge\\Dropbox\\Projects\\PhonegapApps\\EventPusher\\platforms\\wp8\\.staging\\www","cli_variables":{}}"
Starting installation of "com.adobe.plugins.PushPlugin"...

Note that a lot of files already existed due to a previous install, but at least no errors are given.

The xml.config is not adjusted, so I edited it and added the following line as descibed in the documentation. No clue yet if it should be in a node, this only stopped the grafting xml at selector "plugins".

<plugin name="PushPlugin" value="com.plugin.gcm.PushPlugin" />

The file https://github.com/phonegap-build/PushPlugin/blob/master/plugin.xml describes the modifications to be made to the different xml files, the changes to AndroidManifest.xml are correctly executed.

Next step is to get it all working, but at least it installed without errors....