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