PhoneGap - Trouble installing cordova-plugin-wkwebview-engine-localhost plugin - javascript

I have been working on a javascript project, the client requires it to be published to the AppStore. We chose to work with PhoneGap as it did a lot of the work for us and the results were satisfactory. However the performance on some apple devices was a poor compared to the application running just on Safari.
After doing some reading into UIWebView and how its deprecated, I decided to give the WKWebView a go hoping that the performance would be at least a little better.
I successfully installed the cordova-plugin-wkwebview-engine which then led me to the XHR issues that I have seen many people having. However I found a solution via this post https://stackoverflow.com/a/42953116/10551718
The issue I am having is when I try and replicate what this gentleman has done, I get errors in the PhoneGap build regarding cordova-plugin-wkwebview-engine-localhost saying that it can't clone the git repository.
Build Date: 2018-10-24 04:20:25 -0700
--------------------------------------------------------------------------------
PLUGIN OUTPUT
--------------------------------------------------------------------------------
Fetching plugin "cordova-plugin-splashscreen" via npm
Installing "cordova-plugin-splashscreen" at "5.0.2" for ios
Fetching plugin "cordova-plugin-wkwebview-engine" via npm
Installing "cordova-plugin-wkwebview-engine" at "1.1.4" for ios
"plugman-151 install --platform ios --project /project --plugin https://github.com/apache/cordova-plugins.git#wkwebview-engine-localhost --nohooks=.": Fetching plugin "https://github.com/apache/cordova-plugins.git" via git clone
Using shallow clone
Repository "https://github.com/apache/cordova-plugins.git" checked out to git ref "wkwebview-engine-localhost" at "a3cc931".
Installing "cordova-labs-wkwebview-engine-localhost" at "0.5.1" for ios
Fetching plugin "git+https://github.com/apache/cordova-plugins.git" via git clone
Cloning full repository
Failed to install 'cordova-labs-wkwebview-engine-localhost': Error
at /.nvm/versions/node/v8.1.4/lib/node_modules/pgb-plugman-151/node_modules/pgb-cordova-lib/src/plugman/fetch.js:100:37
at _rejected (/.nvm/versions/node/v8.1.4/lib/node_modules/pgb-plugman-151/node_modules/cordova-common/node_modules/q/q.js:864:24)
at /.nvm/versions/node/v8.1.4/lib/node_modules/pgb-plugman-151/node_modules/cordova-common/node_modules/q/q.js:890:30
at Promise.when (/.nvm/versions/node/v8.1.4/lib/node_modules/pgb-plugman-151/node_modules/cordova-common/node_modules/q/q.js:1142:31)
at Promise.promise.promiseDispatch (/.nvm/versions/node/v8.1.4/lib/node_modules/pgb-plugman-151/node_modules/cordova-common/node_modules/q/q.js:808:41)
at /.nvm/versions/node/v8.1.4/lib/node_modules/pgb-plugman-151/node_modules/cordova-common/node_modules/q/q.js:624:44
at runSingle (/.nvm/versions/node/v8.1.4/lib/node_modules/pgb-plugman-151/node_modules/cordova-common/node_modules/q/q.js:137:13)
at flush (/.nvm/versions/node/v8.1.4/lib/node_modules/pgb-plugman-151/node_modules/cordova-common/node_modules/q/q.js:125:13)
at _combinedTickCallback (internal/process/next_tick.js:95:7)
at process._tickCallback (internal/process/next_tick.js:161:9)
Failed to fetch plugin git+https://github.com/apache/cordova-plugins.git via git.
Either there is a connection problems, or plugin spec is incorrect:
Error: git: Command failed with exit code 128 Error output:
Cloning into '/var/folders/lt/xxbrk07x45bdj1fl3wjgf8yc0000gn/T/git/1540380025411'...
fatal: Unable to find remote helper for 'git+https'
I have this in my config...
<plugin name="cordova-plugin-splashscreen" source="npm" />
<plugin name="cordova-plugin-wkwebview-engine" source="npm" />
<plugin name="cordova-plugin-wkwebview-engine-localhost" spec="https://github.com/apache/cordova-plugins.git#wkwebview-engine-localhost" />
<content src="http://localhost" />
<feature name="CDVWKWebViewEngine">
<param name="ios-package" value="CDVWKWebViewEngine" />
</feature>
<preference name="CordovaWebViewEngine" value="CDVWKWebViewEngine" />
Any help would be greatly appreciated!

I ended up finding an alternative plugin - https://github.com/ionic-team/cordova-plugin-ionic-webview
This installed with no issues and correctly forced the WKWebView which lead to a massive performance increase!

Related

Selenium chrome driver version not being updated in asp.net core selenium test

