i was able to build and test apk on to my device by cordova run android,
now suddenly it got stuck could someone help me to fix this issue, i waited almost for 20 min but no changes.
This image has my ionic info and my build part
I reinstalled platform, updated android studio, npm cache clean. but nothing success full.
I think there is something wrong with the gradle, maybe it is being downloaded, which take forever..
You might wanna mannually download the gradle and specify the downloaded path in yout_app_directory/platforms/android/cordova/builders/GradleBuidler.js => maybe somewhere around line 202 var distributionUrl = 'your_gradle_path'
Follows this
cordova platform rm android
Cordova platform add android
Open emulator or connect Device to the system then
Cordova run android
This will help you .
use command 'ionic cordova run android'
or
Update node version. The version you are using is 6.11.0 but ionic is 3.5.0. so please update node version and check again
or
If you are not using ionic3, then you can downgrade your ionic version using a command 'npm install -g ionic#2.2.0'. then use 'ionic run android'
Related
I am trying to build an ionic app for Android device with Cordova using the below command from VSCode.
ionic cordova build android --prod --release
But I'm getting this error:
cordova.cmd build android --release
Checking Java JDK and Android SDK versions
ANDROID_SDK_ROOT=undefined (recommended setting)
ANDROID_HOME=C:\Users\tanmay\AppData\Local\Android\sdk (DEPRECATED)
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
[ERROR] An error occurred while running subprocess cordova.
cordova.cmd build android --release exited with exit code 1.
I have already installed JDK, Android Studio. I also have setup the environment variable ANDROID_SDK_ROOT with the correct SDK path. But still no luck.
I am using
Android Studio 3.6.1,
Gradle 6.3,
Cordova 8.1,
on Windows 10.
I guess I am somewhere missing the setting the ANDROID_SDK_ROOT but I'm not sure where.
You can check if Java JDK, Android SDK, Gradle are properly installed before building an app.
To do so, you can run the following command :
cordova requirements android --verbose
It will show, what is missing and after that, you may install it if you haven't installed it or you may check for the correct path in the Environment Variables.
If you have an android studio installed, you need not to worry about this error on terminal, as until this error cordova will update your android package in platforms directory.
Open your Android Studio.
Select open existing project and browse to select your /platforms/android folder in
project directory.
It will open in android and will be build success
I had the same error.
I solved it by using Gradle 5.6.3 instead of the newer versions.
For anyone as dumb as I was that also thought you could setup and run a cordova project on android without having java, gradle or android studio installed: Once you installed all those things, delete your cordova project's node_modules, platforms, plugins and www folders and set them up again (i.e. rerun npm i, cordova platform add android, npm run build, etc) before trying to run the cordova project again. In my case I'm trying to run cordova run android which caused the same error that OP's getting.
NOTE: I have zero experience with cordova. I have to get a very specific cordova/webpack template up and running locally, and the advice I'm giving in this answer is what worked for me. YMMV.
I have a Cordova application and want to add a plugin to my Cordova project. It worked yesterday!
What I did:
Updated Android Studio to 3.x
Updated Cordova
If I want use the cordova add command, I get this error:
What should I do?
Hard Reset it: Try to remove that plugin you installed yesterday, maybe do a clean install of Cordova or update all dependencies and add missing through Gradle and then finally go for installing the plugins. Somehow, I feel that Cordova version or some dependency mismatch is giving birth to such problems.
since I updated my mac to Sierra I noticed a strange behaviour in my cordova app: some plugins aren't working anymore, it just seems they are not copied in the ios platform even if when I add the Platform the plugins' folders are copied as usual. It just seems xcode ignore them.
I tried a few things: removing and adding again plugins, updating cordova, uninstalling and reinstalling cordova, updating platforms, trying creating a brand new app... nothing seems to fix the problem.
Searching around I found this command:
$ cordova platform update ios --save
and it worked without doing anything else.
Unfortunately I have to use this command everytime I make a change in the app and I remove and add the platform again so I guess it's a problem in my environment.
I would like to completely uninstall cordova, node.js and git and reinstall everything again. I found a few instructions like in this question for node.js How do I uninstall nodejs installed from pkg (Mac OS X)? but I don't know how to run correctly all of the commands, some of them fail.
Uninstalling cordova and reinstalling works but doesn't solve the problem.
I did it with
$ sudo npm install -g cordova
$ sudo npm uninstall -g cordova
Can someone link me where to find clear instructions step by step? I'm not that good with command line and I really want to fix this problem without formatting the whole system.
Thank you for any help!
Think I have the solution: I removed cordova,
sudo npm uninstall -g cordova
deleted the .cordova folder in my user home folder (it's a hidden folder!) and installed cordova again with
sudo npm install -g cordova
I noticed that one of my old cordova projects was working: remove platform, add platform and by default I had ios platform version 4.3.0. GOOD!
In another cordova project created after latest update it was still using ios platform 4.2.1.
In the root project folder there is the config.xml file and in this file I found this line in just the second project:
<engine name="ios" spec="~4.2.1" />
Just removed and now cordova is using by default the latest version of the ios platform.
I don't know exactly why in one project there was this line and why not in the other one... neither know if I updated the platform in one project before reinstalling cordova and after reinstalling in onther... can't remember.
I just know that now if I create a new project it's correctly using ios platform 4.3.0 and I tried to describe all my steps...
I hope it will be useful for anyone else because I was ready to format my mac to fix this :(
I don't think you really have a problem with node or npm.
It seems to me more the kind of problem that happen when you change your node version without rebuilding node_modules directory.
If you always install modules with --save modifier, try this:
rm -rf node_modules
npm install
...if not, you can make a backup of your node_modules first. But it will be useful only to inspect it to figure out what modules are missing in your 'package.json' file.
I am using the standard ionic template project that is generated from by WebStorm.
When I make simple changes (like adding a test alert(...)) in app.run(...) in app.js and run the following set of commands, the changes are not reflected when the app runs or is deployed to the phone.
The following commands are ran from the root of my project.
gulp
ionic build android
ionic run|emulate android
Is there something I am missing that would not reflect the changes I am making?
Recently experienced this issue. What helped me is removing the android platform:
ionic platform rm android
then, re-adding it.
ionic platform add android
make sure you delete the app from your device before running/installing again, then run:
ionic run android
hope this helps
So I was able to determine why this issue was occurring.
As I was testing on my android phone (Galaxy to be specific), everytime I would run the following command...
ionic run android
It would appear to deploy/install to my device, and it would open up the app. Howevever, it wasn't actually deploying the newest version as I was already running the previous version in the background.
The fix for this was to make sure that the application was not running (in foreground or background). This required me to make sure that if it was running, that I stop it before testing any changes.
Faced the same issue after upgrading cordova and ionic to the latest versions.
ionic info
Downgraded cordova and ionic versions to match my previous environment, it started taking the changes all over again.
commands:
npm install -g cordova#6.2.0
npm -d install -g ionic#2.0.0-beta.35
Everything works well with the following combination for me.
Hope this helps someone!!!
Just remove all files inside www folder and run ionic lab to update then, for some reason when I run cordova run android the version deployed was the old one, but when I remove the files in www folder the new version was deployed.
what is my problem? is it successfully installed or failed? It doesn't seem right for me.
Cordova was installed successfully. You are looking at the dependency tree, so don't worry.
Bear in mind that you have installed the CLI tools. You have to actually create a cordova project with the command before you will see a cordova project.
cordova create <Your project name>