0

I just added phonegap-plugin-push to my barebones phonegap app. When I build and run the application I receive the error message that the ServicePackager package did not load correctly. It throws an error when calling the following:

    pushRegistration.on('notification', function (data, d2) {
        alert('Push Received: ' + data.message);
    });

The activity log shows the following error:

-

CreateInstance failed for package [ServicesPackage][Exception has
been thrown by the target of an invocation.]:{ at
System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean
publicOnly, Boolean noCheck, Boolean& canBeCached,
RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck) at
System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean
skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark) at
System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly,
Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark)
at System.Activator.CreateInstance(Type type, Boolean nonPublic) at
System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr,
Binder binder, Object[] args, CultureInfo culture, Object[]
activationAttributes, StackCrawlMark& stackMark) at
System.Activator.CreateInstance(Type type, BindingFlags bindingAttr,
Binder binder, Object[] args, CultureInfo culture, Object[]
activationAttributes) at
System.Activator.CreateInstanceFromInternal(String assemblyFile,
String typeName, Boolean ignoreCase, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[]
activationAttributes, Evidence securityInfo) at
System.AppDomain.CreateInstanceFrom(String assemblyFile, String
typeName)}[Could not load file or assembly
'Microsoft.VisualStudio.WindowsAzure.CommonAzureTools.Contracts.1.5,
Version=1.5.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file
specified.]:{ at
Microsoft.VisualStudio.WindowsAzure.Services.Package.ServicesPackage..ctor()}

I can't make heads or tails out of what its trying to tell me.

Notes:

  • I'm following Azure article Add Push Notifications to your Apache Cordova App.

  • I just recently had VS2015/Cordova issues where some Cordova project system components were failing to load. Clearing and rebuilding the VS MEF cache got everything working again.

  • The same application runs perfect on another computer. In fact I copied the entire project folder to another computer and it successfully built and ran without modifications.

Please help, Mike

yardie
  • 1,583
  • 1
  • 14
  • 29
Mike
  • 136
  • 13

1 Answers1

0

My bad, I did not have Android Support Library installed which caused the problem. After I installed the Adroid Support Library (run "C:\Program Files (x86)\Android\android-sdk\SDK Manager.exe" as admin) and selecting "Android Support Libary" from the extra folder the problem went away. See article, "Add Push Notifications to your Apache Cordova App" for a complete list of required SDKs...

Check the box next to each required SDK in the Extras folder that is not installed. The following packages are required: • Android Support Library version 23 or greater • Android Support Repository version 20 or greater • Google Play Services version 27 or greater • Google Repository version 22 or greater

Mike
  • 136
  • 13