Where is android_sdk_root? and how do I set it.?

2020-02-02 17:26发布

I set the android_sdk_home variable so that my application could find .android when trying to run. Now I get an error stating that "android_sdk_root is undefined". I am running win 7 with a new installation of Android Studio, inside parallels on a macbook pro.

Thank you for your response. I checked the location and it is identified as the same location as the ANDROID_SDK_HOME environment path. It still says root is undefined. I created an ANDROID_SDK_ROOT enviroment path to the same location and it is still undefined.

标签: android
10条回答
太酷不给撩
2楼-- · 2020-02-02 18:25

This is how I did it on Mac:

vim ~/.bash_profile

And added the following environment variables:

export ANDROID_HOME=/Users/{{your user}}/Library/Android/sdk
export ANDROID_SDK_ROOT=/Users/{{your user}}/Library/Android/sdk
export ANDROID_AVD_HOME=/Users/{{your user}}/.android/avd

Android path might be different, if so change it accordingly. At last, to refresh the terminal to apply changes:

source ~/.bash_profile
查看更多
Viruses.
3楼-- · 2020-02-02 18:25

android_sdk_root is a system variable which points to root folder of android sdk tools. You probably get the error because the variable is not set. To set it in Android Studio go to:

  1. File -> project Structure into Project Structure
  2. Left -> SDK Location
  3. SDK location select Android SDK location

If you have installed android SDK please refer to this answer to find the path to it: https://stackoverflow.com/a/15702396/3625900

查看更多
Juvenile、少年°
4楼-- · 2020-02-02 18:26

Open the terminal and run the command: nano $HOME/.bashrc aggregate the follow line:

export ANDROID_HOME=$HOME/Android/Sdk
export ANDROID_SDK_ROOT=$HOME/Android/Sdk
export PATH=$PATH:$ANDROID_HOME/tools
export PATH=$PATH:$ANDROID_HOME/platform-tools

Ctrl+o save and ctrl+x close.

And run the command:

source $HOME/.bashrc

echo $ANDROID_SDK_ROOT
查看更多
干净又极端
5楼-- · 2020-02-02 18:27

MAC - one liner

echo "export ANDROID_HOME=~/Library/Android/sdk \
      export ANDROID_SDK_ROOT=~/Library/Android/sdk \
      export ANDROID_AVD_HOME=~/.android/avd" \
>> ~/.bash_profile && source ~/.bash_profile
查看更多
登录 后发表回答