Can't add crosswalk with ionic cli 1.3.2 - android

I cloned an existing ionic project from git. I have ionic 1.3.2 and cordova 4.2.0. After cloning, i cded into the directory and did an ionic browser add crosswalk. It says that crosswalk was added successfully. Then when i try to do ionic run android, it says
No platforms added.
So i do a ioinic platform add android, which gives me this error:
Failed to install 'org.apache.cordova.engine.crosswalk':CordovaError: Plugin doesn't support this project's cordova-android version. cordova-android: 3.6.4, failed version requirement: >=4.0.0-dev`.
ionic platform add android#4.0.0-dev returns
Unable to fetch platform android#4.0.0-dev: Error: version not found: cordova-android#4.0.0-dev
How do I fix this?
P.S. I am using ubuntu 14.04

The problem is crosswalk browser.
If you revert back to android webview, which sucks, but works.
ionic browser revert android
ionic platform rm android
ionic platform add android
As of today, 4/9/2015. I have been able to go back to the old projects and add crosswalk after updating node runtime, ionic, cordova

Before running ionic run android have you tried adding a directory named www?

It seems that by entering ionic platform add android, it installs the platform from the npm and the latest cordova-android version, which is.... 3.7.1 (currently)
Cordova-android 4.0 is still beta, but there's good news for those who wish to install it. You can download the 4.0 version directly from the apache github repository:
ionic platform add https://github.com/apache/cordova-android.git
There are more bugs along that road, but at least it's a working solution for that bug. It seems that apache still have plenty of issues with plugins compatibility, hopefully they'll overcome them in the next official release.
Update:
Download Intel XDK. This is just an unbelievable tool for developing mobile apps, Intel has really figured it out imo. Built in brackets, emulator, remote debugging, and most important: One button click to build apks with crosswalk for android. All you have to do is importing your www folder and you are good to go!
My app went from sluggish 5fps while scrolling to fully native feel in a click. I'm still in awe. :)

Related

getting net::ERR_CONNECTION_REFUSED (http://localhost:8080) on android 4.4.2 version

I build a simple ionic project from this tutorial.
It runs on Xiaomi Mix 2 phone (android version 8.0.0) and on browser without any problem.
But when I deployed to the samsung note 2 (android version 4.4.2),
it gives an application error with this message:
net::ERR_CONNECTION_REFUSED (http://localhost:8080)
Why am I getting this error?
Any advice and suggestions will be appreciated.
Kemal.
I faced the same problem in Android 4.4, Android 6.0 but not in Android 8.0. I just added this code in config.xml to allow the localhost.
<allow-navigation href="http://localhost:8080/*"/>
For more information please follow this link:
WKWebView
Your problem is caused by the cordova-plugin-ionic-webview plugin that is part of every new or updated Ionic app.
This used to apply only to iOS, where it replaced the UIWebView with WKWebView, but on July 23rd 2018 they released version 2.0 of the plugin, that also included changes to the webview used on Android.
The Android webview now uses a local webserver at localhost:8080 to show your app instead of requesting the files directly from the file system.
Unfortunately this change also included this bit in the documentation:
Requirements
- […]
- Android: Android 5.0+ and cordova-android 6.4+
So cordova-plugin-ionic-webview just doesn’t support Android earlier than 5.0 any more, which of course means your app will not work on Android 4.x.
One solution is to downgrade the plugin to the last version that supported Android 4.x:
ionic cordova plugin add cordova-plugin-ionic-webview#1.2.1
More elaborate information and alternative solutions:
https://ionic.zone/debug/ionic-and-android-4
In case anyone is still not able to resolve this error,
Find the compatible webview version which works for you and run the below commands:
cordova plugin rm cordova-plugin-ionic-webview
cordova plugin add cordova-plugin-ionic-webview#4.1.3
In case you're using ionic, install the ionic plugin wrapper. (Skip this if your project is not an ionic project)
npm install #ionic-native/ionic-webview
Finally do clean installation of the platform and plugins. Delete
the plugins folder and run the following commands:
cordova platforms remove android
ionic cordova build android
Or, if you use ionic,
ionic cordova platforms remove android
ionic cordova build android
Additional information: Plugin version cordova-plugin-ionic-webview#4.1.3 worked for me for the below cordova and android versions:
Cordova CLI : 9.0.0 (cordova-lib#9.0.1)
Cordova Platforms : android 8.1.0
Android target : android-28
Android SDK Tools : 26.1.1
cordova-android : 8.1.0
You are getting the error because every function and module in Android only works from a certain version on newer. It could be 4.4.3 and up, 5.0 and up, or even 8.0 and up. It just depends. This means if and when you deploy it you will be required to select a minimum version. There is nothing you can do to fix it other than trying on a newer version. You can also change the code completely to work with older modules.
I've had same error even on new devices. After that, I've reinstalled cordova-plugin-ionic-webview plugin. Reinstallation upgraded plugin from 4.0.0 to 5.0.0 and added new line to config.xml:
<allow-navigation href="http://localhost:8100" sessionid="f8f1cc34" />
I'm still waiting for review, but hope this will help.
I had this problem for days and all the solutions I found did not work.
Ionic recommends using Capacitor to build the app and not Cordova. With Cordova does not work, on the other hand with Capacitor it works fine.
In your app directory first delete the Android folder (if any) and the one in Platform / Android folder.
I used these commands in this order launched by Powershell while staying in the APP directory
ionic build
ionic capacitor add android
npx cap open android
The first command will create a www folder.
If the last command give an error and does not open Android Studio, do it manually, (I recommend using 4.0 version). Open Android Studio → open folder, navigate to the folder named Android located in the folder in your APP and then it worked for me. In Android Sudio 4 make sure you have Gradle updated and the SDK loaded.
/android/CordovaLib/src/org/apache/cordova/engine/SystemWebViewClient.java
onReceivedError(WebView view, WebResourceRequest request,
WebResourceError error) {
super.onReceivedError(view, request, error);
if (error.getErrorCode() == WebViewClient.ERROR_CONNECT) { //net::ERR_CONNECTION_REFUSED
view.goForward();
return;
} else {
errorMessage();
}
}

PHONEGAP - Error while starting emulated android on phonegap; I use the SDK installed by android Studio

The error I get on the console; When I run the command "phonegap emulate android"
->Error: Could not find gradle wrapper within Android SDK. Might need to update your Android SDK. Looked here: C:\Users\wende\AppData\Local\Android\sdk\tools\templates\gradle\wrapper
I also experienced this issue (among many others) in my attempts to get a phonegap app to work in my environment.
I found a solution in the second response (by jcesarmobile) to this question:
Error: Could not find gradle wrapper within Android SDK. Might need to update your Android SDK - Android
Specifically, I had to make sure my Android Studio and Android SDK Tools were updated to the latest version, and then I had to update my Cordova Android platform to version 6.2.2.
phonegap cordova platform rm android
phonegap cordova platform add android#6.2.2

Crosswalk not being added to Cordova Android App

To increase compatibility with older Android devices (4.0+) for my Cordova App I am wanting to use the Crosswalk Webview instead of the device webview. I am using Cordova Tools (CLI 6.3.0) for Visual Studio (2015 - Update 3) and have added the Plugin "Crosswalk WebView Engine" using the plugins panel in the config.xml. However, when I start up the app, debug it and inspect the useragenet (using "navigator.userAgent" from the console) it is not reporting as running using the Crosswalk WebView Engine.
Now I have heard some people suggest that you remove the Android platform, install the plugin and then rebuild, but that isn't fixing it for me. Perhaps I am removing the Android platform incorrectly? (I am just deleting the folder from disk).
Is this a case of my build steps being incorrect? Any assistance would be appreciated.
After persisting with this problem, assuming it to be a problem with my set-up, I got it working.
The key was to update everything. I installed the latest Java JDK (v1.8) - Updated mt CLI version to 6.5.0 - Installed any updates using the Android Update Manager (I also updated some files within Android Studio itself) and then finally installed Crosswalk (2.3.0).
Works like a dream now.

Upgrading Cordova for non-cli apps

I have a quite old version of cordova. For Android it's 3.6.4 and for iOS 2.9.1.
The latest version for Android is 5.1.1 and for iOS 4.1.1 and I would like to upgrade it.
However the application is a non-cli application and it's mainly standalone application.
I've noticed in https://cordova.apache.org/docs/en/latest/guide/platforms/android/upgrade.html that it mentions
Alternatively, you may attempt to use the platform update script. For
non-CLI projects, run:
bin/update path/to/project
I'm using a mac OS for upgrading the cordova and I'm not so sure where I could find this script bin/update.
Any hints for how I could make the upgrade would be useful.
Thanks
I have finally used the npm package manager as described in
https://www.npmjs.com/package/cordova
and install nodejs through brew for having cordova and npm.

Is it possible to download corodava jar version greater 3.5

I have corodava.js version of 2.9 in my app but google send a alert to update the corodava version due to security issues. I had searched latest version but all the latest version are available with node.js CLI . I hardly want a corodava jar alone .Is the phonegap corodava version is available ? Thanks in advance .
You can download the cordova android source code from here:
https://www.apache.org/dist/cordova/platforms/cordova-android-3.6.4.tgz
Then uncompress it, go to cordova-android-3.6.4\package\framework in a terminal or cmd
write this command:
android update project -p .
when it finish write this one
ant
That should build a cordova-3.6.4.jar
But if you are using plugins right now, cordova 3.X.X doesn't include them, you will have to include them using plugman.
Just execute this in your project folder:
cordova platform update android
This will upgrade to the last cordova version, that fixes these security issues.
I recommend to remove & add android platform to have a clean android project:
cordova platform rm android
cordova platform update android
cordova platform add android
Note: This is only for Cordova 3.x users..., From Cordova 2.x it is needed to install Cordova.

Categories

Resources