Android home variable mac

How To Set Android SDK Path In Windows And Mac

After you installed android studio, you still need to configure some android SDK environment variables then you can use it easily. This article will tell you how to correctly configure Android SDK environment variables such as ANDROID_HOME, PATH on Windows and macOS.

1. Configure Android SDK Variable In Windows.

1.1 Get Android SDK Install Directory Path.

Before you can configure it, you should first get the android SDK install directory follow below steps.

  1. Open android studio, click File —> Settings menu item in the top men bar.
  2. Expand Appearance & Behavior —>System Settings —>Android SDK menu item on the left side of the popup window. Then you can find the Android SDK Location directory path on the right side ( in this example, the Android SDK location path is C:\Users\Jerry\AppData\Local\Android\Sdk ), remember it.

1.2 Set %ANDROID_HOME% and %Path% System Environment Variable.

  1. Right-click the computer icon in Windows file explorer left side, click Properties menu item in the popup menu list. This will open the windows system configuration window.
  2. Click the Advanced system settings link on left panel, it will popup the System Properties window, click the Environment Variables button to open Environment Variables window.
  3. Click the New… button to add a new system variable, input ANDROID_HOME as the variable name, and input the Android SDK location directory path ( such as C:\Users\Administrator\AppData\Local\Android\Sdk ) as the variable value.
  4. Select variable Path and click Edit button and add ;%ANDROID_HOME%\tools;%ANDROID_HOME%\tools\bin;%ANDROID_HOME%\platform-tools at the end of its value. Please note the ; must be English character otherwise it will not take effect .
  5. Click OK to close the system environment variables settings window, open a dos window, type command adb in it. If you see output like below that means the android SDK path variable has been configured successfully.

2. Configure Android SDK Variable In macOS.

  1. Open Android Studio on macOS, then click Android Studio —> Preferences menu item at the left top toolbar.
  2. Input search keyword sdk in the search box of the popup Preferences dialog window left side.
  3. It will focus on the Android SDK menu item on the left side, and you can get the Android SDK Location directory path value on the right side Android SDK Location text box.
  4. Generally, the Android SDK is installed in the /Users/user-name/Library/Android/sdk folder on macOS.
  5. If you can not find the above folder in macOS finder or terminal, this is because the Library folder is a hidden folder by default, you should make the hidden folder visible by executing the command $ defaults write com. apple . finder AppleShowAllFiles TRUE in a macOS terminal window ( please read article How To Show Hidden Files In Mac OS Finder And Select Hidden Files In Html Upload File Form ).
  6. You can also see the hidden Library folder by opening a macOS Finder window, then click Go —> Go to Folder… menu item, and input

