Error ActivateApplication in my Windows Cordova ap

2019-05-24 01:35发布

问题:

I want to get the blank app working on the windows platform. I did the following:

ionic start myApp blank
cd .\myApp\
ionic platform add windows
ionic emulate windows

them I'm getting the following exception:

Starting application...
ActivateApplication:  com.ionicframework.myappmework.myapp781
Ausnahme beim Aufrufen von "ActivateApplication" mit 4 Argument(en):  "Der Remoteprozeduraufruf ist fehlgeschlagen.
(Ausnahme von HRESULT: 0x800706BE)"
In C:\...\myApp\platforms\windows\cordova\lib\WindowsStoreAppUtils.ps1:164 Zeichen:5
+     $appActivator.ActivateApplication($applicationUserModelId,$null,[ ...
+     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : COMException

What I need to fix?

回答1:

Run ionic run windows -- --win to deploy to windows. ionic run windows -- --phone to launch application on emulator. And ionic run windows --device -- --phone to launch on real device. Plus if you still get failed then run ionic run windows --list to see if there is any target(emulator or device) available or not.



回答2:

Be sure the Windows 10 SDK is installed. In your config.xml add the following entry:

<preference name="windows-target-version" value="10.0" />

That should fix it.



回答3:

I ran into the same issue with an app and it could not be related to my cordova or SDK installation, as another app worked perfectly fine.

In my case, it was related to JavaScript errors. First, I updated jQuery to the latest version, which made the error message vanish. However, the app would still crash directly after starting it up, which was related to another JS-error (as seen in the JS console when running it in a browser). Fixing this made it finally work as expected.