Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

cant complete ionic capacitor add android command

I am trying to add android as a supported platform to my project by running the command: ionic capacitor add android.

The command is executed and stops at a prompt which asks me "which npm client would you like to use ? (use arrow keys), with yarn being the only option.

The problem is I am stuck at this point and pressing the arrow keys do not register anything (the keys work fine) and I cant even select the only option I am given

So far I have tried: uninstalling yarn creating new project deleting the node_modules updating all modules

Nothing seems to work. On the plus side though when I attempted to do these steps on another machine it all worked well and I never got the prompt, which makes it unique to only my main workstation. I am still trying to figure out why I get the problem on this specific machine

like image 669
William Avatar asked May 07 '19 02:05

William


2 Answers

It's a bug on the ionic CLI. It's been fixed, but not released yet. https://github.com/ionic-team/capacitor/issues/1453

As workaround you can remove the --capacitor option when creating the project, and then do the integration manually like this:

npm install @capacitor/core @capacitor/cli

npx cap init

And let Ionic know you did the integration by adding this to the ionic.config.json

"integrations": {
    "capacitor": {}
},
like image 54
jcesarmobile Avatar answered Oct 09 '22 14:10

jcesarmobile


Issue: Unable to add Android platform

I got this issue while adding the android platform in the Ionic Capacitor app using the below command.

$ ionic capacitor add android

It seems a bug in Ionic CLI (as mentioned above). So, I thought to use Capacitor CLI instead.

Solution:

As a workaround, I did the following:

$ npm install @capacitor/android
$ npx capacitor add android

This successfully added the android folder to my project.

like image 43
Ankush Jain Avatar answered Oct 09 '22 14:10

Ankush Jain