1

I'm building a Cordova web app using Visual Studio 2015. I'm trying to add the Amazon Mobile Ads Cordova plugin to the project manually. The following lists the steps I am following, and (at the end) the error I keep getting:

 1. I download Amazon Mobile Ads SDK from Amazon Developer site.
 2. I unzip the plugin contained within the SDK zip file into its own directory:
    C:\AmazonSDK
    (In other words, C:\AmazonSDK is where plugin.xml is located.)
 3. I create a new Cordova app project in Visual Studio called MyCordovaApp.
 4. I double-click on config.xml in Visual Studio to bring up the designer.
 5. I select "PlugIns", and then I select Custom.
 6. I choose "Local", and then browse to the plugin directory C:\AmazonSDK.
 7. I click on "Add".

The process fails and I get this error in the output console:

 Error: Registry returned 404 for GET on https://registry.npmjs.org/MyCordovaApp

I've also tried manually adding the plugin from the command line by navigating to the Visual Studio project folder and executing:

cordova plugin add C:\AmazonSDK

I get the same error as stated above.

Any ideas on how to resolve this? I surmise that Cordova is looking at the project name in my config.xml file (i.e. "MyCordovaApp"), and then looking for a registry entry at registry.npmjs.org, but I'm not clear why it's doing this or how to add this plugin.

UPDATE: Here is the complete Visual Studio console output, along with the error (and as you can see, the actual directory location of my plugin is a little different from what I listed in the original question):

Visual Studio console output

2 Answers2

1

Of course, the solution to the error described above had to be something silly. The error occurred because I used spaces in my original path to my plugin:

ORIGINAL PATH: C:\Amazon Mobile Ad Cordova SDK\Amazon-Cordova-SDKs\AmazonMobileAds

NEW PATH: C:\Amazon-Mobile-Ad-Cordova-SDK\Amazon-Cordova-SDKs\AmazonMobileAds

With the new path (and no spaces), the install completed successfully!

0

I followed your steps and reproduced the issue, after checking of the plugin.xml file. I found there is an empty line ahead of <?xml version="1.0" encoding="UTF-8"?>, which prevents VS from parsing the file.

Deleting this empty line will resolve the issue.

Elvis Xia - MSFT
  • 10,801
  • 1
  • 13
  • 24
  • I was already aware of the empty line "issue" in the plugin.xml file. You are correct that it creates a parsing error, which is a separate error from what I describe above. In other words, I had already fixed the empty line error when I followed the steps in the my original question. Any ideas on other things I can try? –  Apr 03 '17 at 17:01
  • Could you please post the whole log? – Elvis Xia - MSFT Apr 04 '17 at 01:48
  • Just updated question with whole log. I'm wondering if my problem is something silly...like using spaces in my directory name... –  Apr 04 '17 at 22:30
  • And that's what it was! It was the white spaces I used in the path name that was causing the install to fail. What curious behavior... –  Apr 04 '17 at 22:34