# Ionic 3: Can't build Android since updating Cordova etc

**URL:** <https://forum.ionicframework.com/t/ionic-3-cant-build-android-since-updating-cordova-etc/123633>\
**Category:** ionic-v3\
**Created:** [March 6, 2018, 7:00pm UTC](https://forum.ionicframework.com/t/ionic-3-cant-build-android-since-updating-cordova-etc/123633 "2018-03-06T19:00:21Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![Daveshirman](https://avatars.discourse-cdn.com/v4/letter/d/ecd19e/32.png) [@Daveshirman](https://forum.ionicframework.com/u/Daveshirman)\
**Post date:** [March 6, 2018, 7:00pm UTC](https://forum.ionicframework.com/t/ionic-3-cant-build-android-since-updating-cordova-etc/123633/1 "2018-03-06T19:00:21Z")

</div>

My Ionic 3 project won’t build for Android any more. Serving to the browser is working. I’ve tried in numerous combinations:

- removing android platform
- updating cordova / ionic
- re-adding platform
- updating the already installed Android Studio SDK tools
- head-butting the computer

I just can’t get it to build, not even the official Ionic docs have any info. Any ideas?

**Note:** There are loads of outdated answers on the net that haven’t worked, so please don’t just mark this as a duplicate, as the solution needs to be up to date.

**Error message in console:**

```
ANDROID_HOME=/Users/daveshirman/Library/Android/sdk
JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_121.jdk/Contents/Home
studio
(node:16020) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): 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

```

**Here’s my system version info:**

```
Davids-MBP:apphazard-app daveshirman$ ionic info

cli packages: (/Users/daveshirman/Documents/Work/AppHazard/apphazard-app/node_modules)

    @ionic/cli-utils : 1.19.1
    ionic (Ionic CLI) : 3.19.1

global packages:

    cordova (Cordova CLI) : 8.0.0 

local packages:

    @ionic/app-scripts : 3.0.0
    Cordova Platforms : android 7.0.0
    Ionic Framework : ionic-angular 3.7.1

System:

    ios-deploy : 1.9.2 
    ios-sim : 5.0.8 
    Node : v6.10.0
    npm : 3.10.10 
    OS : macOS High Sierra
    Xcode : Xcode 9.2 Build version 9C40b 

Environment Variables:

    ANDROID_HOME : not set

Misc:

    backend : pro
```

---

<div class="post-metadata">

**Author:** ![MattE](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/matte/32/66712_2.png) [@MattE](https://forum.ionicframework.com/u/MattE)\
**Post date:** [March 6, 2018, 7:30pm UTC](https://forum.ionicframework.com/t/ionic-3-cant-build-android-since-updating-cordova-etc/123633/2 "2018-03-06T19:30:18Z")

</div>

I guess this is the issue + solution

> **[Android builds with cordova-android 7.0.0 failing](https://ionic.zendesk.com/hc/en-us/articles/360000020508-Android-builds-with-cordova-android-7-0-0-failing)**
>
> The latest version of the cordova-android platform (7.0.0) is not yet supported by Ionic Pro's Package service. If you are seeing Android build failures, and have this version of the platform insta...

---

<div class="post-metadata">

**Author:** ![Daveshirman](https://avatars.discourse-cdn.com/v4/letter/d/ecd19e/32.png) [@Daveshirman](https://forum.ionicframework.com/u/Daveshirman)\
**Post date:** [March 6, 2018, 9:25pm UTC](https://forum.ionicframework.com/t/ionic-3-cant-build-android-since-updating-cordova-etc/123633/3 "2018-03-06T21:25:18Z")

</div>

So I did as the post suggested by doing the following in my project:

1. ionic cordova remove platform android
2. ionic cordova add platform android@6.4.0
3. ionic cordova build android

…and am still getting the same build error as above.

---

<div class="post-metadata">

**Author:** ![jamesharvey](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/jamesharvey/32/116080_2.png) [@jamesharvey](https://forum.ionicframework.com/u/jamesharvey)\
**Post date:** [March 6, 2018, 9:44pm UTC](https://forum.ionicframework.com/t/ionic-3-cant-build-android-since-updating-cordova-etc/123633/4 "2018-03-06T21:44:52Z")

</div>

Try to re-install Android Studio and android SDK?  
Maybe that will fix the issue…

If that doesn’t work, start a brand new Ionic project and transplant your src folder and re-install plugins, npm packages.

---

<div class="post-metadata">

**Author:** ![Daveshirman](https://avatars.discourse-cdn.com/v4/letter/d/ecd19e/32.png) [@Daveshirman](https://forum.ionicframework.com/u/Daveshirman)\
**Post date:** [March 6, 2018, 10:47pm UTC](https://forum.ionicframework.com/t/ionic-3-cant-build-android-since-updating-cordova-etc/123633/5 "2018-03-06T22:47:39Z")

</div>

Ok none of that worked. So I did the only thing I could think of - I grabbed the android sdk folder from a time machine backup that the error was complaining about being missing, now it builds.

I’ve probably got some sort of Frankenstein’s monster dev setup now, but I don’t care if the apps build and they work.

What a mess Ionic dev has become, it’s so sad.

---

<div class="post-metadata">

**Author:** ![jamesharvey](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/jamesharvey/32/116080_2.png) [@jamesharvey](https://forum.ionicframework.com/u/jamesharvey)\
**Post date:** [March 6, 2018, 10:52pm UTC](https://forum.ionicframework.com/t/ionic-3-cant-build-android-since-updating-cordova-etc/123633/6 "2018-03-06T22:52:25Z")

</div>

Well at least my guess was correct. Something was wrong with your android SDK.

---

<div class="post-metadata">

**Author:** ![AaronSterling](https://avatars.discourse-cdn.com/v4/letter/a/51bf81/32.png) [@AaronSterling](https://forum.ionicframework.com/u/AaronSterling)\
**Post date:** [March 6, 2018, 11:01pm UTC](https://forum.ionicframework.com/t/ionic-3-cant-build-android-since-updating-cordova-etc/123633/7 "2018-03-06T23:01:53Z")

</div>

You’re running Node 6 and npm 3.

Update to the current Node LTS, and npm 5. Then reinstall Cordova 6.latest and see what happens.

---

<div class="post-metadata">

**Author:** ![Daveshirman](https://avatars.discourse-cdn.com/v4/letter/d/ecd19e/32.png) [@Daveshirman](https://forum.ionicframework.com/u/Daveshirman)\
**Post date:** [March 6, 2018, 11:03pm UTC](https://forum.ionicframework.com/t/ionic-3-cant-build-android-since-updating-cordova-etc/123633/8 "2018-03-06T23:03:12Z")

</div>

Can you please post terminal commands here, as they will be useful if correct for others too. Thanks.

---

<div class="post-metadata">

**Author:** ![AaronSterling](https://avatars.discourse-cdn.com/v4/letter/a/51bf81/32.png) [@AaronSterling](https://forum.ionicframework.com/u/AaronSterling)\
**Post date:** [March 6, 2018, 11:04pm UTC](https://forum.ionicframework.com/t/ionic-3-cant-build-android-since-updating-cordova-etc/123633/9 "2018-03-06T23:04:38Z")

</div>

Terminal commands for what?

---

<div class="post-metadata">

**Author:** ![Daveshirman](https://avatars.discourse-cdn.com/v4/letter/d/ecd19e/32.png) [@Daveshirman](https://forum.ionicframework.com/u/Daveshirman)\
**Post date:** [March 6, 2018, 11:05pm UTC](https://forum.ionicframework.com/t/ionic-3-cant-build-android-since-updating-cordova-etc/123633/10 "2018-03-06T23:05:38Z")

</div>

Updating Node LTS + NPm, just posting a sentence doesn’t help people who aren’t familiar with the correct commands to run.

---

<div class="post-metadata">

**Author:** ![AaronSterling](https://avatars.discourse-cdn.com/v4/letter/a/51bf81/32.png) [@AaronSterling](https://forum.ionicframework.com/u/AaronSterling)\
**Post date:** [March 6, 2018, 11:08pm UTC](https://forum.ionicframework.com/t/ionic-3-cant-build-android-since-updating-cordova-etc/123633/11 "2018-03-06T23:08:26Z")

</div>

I recommend you read the Wikipedia articles on NodeJS and npm. You don’t understand tools that are more fundamental to your setup than Ionic. There’s no terminal command to do what I suggested, unless you’ve already installed nvm, which I doubt.

---

<div class="post-metadata">

**Author:** ![vcarvalho0402](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/vcarvalho0402/32/110697_2.png) [@vcarvalho0402](https://forum.ionicframework.com/u/vcarvalho0402)\
**Post date:** [March 14, 2018, 3:00am UTC](https://forum.ionicframework.com/t/ionic-3-cant-build-android-since-updating-cordova-etc/123633/12 "2018-03-14T03:00:05Z")

</div>

According to the error message:

> …  
> 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

So, I think you need to install gradle and setup the environment variables correctly.  
I recommend SDKMAN to install but there are some more options: [Gradle | Installation](https://gradle.org/install/#install)

If even after installing gradle you can’t get it working, try to open android studio and run a simple android project (some sample app). Android studio probably will show more friendly error messages to you if there are any environment problem.

---

<div class="post-metadata">

**Author:** ![mhartington](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/mhartington/32/137757_2.png) [@mhartington](https://forum.ionicframework.com/u/mhartington)\
**Post date:** [July 19, 2021, 9:46pm UTC](https://forum.ionicframework.com/t/ionic-3-cant-build-android-since-updating-cordova-etc/123633/13 "2021-07-19T21:46:26Z")

</div>