I am currently running into issues with selenium tests failing locally and on the devops azure pipe lines part of selenium testing.
The error is basically a version mismatch between the browser and driver being used.
I have tried installing the up to date driver for Chrome but I still keep getting the same error. On the pipeline I get that both drivers are the wrong version for the browser being used? Before this Selenium Tests would run without issues.
This is my csproj file for the test project:
<ItemGroup>
<PackageReference Include="MSTest.TestAdapter" Version="2.2.10" />
<PackageReference Include="MSTest.TestFramework" Version="2.2.10" />
<PackageReference Include="Selenium.WebDriver" Version="4.4.0" />
<PackageReference Include="StyleCop.Analyzers" Version="1.1.118">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Vsxmd" Version="1.4.5">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>
<ItemGroup>
<None Update="appsettings.test.json" CopyToOutputDirectory="Always"></None>
<None Update="Drivers\chromedriver.exe">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="Drivers\msedgedriver.exe">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
Below is the folder where I store the drivers:
The error that the browser being used has a different version than the driver.
The driver folder that gets output to Tests.Selenium\bin\Debug\net6.0
will have the older version on it instead of the new
updated version.
How can I know which version is truly required to cover what browser is being run on the piple line and locally?
Solved:
I looked at the Drivers folder in the bin folder and it seems like the updated drivers do not appear in the bin folder driver folder. Instead the older version drivers appear. I went into task manager closed all instances of the drivers and then deleted the entire bin and obj folders. Updated the driver folder again and it worked.
For some reason the updated driver folder does not get output to bin.

expo init <project name> throwing npm ERROR (windows OS)

