cordova inappbilling error package.json is invalid

2019-09-05 21:50发布

问题:

I am developing a cordova based app.

When I am trying to add this plugin I am getting this error

Error:Invalid package.json

https://github.com/poiuytrez/AndroidInAppBilling

I followed this

Here is my code

cordova plugin add C:/Users/xxxxx/fbapp/plugins/AndroidInAppBilling --variable BILLING_KEY="xxxxxxxxxxxxxxxxxxxxxxxxxxx"

回答1:

I followed the steps below to make it work:

  • Download the plugin from github and saved the exploded folder (AndroidInAppBilling-master) in C:\ drive

  • Navigate to project root directory and execute the following command:

cordova plugin add C:\AndroidInAppBilling-master --variable BILLING_KEY="TEST_BILLING_KEY"

In your case it would have thrown the error: Error: Invalid package.json because the exploded folder name is AndroidInAppBilling-master not AndroidInAppBilling

If you wanna use the same command to make it work, then rename the exploded folder to AndroidInAppBilling.