in continuation to MAC - Cordova error after installing Android Studio
On Mac os - Cordova project stopped working after installing Android Studio (4.4.1)
NOTE: it was working previous to the installation
I had some error when trying to do cordova build which
I managed to solved (see MAC - Cordova error after installing Android Studio)
but I'm still cannot run the project on the device.
I've installed the latest cordova (5.4.0) and when I'm running the project I get in logcat Uncaught TypeError: Cannot read property 'uuid' of undefined
the line code that fails is this.device_id = window.device.uuid;
this line was working previously so it seems that Cordova doesn't load properly.
any idea how to fix it?
The solution is:
cordova plugin remove org.apache.cordova.device
cordova plugin add org.apache.cordova.device
cordova prepare
then refresh the proj and run it (in eclipse)
than I add to delete the project from android studio and re-import it.
NOTE: you might also need to remove/add org.apache.cordova.console plugin
Related
I currently use Cordova CLI on Windows to build hybrid Android apps. I am in the process of moving my development mover to a headless Ubuntu server. Getting java, NVM, Node, Android SDK and Cordova CLI installed on Ubuntu has not been a problem. Having done so and created the customary Cordova hello world project,
cordova create hello com.example.hello HelloWorld
I proceeded to add the Android platform
cordova plaform add android
and then attempted to build
cordova build android
at which point I was told
Error: Could not find an installed version of Gradle either in Android Studio,
or on your system to install the gradle wrapper. Please include gradle
in your path, or install Android Studio
Installing Gradle by following the instructions given here - I am NOT installing Android Studio and am working on a headless Ubuntu machine so automatic Gradle installation is not an option - is not a problem. However, it is not clear to me which version of Gradle I should install.
I do not want to break my current Cordova project so I am trying to replicate the current Windows/Cordova CLI setup as closely as I can
Node 8.9.2
Java 8
Gradle ???
Dipping inside the gradle-wrapper.properties file in my existing project I find
distributionUrl=https\://services.gradle.org/distributions/gradle-2.10-all.zip
I have noted that when I compile the project at present there are some ominous warnings about features to be removed from future versions of Gradle that are shown. I could experiment with using gradle-2.10 but it is not entirely clearr to me that it would indeed be the right version. Hopefully, someone here will be able to point me in the right direction.
First, clean up the project
cordova clean android
Then, force the cordova to use the distribution url with the version you want, in this case: gradle-6.3
export CORDOVA_ANDROID_GRADLE_DISTRIBUTION_URL=https\\://services.gradle.org/distributions/gradle-6.3-all.zip
Then, build your application.
cordova build android --release
I m new to cordova/ionic.
I have a cordova project which i want to run either on android device or emulator.
When i run the command : ionic cordova run android.
I get the following error :
Detected locally installed Ionic CLI, but it's too old--using global
CLI.
cordova platform add android --save Using cordova-fetch for cordova-android#7.0.0 Error: Failed to fetch platform
cordova-android#7.0.0 Probably this is either a connection problem, or
platform spec is incorrect. Check your connection and platform
name/version/URL. Error: cmd: Command failed with exit code 1 Error
output:
in the code platform android already exists, but when i check its version it i s, android~6.3.0.
I have tried a number of things to resolve it which includes, reinstalling cordova, android.
Can anyone have a solution for it.
The code was written around a year back and now i have all the latest versions installed in my system
Problem is android platform was not added properly. Therefore you have to add respective Android Platform into your Project.
Before adding run :
cordova platform remove android
After run :
cordova platform add android#6.0.0
if you develop on windows enviroment You can check the version of Android provided by Cordova under :
C:/Users/%USER%/.cordova/lib/npm-cache/cordova-android
You may also want to try adding --nofetch to the command, which will use the pre-7.x behavior. See Cordova 7 fails to add android platform
You can try it by firstly updating your android sdk manager with all the latest updates and also update its gradle. Then try to firstly remove the android platform using command
CORDOVA PLATFORM REM ANDROID
and then add android platform using command
CORDOVA PLATFORM ADD ANDROID.
cordova android has some issues and not sure how to solve it.
I have updated my cordova to the latest cordova#7.1.0 and my node to node8.2.0
but each time i try to build my ionic cordova project i get two errors
when i try to build my android project ionic cordova platform add android
Error: Source path does not exist: resources/android/icon/res/mipmap-hdpi/ic_launcher.png
Also when i try to run ionic cordova prepare i get the following error
Unable to load PlatformApi from platform. Error: Cannot find module '/platforms/browser/cordova/Api.js'
Error: Unhandled "error" event. (The platform "browser" does not appear to be a valid cordova platform. It is missing API.js. browser not supported.)
Kinda confused on these two errors and not sure how to solve them.
I am building an Ionic3 project.
Any help is appreciated
I just created a new app with the next command:
ionic start myapp
Everything works fine but when I try to deploy to Android (My Android studio environment is properly installed and configured), I get the next error:
Error: Failed to fetch plugin cordova-plugin-statusbar#https://github.com/apache/cordova-plugin-statusbar.git
via registry.
I try to deploy with:
ionic cordova run android
Thanks in advance.
This work for me, If the other solutions did,t work
cordova plugin add https://github.com/apache/cordova-plugin-statusbar.git
I found the solution. Just run this command:
cordova plugin add cordova-plugin-statusbar
Now I can deploy my app but I don't know why that plugin is not installed automatically.
I checked out a Cordova project from SVN in IntelliJ Webstorm. When I try to run it on an emulated Android device, I receive the error message:
Error: Cannot find module './android_sdk'
All the other people working on the project can run the project fine. And I can run every project that I have created locally.
in my case (Kubuntu 16.04.2, Ionic 3.3.0, Cordova 7.0.1) i just did this:
cordova platform rm android
cordova platform add android
and that did the trick :)