I have exception in cordova
whenever i do build debug or release to generate apk
Its running on my browser and phone gap application from phone gap getting started
I tried lot of downgrading and upgrading for cordova
Plus
I tried lot of SDKs and build tools versions.
plus
I tried install un install different versions of cordova and npm
I got many different errors when i try thing for example
Error 1
Error 2
My project is kinda old its created 4 years ago . but the last time i created
apk was months ago, i know the problem is because i clicked update in intellij for android repository but cant remember what it was then
Here is the Exception , i dont have the full stack because i already
solved it and posting answer here. (i dont want to break things again)
When i run this
cordova build android --debug
I get cannot find symbol at the .plugin the letter p
new CordovaResourceApi(webView.getContext(), webView.pluginManager)
Am posting the answer here , because i solved this twice , and yet i spent
two days debugging ! again to solve again.
P.S
Here is reference for what i tried on stackoverflow as well, from
what i get in the output console
Trust me this will save you lot of googling.
Achilles 4.2.0 compilation error - cannot find symbol symbol: class Table location: package info.archinnov.achilles.annotations
How do I set up IntelliJ IDEA for Android applications?
Phonegap / Cordova - Build Apk
Error cannot find symbol org.apache.cordova.CordovaHttpAuthHandler using InAppBrowser Cordova 5.3.3
Clear cache in Cordova app
Cordova Web view cache clear in android
How to force refresh the cached source files upon Ionic build/run?
Clear PhoneGap Cache
Apache Cordova - uninstall globally
Update cordova plugins in one command
How can I delete all unversioned/ignored files/folders in my working copy?
Cordova Error: Your ios platform does not have Api.js
Cordova Unable to load platformapi
cordova phonegap - How to use android API level 21
Cordova build for android level api 20
Error:(18, 56) error: cannot find symbol variable webView
Error cannot find symbol org.apache.cordova.CordovaHttpAuthHandler using InAppBrowser Cordova 5.3.3
Cordova Android project doesn't compile
Android SDK not found. Make sure that it is installed. If it is not at the default location, set the ANDROID_HOME environment variable
How to check the Android developer tools version from the command line?
How to downgrade my SDK Version?
Cordova App - build tool error - Gradle
How to install Android SDK Build Tools on the command line?
Plugin doesn't support this project's cordova-android version. cordova-android: 4.1.1, failed version requirement: >=5.0.0-dev
Can't add crosswalk with ionic cli 1.3.2
In My case i had the following: and i have below what my android manager looked like ( FYI i had to down grade to adapt legacy phone gap that was created long ago !)
C:\work\sajilni_mobile\android>cordova --version
4.0.0
C:\work\sajilni_mobile\android>npm --version
3.10.10
C:\work\sajilni_mobile\android>cordova platform list
Installed platforms: android 3.6.4, browser 4.1.0
Available platforms: amazon-fireos, blackberry10, firefoxos, windows, windows8, wp8.
===>>> And here is my plugins that is working with that.
cordova plugin ls
com.phonegap.plugins.barcodescanner 2.0.1 "BarcodeScanner"
cordova-plugin-media 2.4.0 "Media"
org.apache.cordova.battery-status 0.2.12 "Battery"
org.apache.cordova.camera 0.3.5 "Camera"
org.apache.cordova.console 0.2.13 "Console"
org.apache.cordova.device 0.3.0 "Device"
org.apache.cordova.device-motion 0.2.11 "Device Motion"
org.apache.cordova.device-orientation 0.3.11 "Device Orientation"
org.apache.cordova.dialogs 0.3.0 "Notification"
org.apache.cordova.file 1.1.0 "File"
org.apache.cordova.geolocation 0.3.12 "Geolocation"
org.apache.cordova.media 0.2.16 "Media"
org.apache.cordova.media-capture 0.3.6 "Capture"
org.apache.cordova.network-information 0.2.15 "Network Information"
org.apache.cordova.splashscreen 1.0.0 "Splashscreen"
org.apache.cordova.vibration 0.3.13 "Vibration"
FYI cordova build android --debug
works but --release do not work
In my case i mean )).
Related
I have updated my Ionic Cordova project on my development machine to use cordova-android 10, via:
ionic cordova platform rm android
ionic cordova platform add android#latest
After this I have the following in my package.json:
"cordova-android": "^10.1.1",
I've updated build tools and sdk etc in Android Studio, do my build and all works fine.
Now, I check in my source, and do the same Android Studio updates on my Mac.
However, now when I do the same build (on the Mac), I see the message:
> cordova platform add android --save
Using cordova-fetch for cordova-android#^9.0.0
And also it has updated my package.json back to "cordova-android": "9.1.0".
My question is, why could it do this, instead of fetching the 10.1.1 as is dictated in my package.json?
I found a solution.
First, check the version of your android platform by using this command
cordova platform
You should see the version 9.x.x
Then run the following command
cordova platform add android#10.1.1
Re execute
cordova platform
You will see the version 10.1.1
That's it
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();
}
}
cordova version is 7.0.1
node version is v8.0.0
when running cordova platform add android#5 everything works fine. (except for cordova-plugin-media requiring android version >=6.1.0 but thats another story)
When running cordova platform add android#4 (similar for cordova platform add android#3) I get
Using cordova-fetch for cordova-android#4
Adding android project...
Error: Your android platform does not have Api.js
despite cordova officially still supporting those android versions. What am I missing here?
The only other post remotely containing this particular error I found is here, but it was not helpful.
I solved this problem trying 6.0.0 version
npm install -g cordova#6.0.0
then there was error with bplist-parser in npm
npm install -g bplist-parser
All works fine!
I have an ionic/cordova project using:
cordova-android#6.2.0
cordova-plugin-crosswalk-webview#2.3.0
cordova cli 6.4.0
ionic 1.3.3
When I try to add the Android platform, I get the following output
================
$ ionic platform add android#6.2.0
Adding android project...
Creating Cordova project for the Android platform:
Path: platforms/android
Package: com.ionicframework.name
Name: name
Activity: MainActivity
Android target: android-25
Subproject Path: CordovaLib
Android project created with cordova-android#6.2.0
Error: cordovaProject.projectConfig.getFileResources is not a function
It seems this issue is related to a bug in cordova-android#6.2.0, as confirmed here: https://issues.apache.org/jira/browse/CB-12633
I have now updated my system to cordova-cli - cordova#6.5.0 and cordova-android#6.2.1, and it seemed to work.
Update to version 6 of cordova cli with:
npm install -g cordova#6
And then add the correct version of cordova-android
cordova platform add android#6
Not directly related to this issue, but once I got it working, my system did complain about the gradle path not being set when I tried building my app, and so I followed the steps here: https://gradle.org/install#with-homebrew, and now all builds successfully.
update cordova
npm install -g cordova
and then try to add platform or if any problem with new version of cordova then use below
There is a problem with cordova version 6.4.0 and android 6.2.1. So, please try with below compatible versions
cordova version must be 6.4.0
npm install -g cordova#6.4.0
Install android in your project
cordova platform add android#6.1.2
or
ionic platform add android#6.1.2
Do whatever #IonicBurger has said above.
Also make sure that for Cordova based projects, each cordova version has specific dependency on android SDK and android build tools installed.
I am currently using Ionic 3 and I faced the same issue.
Make sure cordova is latest: npm i cordova -g will do the job. Note what version of cordova is installed by checking cordova -v. After that ensure you have installed ionic-native; this usually comes with ionic installation, but it wont harm to installed this again locally with npm i ionic-native --save
See all available platforms: ionic cordova platform list. Some plugins like camera, media etc have very specific cordova requirements (refer here)
When you install a plugin, you may encounter such error sometimes: 'Plugin doesn't support this project's cordova-android version. cordova-android: 6.1.2, failed version requirement: >=6.3.0
Skipping 'cordova-plugin-camera' for android'. Thats okay. This can be resolved by above two steps. Most importantly remember this: Ensure you have latest Android Build Tools and SDK installed.
Please see the following image for more detail:
Note that this answer works best with Windows environment.
Updating to cordova#6.5.0 didn't work - I got error that this version is not found
Instead reverting to cordova#6.1.2 did work
cordova platform update android#6.1.2 --save
It is not the right solution downgrade the cordova version. If you want to use the lastest version of cordova and ionic, instead of using
ionic cordova platform add android
Just do:
cordova platform add android
works like a charm!
Good coding!
This problem occured for me when switching between two ionic projects.
I fixed it by trying another node version and it works.
I used nvm use x.x.x and by downgrading to a previous nodejs version, I was able to build my project.
Hope it'll help someone.
I am using phonegap 3.4.0 version for my android app project. My app is working fine in this version. Now, I want to test my app in cordova version 2.9.0. I have searched net and haven't get a grip on this issue.
My question is, how do i downgrade my phonegap version 3.4.0 to phonegap version 2.9.0?
also, cordova library is not showing up in my eclipse after changing version to 2.9.0. Without CordovaLib the project will not run. What should do to add CordovaLib in my app?
To downgrade my phonegap version 3.4.0 to phonegap version 2.9.0, I used the below command line interface:
$ sudo npm install -g cordova#2.9.0
This Link helps me to add CordovaLib in both ios and android.
REF: Phonegap 3.3 Eclipse: -CordovaLib project missing Android properties
npm install -g phonegap#2.9.0-rc1-0.12.2