# Issue building Android

**URL:** <https://forum.ionicframework.com/t/issue-building-android/140227>\
**Category:** ionic-v3\
**Created:** [August 30, 2018, 10:01am UTC](https://forum.ionicframework.com/t/issue-building-android/140227 "2018-08-30T10:01:11Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![jorgster](https://avatars.discourse-cdn.com/v4/letter/j/aeb1de/32.png) [@jorgster](https://forum.ionicframework.com/u/jorgster)\
**Post date:** [August 30, 2018, 10:01am UTC](https://forum.ionicframework.com/t/issue-building-android/140227/1 "2018-08-30T10:01:11Z")

</div>

The command “ionic cordova build android” is failing me.  
Here is the error I’m getting:

```auto
> cordova build android
Android Studio project detected
(node:19196) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: Cannot find module '../cordova/platform_metadata'

(node:19196) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

```

Here is my ionic info:

```auto
Ionic:

   ionic (Ionic CLI) : 4.1.1 (C:\Users\The Arctic AS\AppData\Roaming\npm\node_modules\ionic)
   Ionic Framework : ionic-angular 3.9.2
   @ionic/app-scripts : 3.1.9

Cordova:

   cordova (Cordova CLI) : 8.0.0
   Cordova Platforms : android 7.0.0, ios 4.5.4
   Cordova Plugins : cordova-plugin-ionic-keyboard 2.0.5, cordova-plugin-ionic-webview 1.1.1, (and 14 other plugins)

System:

   NodeJS : v8.2.1 (C:\Program Files\nodejs\node.exe)
   npm : 5.3.0
   OS : Windows 10

```

---

<div class="post-metadata">

**Author:** ![Sujan12](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/sujan12/32/108395_2.png) [@Sujan12](https://forum.ionicframework.com/u/Sujan12)\
**Post date:** [August 30, 2018, 10:07am UTC](https://forum.ionicframework.com/t/issue-building-android/140227/2 "2018-08-30T10:07:14Z")

</div>

> [@jorgster](#):
>
> Cordova Platforms : android 7.0.0

Your Cordova tooling seems to be out of date, which might be causing all kinds of problems.  
You can read about how to figure out the current Cordova versions and how to update CLI, platforms and plugins here: [How to update Cordova CLI, Platforms and Plugins · ionic.zone](https://ionic.zone/cordova/update)

---

<div class="post-metadata">

**Author:** ![jorgster](https://avatars.discourse-cdn.com/v4/letter/j/aeb1de/32.png) [@jorgster](https://forum.ionicframework.com/u/jorgster)\
**Post date:** [August 30, 2018, 10:08am UTC](https://forum.ionicframework.com/t/issue-building-android/140227/3 "2018-08-30T10:08:47Z")

</div>

> [@Sujan12](#):
>
> o

Thanks for the quick reply.  
Yeah I wanted to keep an old version so that I knew everything would work well together, but somehow I’ve messed it up. Will try updating.

---

<div class="post-metadata">

**Author:** ![jorgster](https://avatars.discourse-cdn.com/v4/letter/j/aeb1de/32.png) [@jorgster](https://forum.ionicframework.com/u/jorgster)\
**Post date:** [August 30, 2018, 10:17am UTC](https://forum.ionicframework.com/t/issue-building-android/140227/4 "2018-08-30T10:17:37Z")

</div>

Hi @Sujan12 ,  
I’m actually not able to add Android again… as a plaform.  
Getting this issue:

```auto
t(node:20668) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: Cannot find module '../cordova/platform_metadata'
(node:20668) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code

```

Same as before.

---

<div class="post-metadata">

**Author:** ![Sujan12](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/sujan12/32/108395_2.png) [@Sujan12](https://forum.ionicframework.com/u/Sujan12)\
**Post date:** [August 30, 2018, 10:43am UTC](https://forum.ionicframework.com/t/issue-building-android/140227/5 "2018-08-30T10:43:52Z")

</div>

Interesting.

Post the complete output of the command with `--verbose` added at the end.

---

<div class="post-metadata">

**Author:** ![jorgster](https://avatars.discourse-cdn.com/v4/letter/j/aeb1de/32.png) [@jorgster](https://forum.ionicframework.com/u/jorgster)\
**Post date:** [August 30, 2018, 10:49am UTC](https://forum.ionicframework.com/t/issue-building-android/140227/6 "2018-08-30T10:49:54Z")

</div>

```auto
PS ...> ionic cordova platform add android@7.1.1 --verbose
  ionic:cli-utils Terminal info: { tty: true, ci: false } +0ms
  ionic:cli-utils CLI global options: { _: ['cordova', 'platform', 'add', 'android@7.1.1'], help: null, h: null, verbose: true, quie
t: null, interactive: true, color: true, confirm: null, json: null, project: null, '--': [] } +4ms
  ionic:cli-utils:lib:project Project type from config: Ionic Angular 3 (ionic-angular) +0ms
  ionic:cli-utils Project name: undefined +219ms
  ionic:cli Context: { binPath: 'C:\\...\\AppData\\Roaming\\npm\\node_modules\\ionic\\bin\\ionic', libPath: '...\\AppData\\Roaming\\npm\\node_modules\\ionic', execPath: 'D:\\..\\..', version: '4.1.1' } +0ms
  ionic:cli-utils:lib:integrations:cordova:config Using config.xml: D:\...\...\config.xml +0ms
> cordova platform add android@7.1.1 --verbose --save
No scripts found for hook "before_platform_add".
Using cordova-fetch for cordova-android@7.1.1
saving exact
Running command: cmd "/s /c ""...\nodejs\npm.cmd" install cordova-android@7.1.1 --production --save-exact""
Command finished with error code 0: cmd /s /c ""...\nodejs\npm.cmd" install cordova-android@7.1.1 --production --save-exa
ct"
Removing "cordova-" prefix from cordova-android
(node:22132) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Platform android already added.
(node:22132) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not
 handled will terminate the Node.js process with a non-zero exit code.

```

I’ve removed the folder structures, don’t want to share it.

---

<div class="post-metadata">

**Author:** ![Sujan12](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/sujan12/32/108395_2.png) [@Sujan12](https://forum.ionicframework.com/u/Sujan12)\
**Post date:** [August 30, 2018, 12:14pm UTC](https://forum.ionicframework.com/t/issue-building-android/140227/7 "2018-08-30T12:14:58Z")

</div>

> [@jorgster](#):
>
> (node:22132) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Platform android already added.

If it fails first, you have to remove it completely before trying again.

---

<div class="post-metadata">

**Author:** ![jorgster](https://avatars.discourse-cdn.com/v4/letter/j/aeb1de/32.png) [@jorgster](https://forum.ionicframework.com/u/jorgster)\
**Post date:** [August 30, 2018, 12:15pm UTC](https://forum.ionicframework.com/t/issue-building-android/140227/8 "2018-08-30T12:15:36Z")

</div>

I had to downgrade my cordova to 7.1.0, and then it worked.

---

<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:18pm UTC](https://forum.ionicframework.com/t/issue-building-android/140227/9 "2021-07-19T21:18:20Z")

</div>

Closed on July 19, 2021, 9:18pm UTC


