Ionic android build Error - Failed to find 'ANDROID_HOME' environment variable

前端 未结 12 1481
庸人自扰
庸人自扰 2020-12-23 19:41

I am trying to build android for ionic in linux but its showing me an error like this

     [Error: Failed to find \'ANDROID_HOME\' environment variable. 
           


        
12条回答
  •  鱼传尺愫
    2020-12-23 19:59

    For OSX

    • into ~/.bash_profile add:

      export ANDROID_HOME="/path/to/android-sdk-macosx"
      export PATH="$ANDROID_HOME/platform-tools:$ANDROID_HOME/tools:$PATH"
      

      and then execute it in terminal to take effect immediately;

    • into /etc/sudoers add: (you can use console: sudo visudo)

      Defaults        env_keep += "ANDROID_HOME"
      

      since the building process has to start with sudo and Node's process.env get the respective variables.

提交回复
热议问题