/Library in the popup dialog input text box, then click Go button.

  • This is also another method to show the hidden Library folder, open a macOS Finder window, click Go —> Home menu item. Right-click the home folder, then click the Show View Options menu item in the popup menu list. Check the Show Library Folder checkbox.
  • Use nano to create or edit user bash profile in user home directory.
  • Add ANDROID_HOME and PATH environment variable in user bash profile.
  • Make the added system environment take effect.
  • Now open a terminal and run adb, you should also see something output like in windows.
  • Источник

    Setting ANDROID_HOME Environmental Variable on Mac

    In this tutorial, we will show you how to set ANDROID_HOME Environmental Variable on Mac OS X.

    Setting ANDROID_HOME environmental variable on Maverick Mac OS X Lion (10.7.5)

    The ANDROID_HOME environment variable can be used to tell maven where to find the Android SDK. In your home directory, add a file called .bash_profile

    Set the ANDROID_HOME variable to your SDK directory example,

    Setting ANDROID_HOME environmental variable on Maverick Mac OS X (10.9.x)

    Configure the ANDROID_HOME environment variable based on the location of the Android SDK. Additionally, consider adding ANDROID_HOME/tools, and ANDROID_HOME/platform-tools to your PATH.

    Setting ANDROID_HOME environment variable to .bash_profile

    Open the Terminal program present in your (this is in your Applications/Utilities folder by default). Follow the below steps.

    Step-1

    Start up Terminal and go to your home folder.

    Step-2

    Open and edit .bash_profile file

    If you don’t have .bash_profile file in your computer path, then create one. Enter below command to create a new file. Once created follow Step-2.

    Step-3

    Save the below line)

    Step-4

    Refresh the file using below command

    Step-5

    Check if the JAVA_HOME is set properly

    You will see the result similar to below. Find for your path in there. If available, then you are good

    Alternatively, You can run android command, it will start android SDK manager

    Источник

    Настройка переменной окружения ANDROID_HOME для Mac OS X

    Может ли кто-нибудь отправить рабочее решение для установки ANDROID_HOME через терминал?

    Мой путь к Android-SDK — /Applications/ADT/sdk .

    ОТВЕТЫ

    Ответ 1

    Где установлен Android-SDK, зависит от того, как вы его установили.

    Если вы загрузили SDK через их веб-сайт, а затем перетащили приложение в папку «Приложения», скорее всего, оно находится здесь:

    /Applications/ADT/sdk (как в вашем случае).

    Если вы установили SDK с помощью Homebrew ( brew cask install android-sdk ), то он находится здесь:

    Если SDK был установлен автоматически как часть Android Studio, он находится здесь:

    Как только вы узнаете местоположение, откройте окно терминала и введите следующее (изменив путь к SDK, чтобы он был установлен):

    Получив этот набор, вы должны добавить его в переменную среды PATH:

    И наконец, примените эти изменения, повторно применив источник .bash_profile:

    1. Введите — echo $ ANDROID_HOME, чтобы проверить, установлен ли дом.

    Ответ 2

    Ответ 3

    Добавление следующего в мой .bash_profile работал для меня:

    Ответ 4

    Часть «bin» изменилась, и она должна быть

    Ответ 5

    У меня MAC OS X (Sierra) 10.12.2.

    Я настроил ANDROID_HOME для работы с React Native(для приложений Android), выполнив следующие действия.

      Откройте Терминал (нажмите Command + R, введите Терминал, нажмите ENTER).

    Добавьте следующие 4 строки в

    Наконец, выполните приведенную ниже команду (или перезапустите систему, чтобы отразить сделанные изменения).

    Что это.

    Ответ 6

    Чтобы установить ANDROID_HOME , переменную, вам нужно знать, как вы установили настройку Android.

    Если вы не знаете, что можете проверить, существуют ли в вашем компьютере следующие пути. Добавьте в .bashrc , .zshrc или .profile следующее в зависимости от того, что вы используете

    Если вы установили с homebrew,

    Проверьте, существует ли этот путь:

    Если вы установили студию Android после веб-сайта,

    Наконец, добавьте его в путь:

    Если вы слишком ленивы, чтобы открыть редактор, сделайте следующее:

    Ответ 7

    Может ли кто-нибудь опубликовать рабочее решение для этого в терминале?

    ANDROID_HOME обычно является каталогом типа .android . В нем будут храниться такие вещи, как «Отладочный ключ».

    Вы можете автоматизировать его для своего входа. Просто добавьте его в свой .bash_profile (ниже из моего компьютера OS X 10.8.5):

    По словам Дэвида Тернера в списке рассылки NDK, необходимо установить как ANDROID_NDK_ROOT , так и ANDROID_SDK_ROOT , потому что другие инструменты зависят от этих значений (см. Recommended NDK Directory?).

    /.bash_profile выполните следующие действия (или выйдите из системы):

    Ответ 8

    Люди, обратите внимание, что если вы будете использовать

    /.bash_profile , тогда он будет редактировать не пользовательский профиль bash, а глобальный. Вместо этого перейдите в каталог пользователей (/Users/username) и отредактируйте его напрямую:

    И вставьте следующие две строки в отношении вашего имени пользователя и каталога SDK

    Источник

    Установите переменную окружения ANDROID_HOME в mac

    Я новичок в разработке собственного приложения с использованием Salesforce SDK. Я попытался создать проект андроида из командной строки с помощью инструмента принудительного доступа, но есть проблема с установкой переменной среды с именем ANDROID_HOME.

    Но я не знаю, как установить эту переменную.

    У меня есть скриншот, чтобы правильно описать мою проблему.

    ОТВЕТЫ

    Ответ 1

    Откройте терминал и введите:

    Добавьте это в переменную среды PATH

    Если терминал не находит добавленные пути из файла .bash_profile, запустите эту команду

    Надеюсь, что это сработает для вас!

    Ответ 2

    Чтобы сделать его постоянным в вашей системе, и переменная продолжает работать после закрытия терминала, после перезапуска используйте:

    Откройте терминал и проверьте, не сработало ли оно:

    Ответ 3

    Вышеприведенный ответ верен. Работает очень хорошо. Существует также быстрый способ сделать это.

      Откройте командную строку

    Тип — экспорт эха «ANDROID_HOME =/Пользователи/yourName/Library/Android/sdk» →

    Откройте его снова.

    Введите echo $ANDROID_HOME, чтобы проверить, установлен ли домашний файл.

    Ответ 4

    Ответ 5

    Как нуб, я много боролся с настройкой переменной. Я создавал копии файлов .bash_profile, текст в файле не сохранялся и т.д.

    Поэтому я задокументировал шаги, которые спомогли мне. Это простой и надежный (но немного длинный) способ сделать это do

    Шаг 1. Зайдите в Finder > Go (вверху), нажмите на пользователей, затем в вашей учетной записи вы увидите что-то вроде этого:

    Шаг 2. Теперь зажмите ⌘ + ⇧+. (точка), теперь будут отображаться скрытые файлы и папки. Это будет выглядеть примерно так:

    PS: если ⌘ + ⇧+. не работает, пожалуйста, найдите сочетание клавиш, соответствующее вашему имени операционной системы Mac

    Шаг 3.

    Сценарий A: если .bash_profile уже существует

    Step3.A.1: Дважды щелкните по .bash_profile. Он должен открываться с помощью TextEdit (или, наоборот, щелкнуть правой кнопкой мыши> открыть с помощью> TextEdit)

    Step3.A.2: Вставьте текст переменной в файл .bash_profile, используя ⌘ + V

    Step3.A.3: сохраните файл .bash_profile, используя ⌘ + S

    Сценарий Б: Если .bash_profile НЕ существует, это довольно глупый способ сделать это, но он отлично сработал для такого нуба, как я

    Step3.B.1: Скачать бесплатно BBEdit текстового редактора, который является довольно легким весом. Что особенного в этом редакторе, так это то, что он позволяет сохранять файл, начинающийся с «.»

    Step3.B.2: создайте новый файл

    Шаг 3. B.3: сохраните файл в папке вашей учетной записи. Появится предупреждение, которое выглядит примерно так:

    Нажмите » Использовать». кнопка. Тогда пустой файл .bash_profile будет сохранен

    Шаг 3. Б. 4: Вставьте текст переменной в файл .bash_profile, используя ⌘ + V

    Step3.B.5: сохраните файл .bash_profile, используя ⌘ + S

    Шаг 4: Последний и последний шаг — проверить, сработали ли вышеуказанные шаги. Откройте bash и введите echo $ANDROID_HOME

    Ваша переменная ANDROID_HOME должна быть установлена.

    Ответ 6

    Спасибо за быстрое решение. Действительно полезно.

    Ответ 7

    Во-первых, найдите расположение Android SDK в Android Studio: Android Studio → Настройки → Внешний вид и поведение → Системные настройки → Android SDK → Расположение Android SDK

    Затем выполните следующие команды в терминале

    export ANDROID_HOME = Вставьте сюда свое местоположение SDK

    экспорт PATH = $ PATH: $ ANDROID_HOME/bin

    Источник

    How to Set $JAVA_HOME environment variable on macOS

    By mkyong | Last updated: January 19, 2021

    Viewed: 1,304,199 (+6,711 pv/w)

    This article shows how to set the $JAVA_HOME environment variable on older Mac OS X and the latest macOS 11.

    Solution
    Steps to set the $JAVA_HOME environment variable on macOS.

    1. Find out your macOS version.
    2. Find out which shell you are using, bash or zsh?
    3. For zsh shell, export $JAVA_HOME at

    /.zshrc .
    For bash shell, export $JAVA_HOME at

    /.bashrc .

  • Test with echo $JAVA_HOME .
  • Done.
  • 1. macOS release history, bash or zsh?

    1.1 Review the macOS release history, source Wikipedia – macOS.

    1. Mac OS X Public Beta
    2. Mac OS X 10.0 (Cheetah)
    3. Mac OS X 10.1 (Puma)
    4. Mac OS X 10.2 Jaguar
    5. Mac OS X 10.3 Panther
    6. Mac OS X 10.4 Tiger
    7. Mac OS X 10.5 Leopard
    8. Mac OS X 10.6 Snow Leopard
    9. Mac OS X 10.7 Lion
    10. OS X 10.8 Mountain Lion
    11. OS X 10.9 Mavericks
    12. OS X 10.10 Yosemite
    13. OS X 10.11 El Capitan
    14. macOS 10.12 Sierra
    15. macOS 10.13 High Sierra
    16. macOS 10.14 Mojave
    17. macOS 10.15 Catalina (zsh)
    18. macOS 11 Big Sur (zsh)

    1.2 bash or zsh?
    On macOS 10.15 Catalina and later, the default Terminal shell switch from the bash (Bourne-again shell) to zsh (Z shell).

      For bash shell, we can put the environment variables at

    /.bashrc .
    For zsh shell, we can put the environment variables at

    We can print the $SHELL environment variable to determine the current shell you are using.

    Further Reading

    2. What is /usr/libexec/java_home

    2.1 On Mac OS X 10.5 or later, we can use /usr/libexec/java_home to return the location of the default JDK.

    2.2 Also, find all installed JDKs.

    2.3 Also, run a specified JDK command.

    3. $JAVA_HOME and macOS 11 Big Sur

    On macOS 10.15 Catalina and later, the zsh is the default Terminal shell, and we can set the $JAVA_HOME environment variable in either

    3.2 Add the following content

    3.3 Source the file and print the $JAVA_HOME , done.

    4. $JAVA_HOME and Mac OS X 10.5 Leopard

    For older Mac OS X, the bash is the default Terminal shell, and we can set the $JAVA_HOME environment variable in either

    4.2 Add the following content

    4.3 Source the file and print the $JAVA_HOME

    5. $JAVA_HOME and older Mac OS X

    On older Mac OS X, the tool /usr/libexec/java_home doesn’t exists, and we need to set the $JAVA_HOME to the real path.

    5.2 Add the following content

    5.3 Source the file and print the $JAVA_HOME

    6. Switch between different JDK versions

    For example, this macOS contains four JDK: 1.8, 14, 15, and 16, and the default JDK is 16.

    6.1 For zsh shell, edit the

    6.2 /usr/libexec/java_home -v»<$Version>» to activate a specified JDK version.

    Add the following content to activate the JDK 1.8

    If we want JDK 14.

    If we want JDK 15.

    6.3 Source the file and print the $JAVA_HOME , done.

    Источник

    Читайте также:  Музыкальные открытки для андроида
    Оцените статью