Issue with Cordova Plugin from Github


#1

Hi folks,

i’ve installed a cordova plugin with the usual syntax

meteor add cordova:cc.fovea.cordova.purchase@3.10.1

this plugin requires a configuration setting that i’ve done with

App.configurePlugin('cordova:cc.fovea.cordova.purchase', {
  BILLING_KEY : MY_KEY
});

and it works.

Now i want to try a most recent version of this one so accordingly to THIS i’ve installed a tarball with

meteor add cordova:cc.fovea.cordova.purchase@https://github.com/j3k0/cordova-plugin-purchase/tarball/2b75e86979b1cc24aaa87ad4c15a77414f70269e

and it works BUT when i try to build my app with meteor build i’ve the following error

Error while building for mobile platforms: Error running                           
/Users/giggioz/.meteor/packages/meteor-tool/.1.1.3.1ui9e5i++os.osx.x86_64+web.browser+web.cordova/mt-os.osx.x86_64/tools/cordova-scripts/cordova.sh
Failed to install 'cc.fovea.cordova.purchase':Error: Variable(s) missing: BILLING_KEY
at
/Users/giggioz/.meteor/packages/meteor-tool/.1.1.3.1ui9e5i++os.osx.x86_64+web.browser+web.cordova/mt-os.osx.x86_64/dev_bundle/lib/node_modules/cordova/node_modules/cordova-lib/src/plugman/install.js:304:23
at _fulfilled (/Users/giggioz/.meteor/packages/meteor-tool/.1.1.3.1ui9e5i++os.osx.x86_64+web.browser+web.cordova/mt-os.osx.x86_64/dev_bundle/lib/node_modules/cordova/node_modules/q/q.js:787:54)
at self.promiseDispatch.done
(/Users/giggioz/.meteor/packages/meteor-tool/.1.1.3.1ui9e5i++os.osx.x86_64+web.browser+web.cordova/mt-os.osx.x86_64/dev_bundle/lib/node_modules/cordova/node_modules/q/q.js:816:30)
at Promise.promise.promiseDispatch
(/Users/giggioz/.meteor/packages/meteor-tool/.1.1.3.1ui9e5i++os.osx.x86_64+web.browser+web.cordova/mt-os.osx.x86_64/dev_bundle/lib/node_modules/cordova/node_modules/q/q.js:749:13)
at /Users/giggioz/.meteor/packages/meteor-tool/.1.1.3.1ui9e5i++os.osx.x86_64+web.browser+web.cordova/mt-os.osx.x86_64/dev_bundle/lib/node_modules/cordova/node_modules/q/q.js:557:44
at flush (/Users/giggioz/.meteor/packages/meteor-tool/.1.1.3.1ui9e5i++os.osx.x86_64+web.browser+web.cordova/mt-os.osx.x86_64/dev_bundle/lib/node_modules/cordova/node_modules/q/q.js:108:17)
at process._tickCallback (node.js:442:13)
Error: Variable(s) missing: BILLING_KEY
at
/Users/giggioz/.meteor/packages/meteor-tool/.1.1.3.1ui9e5i++os.osx.x86_64+web.browser+web.cordova/mt-os.osx.x86_64/dev_bundle/lib/node_modules/cordova/node_modules/cordova-lib/src/plugman/install.js:304:23
at _fulfilled (/Users/giggioz/.meteor/packages/meteor-tool/.1.1.3.1ui9e5i++os.osx.x86_64+web.browser+web.cordova/mt-os.osx.x86_64/dev_bundle/lib/node_modules/cordova/node_modules/q/q.js:787:54)
at self.promiseDispatch.done
(/Users/giggioz/.meteor/packages/meteor-tool/.1.1.3.1ui9e5i++os.osx.x86_64+web.browser+web.cordova/mt-os.osx.x86_64/dev_bundle/lib/node_modules/cordova/node_modules/q/q.js:816:30)
at Promise.promise.promiseDispatch
(/Users/giggioz/.meteor/packages/meteor-tool/.1.1.3.1ui9e5i++os.osx.x86_64+web.browser+web.cordova/mt-os.osx.x86_64/dev_bundle/lib/node_modules/cordova/node_modules/q/q.js:749:13)
at /Users/giggioz/.meteor/packages/meteor-tool/.1.1.3.1ui9e5i++os.osx.x86_64+web.browser+web.cordova/mt-os.osx.x86_64/dev_bundle/lib/node_modules/cordova/node_modules/q/q.js:557:44
at flush (/Users/giggioz/.meteor/packages/meteor-tool/.1.1.3.1ui9e5i++os.osx.x86_64+web.browser+web.cordova/mt-os.osx.x86_64/dev_bundle/lib/node_modules/cordova/node_modules/q/q.js:108:17)
at process._tickCallback (node.js:442:13)


Installing "cc.fovea.cordova.purchase" for android

As you can see it seems like it does not see the configuration setting of my

App.configurePlugin('cordova:cc.fovea.cordova.purchase', {
      BILLING_KEY : MY_KEY
    });

Can you figure out why this error?

Thanks in advance.


Best way to do In-App Purchases on Meteor app?
#2

I’m still having this issue… can someone help me on this please?

Thanks!


#3

I have also recently failed to get this plugin to work for Android devices. I failed differently than you did though. For me the app always finished building but would keep the default ‘BILLING_KEY’ that is a placeholder in the plugin. This throws ‘signature verification failed’ to the device even though purchase works to the point of charging a customer. After seeing the error I found the wrong signature showing up in the cordova-build files.

From my reading of the plugin docs, I think setting the ‘BILLING_KEY’ in config.xml is deprecated (you notice that link goes to a different plugin but that plugin is used by fovea.cordova.purchase which was originally ios only to add Android purchases). As of 3.10.1, it must be passed using --variable when the plugin is added. I don’t think arguments can be passed in Meteor when adding plugins so I pinned my app to version 3.9.1, added a line like yours in mobile-config.js, but the result was still failing to put the correct key in the built files.

In mobile-config.js the plugin I referenced was ‘cc.fovea.cordova.purchase’ without ‘cordova:’ as you have done. I think that adding ‘cordova:’ is only when calling meteor add from my read of the docs, but I could be wrong.

Anyway, more commiseration than a solution but maybe some of my experience is helpful.


#4

First of all : thanks.

Your suggestion is right, if you add a cordova plugin from a git commit you then need only to use

App.configuePlugin like this:

App.configurePlugin('cc.fovea.cordova.purchase', {
      BILLING_KEY : MY_KEY
    });

It builds! (happyness)

Now we can specifically talk about this plugin :smile:

I’ve read a lot of the issues in the plugin/git page and the last suggestions are :

  1. Install one of the last commit of the plugin (i’m using the one i wrote on the first post)

  2. change manually the billing_key_param.xml in your_build_dir/android/project/res/values to force your billing key
    i.e:

    <?xml version='1.0' encoding='utf-8'?> MY_KEY

Now, for the first time (using this tarball) i see the billing_key_param.xml as expected, so i did not change anything a proceded to sign the apk and put it on google play.

I’ll keep you posted once it will get available to see it works.

Another related question : how can we test the plugin functionalities in new apk without pushing it on google play?

I thought the following :

  • build you apk with the same version of the one published on google play
  • sign it
  • install it on mobile

In your opinion could it work ?