Just started with expo and React-Native and when I run
expo init ProjectName
I am getting an error stating:
Unexpected end of JSON input while parsing near '...,"version":"7.0.0-bet'
Process exited with non-zero code: 1
Set EXPO_DEBUG=true in your env to view the stack trace.
When I add the said thing in env (using set EXPO_DEBUG=true on windows), I get the following error:
Error: Process exited with non-zero code: 1
at ChildProcess.child.on (C:\Users\mohit\AppData\Roaming\npm\node_modules\expo-cli\node_modules\#expo\spawn-async\build\spawnAsync.js:39:21)
at ChildProcess.emit (events.js:182:13)
at ChildProcess.cp.emit (C:\Users\mohit\AppData\Roaming\npm\node_modules\expo-cli\node_modules\cross-spawn\lib\enoent.js:40:29)
at maybeClose (internal/child_process.js:962:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:251:5)
It's something related to 'spawn-async'. I was also getting issues with 'spawn' sometime earlier while creating a node-server...but I resolved that there and then using 'exec' instead. Tried to find this on expo forums and even in react-native issues but couldn't find a solution. Can someone plz suggest something? Is it some "windows" thing only or something related to npm releases?
P.S: I also ran create-react-native-app ProjectName and again got a similar kind of error about end of JSON input!
Now I know what can be the issue, it can be just the trivial one:
Please update node an npm to the newest available version and please init you project again in different directory.
You'll need to have Node.js (version 10 or newer) installed on
your computer. Download the latest version of Node.js.
Additionally, you'll need Git to create new projects with Expo
CLI. You can download Git from here.
Make sure that you have installed these two things in your device.
Go to doc for expo installation
in my case. make sure you have yarn installed and update tour android studio packages, for it to work

Cordova Android Build Failure ("failed to find Build Tools revision 24.0.1")

I'm having trouble building my Cordova project with Android. When I typed "cordova build Android", this is the result:
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring root project 'android'.
> failed to find Build Tools revision 24.0.1
I checked my SDK manager and the build tools version 24.0.1 are installed. I was building earlier just fine so I'm not sure what changed. Any help would be appreciated. Thanks!
I'd start by making sure that your PATH environment/system variable includes paths to the various Android tools, and also that you have an ANDROID_HOME entry pointing to the SDK
Partial PATH example (on Windows):
C:\Program Files (x86)\Android\android-sdk\tools;
C:\Program Files (x86)\Android\android-sdk\platform-tools;
ANDROID_HOME example (on Windows):
C:\Program Files (x86)\Android\android-sdk

"Network Information" cordova plugin not working

I am currently working on a rather large PhoneGap project using a handful of cordova plugins and I'm experiencing dificulties using the Network Information plgin to retrieve the connection type of the device.
It should be noted that I'm using the command line tool to build my PhoneGap project, not Adobe's "Build" service.
The versions of the phonegap and cordova cli tools are the following:
% phonegap -v
4.2.0-0.23.0
% cordova -v
4.2.0
Here is the list of plugins currently in use:
% phonegap plugins
com.darktalker.cordova.screenshot 0.1.0 "Screenshot"
nl.x-services.plugins.socialsharing 4.3.14 "SocialSharing"
org.apache.cordova.console 0.2.13 "Console"
org.apache.cordova.device 0.3.0 "Device"
org.apache.cordova.inappbrowser 0.6.0 "InAppBrowser"
org.apache.cordova.network-information 0.2.15 "Network Information"
Here is the code responsible for using the plugin, it's located in a much larger object and is only called when I open to a certain page of the project:
checkDeviceConnexion:function(){
require(['cordova', 'cordova_plugins'], function(cordova){
checkConnexion();
});
function networkConnexion(){
if (navigator.connection.type == 'none'){ //Connection.NONE
return false;
}
return true;
}
function checkConnexion(){
if (!networkConnexion()){
app.showMsgError(tradu[lang]['msg-error-connexion']);
}
}
}
I'm doing my tests on android therefor I'm using adb as a mean to debug the application. When I run the code above, this is what I get:
I/chromium(12465): [INFO:CONSOLE(1145)] "Uncaught TypeError: Cannot read property 'type' of undefined", source: file:///android_asset/www/js/app.js (1145)
I scrapped and rebuilt the android project several times to make sure that all plugins were properly copied but it didn't help.
What's even more puzzling is that the output of the adb hints that somehow somewhere the network manager should be working properly as shown here:
D/CordovaNetworkManager(21764): Connection Type: wifi
D/CordovaNetworkManager(21764): Connection Extra Info: "atelier8"
But I'm unable to see the connection property in the navigator object.
Has anyone experienced similar issues? Any idea on how to fix this problem?
Thanks in advance for any tip or answer.

Phonegap, Cordova - Issue with Plugins

I have installed Phonegap (3.0.3) and the Cordova CLI.
I am also running iOS as a platform (confirmed using $ cordova platforms ls)
I have installed the plugins ($ cordova plugins ls)
org.apache.cordova.core.dialogs
org.apache.cordova.core.vibration
However, when I run this console command ($ cordova emulate ios), I get the following error.
Undefined symbols for architecture i386:
"_AudioServicesAddSystemSoundCompletion", referenced from:
_playBeep in CDVNotification.o
"_AudioServicesCreateSystemSoundID", referenced from:
_playBeep in CDVNotification.o
"_AudioServicesDisposeSystemSoundID", referenced from:
_soundCompletionCallback in CDVNotification.o
"_AudioServicesPlaySystemSound", referenced from:
_playBeep in CDVNotification.o
-[CDVVibration vibrate:] in CDVVibration.o
"_AudioServicesRemoveSystemSoundCompletion", referenced from:
_soundCompletionCallback in CDVNotification.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
** BUILD FAILED **
The following build commands failed:
Ld build/MyApp.app/MyApp normal i386
(1 failure)
I have followed the directions from the API page here (http://cordova.apache.org/docs/en/edge/cordova_notification_notification.md.html#Notification) and below is my config.xml file in the MyApp > www > config.xml file which causes the error.
<?xml version='1.0' encoding='utf-8'?>
<widget id="com.myapp.myapp" version="0.0.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<name>MyApp</name>
<description>
A sample Apache Cordova application that responds to the deviceready event.
</description>
<author email="dev#callback.apache.org" href="http://cordova.io">
Apache Cordova Team
</author>
<plugin name="Notification" value="CDVNotification" />
<access origin="*" />
<preference name="fullscreen" value="true" />
<preference name="webviewbounce" value="true" />
</widget>
Any suggestions what the issue might be, and how I can go about fixing it?
Add AudioToolbox framework in your Xcode project:
Your Target > Build Phases > Link Binary With Libraries
Click the '+' button
Choose AudioToolbox.framework
Did you run cordova build ios?
then cordova emulate ios
This error happen when you don't add the source to the Compile sources in build phase.
Try to add plugins with :
TargetSettings -> Build Phases -> Compile Sources -> add your .m class
Take a look at CDVNotification.h - the #import lines tell you everything you need to add to your compile sources build phase.
Foundation/Foundation.h
UIKit/UIKit.h
AudioToolbox/AudioServices.h
Add those 3, and it will compile.
UPDATE - an additional change is necessary in CDVNotification.m
playBeep() calls soundCompletionCallback()
soundCompletionCallback calls playBeep()
In order for playBeep to be error free, soundCompletionCallback must be declared. The simple solution is to declare it before playBeep, then define it after.
Add this line just before static void playBeep(int count)
// declared but not defined to avoid undeclared error in playBeep
static void soundCompletionCallback(SystemSoundID ssid, void* data);

Categories