Как установить android sdk для unity
Перейти к содержимому

Как установить android sdk для unity

  • автор:

 

How to install Android SDK for unity?

How to install Android SDK for building an app in Unity?

I used the guide and followed the steps.

After implementing the steps I still can not find the sdk.exe which is needed for the build proces.

2 Answers 2

There is no such file as sdk.exe

Default path of SDK folder is: C:\Users\[yourName]\AppData\Local\Android\android-sdk

There is a file named SDK Manager.exe in that address where you can install or update SDK modules.

After installing SDK and JDK you need to set their paths in Unity -> Edit -> Preferences. :

enter image description here

In Unity -> File -> Build Settings select Android from platforms list and click Build :

enter image description here

Or you can click on Build and Run ( Ctrl + B ) if Device is already set in Edit -> Project Settings -> Editor to Any Android Device

That’s all you need to do for building your game for android.

you may also need to move Java Path to the first position in the PATH variable in environment variables.

Настройка Android SDK

Прежде чем вы сможете запустить написанный код на Android-устройстве, нужно выполнить несколько простых действий. Это относится как к работе с Unity, так и к созданию приложений с нуля.

1. Скачать Android SDK

Зайдите на страницу Android Developer SDK. Скачайте архив с последней версией Android SDK и распакуйте его.

2. Установить Android SDK

Следуйте инструкциям на странице Installing the SDK (причём, вы можете свободно пропустить опциональные части, относящиеся к Eclipse). В шаге 4 руководства Installing the SDK убедитесь, что добавили как минимум одну Android platform (Android платформу) с уровнем API равным или выше 9 (платформа 2.3 или выше), Platform Tools и USB drivers (USB драйверы), если вы используете Windows.

3. Удостовериться, что система определяет ваше устройство

Это может быть не так просто, особенно на Windows системах, в которых драйвера часто бывают источником проблем. Также, с вашим устройством может идти дополнительная информация или особые драйверы от производителя.

Для Windows: если Andoid устройство автоматически определяется системой, вам все равно придётся обновить драйверы на те, который поставляются с Android SDK. Это делается через диспетчер устройств Windows. —>Если устройство не определяется автоматически, используйте драйверы из Android SDK или особые драйверы, предоставленные производителем. —>Дополнительную информацию можно найти здесь: USB Drivers for Windows

Для Mac: если вы разрабатываете на OSX, тогда обычно не требуется никаких дополнительных драйверов.

Важно: Не забудьте включить “Отладку по USB” на вашем устройстве. Перейдите в Настройки -> Параметры разработчика , для включения отладки по USB. Начиная с Android Jelly Bean 4.2, параметры разработчика по умолчанию скрыты. Для их включения, понажимайте несколько раз пальцем на строку в меню Настройки -> Об устройстве -> Номер сборки . После этого вам станет доступен пункт Настройки -> Параметры разработчика .

Если вы не уверены, что ваше устройство корректно установилось в системе, пожалуйста, прочтите страницу Решение проблем при разработке под Android для дополнительной информации.

4. Добавить путь до Android SDK в Unity

При первой сборке проекта под Android (или если Unity не сможет обнаружить SDK), вас попросят указать местоположение папки, в которую вы установили Android SDK (вы должны выделить корневую папку установленного SDK). Путь до Android SDK также можно изменить в редакторе, выбрав в меню Unity > Preferences и перейдя в раздел External Tools окна настроек.

Android environment setup

To create a Unity application for Android, you first need to set up your Unity project to support Android. To support Android, a Unity project requires the following dependencies:

  • The Android Build Support module.
  • The Android Software Development Kit (SDK).
  • The Native Development Kit (NDK).
  • A Java Development Kit. By default, Unity uses OpenJDK.

Before you get started, check Unity’s Requirements and compatibility documentation for Android to make sure you’re aware of any limitations for developing a Unity application for Android.

Installing dependencies

Unity distributes dependencies as modules which means you use the Unity Hub to install them. You can install them either when you install a new Unity Editor version, or add them to an existing Unity Editor install. To install modules:

  • At install time, see Downloading and installing Editors and modules with the Unity Hub.
  • To an existing install, see Add modules.

The three modules to install are:

  • Android Build Support
  • Android SDK & NDK Tools
  • OpenJDK

Unity installs Android SDK & NDK Tools and OpenJDK respectively in the SDK , NDK , and OpenJDK folders under /Unity/Hub/Editor/[EditorVersion]/Editor/Data/PlaybackEngines/AndroidPlayer/ .

Customizing dependencies

You should use the Unity Hub to install Android SDK & NDK tools and OpenJDK to ensure that you receive the correct versions and configurations. However, there are situations where it’s useful to change the SDK, NDK, or JDK that Unity uses to build applications for Android. For example, if you have multiple versions of Unity with the same dependencies and you don’t want to duplicate the installation of the SDK, NDK, and JDK, you can specify a shared location.

 

To make Unity use a custom version of a dependency:

  1. Download the custom version of the dependency.
    Warning: Unity only officially supports versions of the OpenJDK, SDK, or NDK that it supplies through the Hub. For more information, see Supported dependency versions.
  2. In Unity, select Edit > Preferences (macOS: Unity > Preferences).
  3. In the left navigation column, select External Tools. The Android section of the External Tools panel contains entries for JDK, SDK, NDK, and Gradle An Android build system that automates several build processes. This automation means that many common build errors are less likely to occur. More info
    See in Glossary
    . Each entry contains:
    • A checkbox that indicates whether to use the version that Unity provides or a custom version.
    • The path to the dependency’s installation folder.
      Preferences window showing external tools settings for Android
  4. To customize the installation for any of these dependencies, disable the dependency’s respective …installed with Unity (recommended) checkbox then click Browse and select the installation folder for the custom dependency.
Supported dependency versions

This section contains information on which versions of each dependency each Unity version supports. Each version of Unity requires a specific version of the Android NDK and Android JDK, but there are no exact version requirements for the Android SDK.

Unity relies on tools that the Android SDK provides and different versions of the SDK usually have the same tools available. This means you can use any recent version of the SDK since they all contain the build tools that Unity requires.

Important: The minimum Android SDK Build-tools version that Unity supports is version 32.

The following table shows the NDK version that each Unity version supports:

Unity version NDK version
2019.4 LTS r19
2020.3 LTS r19
2021.2 r21d
2021.3 LTS r21d
2022.2 r23b

The following table shows the JDK version that each Unity version supports:

Unity version JDK version
2019.4 LTS 8 (OpenJDK version 1.8)
2020.3 LTS 8 (OpenJDK version 1.8)
2021.2 8 (OpenJDK version 1.8)
2021.3 LTS 8 (OpenJDK version 1.8)
2022.2 11 (OpenJDK version 11)

Setting the Android SDK Target API

The Unity Hub installs the latest version of the Android SDK Target API that Google Play requires. If you need to use a more recent version, you can change it in the Android Player Settings. To do this:

  1. Select Edit > Project Settings.
  2. In the Project settings window, select the Player tab, then open Android Player Settings:
    Selecting a target API for the Android SDK
  3. In the Other Settings section, change the Target API Level.

If you select a target API version newer than the latest installed version, the Unity Android SDK Updater can automatically download and install the new version. Unity displays a prompt and you can choose to either:

  • Automatically download and install the new version of the Android SDK.
  • Continue to use the highest installed version of the Android SDK.

If you select a target API version that isn’t installed and is older than the latest installed version, the Unity Android SDK Updater can’t perform the update and Unity displays an error message. In this case, to update the Android SDK Target API, you must use the Android sdkmanager from either Android Studio or the command-line tool. Regardless of the method you choose, make sure to select the correct Android SDK folder for Unity in the Edit > Preferences > External Tools window. For more information, see Customizing dependencies.

Important: On Windows, if you installed the Unity Editor in the default folder ( /Program Files/ ), you must run the sdkmanager with elevated privilege (Run as Administrator) to perform the update.

Chrome OS

In Unity, Chrome OS is part of the Android development environment. This means you can deliver new and existing Android applications to Chrome OS. Also, since many Chrome OS devices are laptops or have a laptop mode, you can use features such as mouse and keyboard input. For more information:

Android environment setup

To create a Unity application for Android, you first need to set up your Unity project to support Android. To support Android, a Unity project requires the following dependencies:

  • The Android Build Support module.
  • The Android Software Development Kit (SDK).
  • The Native Development Kit (NDK).
  • A Java Development Kit. By default, Unity uses OpenJDK.

Before you get started, check Unity’s Requirements and compatibility documentation for Android to make sure you’re aware of any limitations for developing a Unity application for Android.

Installing dependencies

Unity distributes dependencies as modules which means you use the Unity Hub to install them. You can install them either when you install a new Unity Editor version, or add them to an existing Unity Editor install. To install modules:

  • At install time, see Downloading and installing Editors and modules with the Unity Hub.
  • To an existing install, see Add modules.

The three modules to install are:

  • Android Build Support
  • Android SDK & NDK Tools
  • OpenJDK

Unity installs Android SDK & NDK Tools and OpenJDK respectively in the SDK , NDK , and OpenJDK folders under /Unity/Hub/Editor/[EditorVersion]/Editor/Data/PlaybackEngines/AndroidPlayer/ .

Customizing dependencies

You should use the Unity Hub to install Android SDK & NDK tools and OpenJDK to ensure that you receive the correct versions and configurations. However, there are situations where it’s useful to change the SDK, NDK, or JDK that Unity uses to build applications for Android. For example, if you have multiple versions of Unity with the same dependencies and you don’t want to duplicate the installation of the SDK, NDK, and JDK, you can specify a shared location.

To make Unity use a custom version of a dependency:

  1. Download the custom version of the dependency.
    Warning: Unity only officially supports versions of the OpenJDK, SDK, or NDK that it supplies through the Hub. For more information, see Supported dependency versions.
  2. In Unity, select Edit > Preferences (macOS: Unity > Preferences).
  3. In the left navigation column, select External Tools. The Android section of the External Tools panel contains entries for JDK, SDK, NDK, and Gradle An Android build system that automates several build processes. This automation means that many common build errors are less likely to occur. More info
    See in Glossary
    . Each entry contains:
    • A checkbox that indicates whether to use the version that Unity provides or a custom version.
    • The path to the dependency’s installation folder.
      Preferences window showing external tools settings for Android
  4. To customize the installation for any of these dependencies, disable the dependency’s respective …installed with Unity (recommended) checkbox then click Browse and select the installation folder for the custom dependency.
Supported dependency versions

This section contains information on which versions of each dependency each Unity version supports. Each version of Unity requires a specific version of the Android NDK and Android JDK, but there are no exact version requirements for the Android SDK.

Unity relies on tools that the Android SDK provides and different versions of the SDK usually have the same tools available. This means you can use any recent version of the SDK since they all contain the build tools that Unity requires.

Important: The only exceptions are Android SDK Build-tools versions higher than version 30. Unity doesn’t support Android SDK Build-tools versions higher than 30.

The following table shows the NDK version that each Unity version supports:

Unity version NDK version
2019.4 LTS r19
2020.3 LTS r19
2021.2 r21d
2021.3 LTS r21d

The following table shows the JDK version that each Unity version supports:

Unity version JDK version
2019.4 LTS 8 (OpenJDK version 1.8)
2020.3 LTS 8 (OpenJDK version 1.8)
2021.2 8 (OpenJDK version 1.8)
2021.3 LTS 8 (OpenJDK version 1.8)

Setting the Android SDK Target API

The Unity Hub installs the latest version of the Android SDK Target API that Google Play requires. If you need to use a more recent version, you can change it in the Android Player Settings. To do this:

  1. Select Edit > Project Settings.
  2. In the Project settings window, select the Player tab, then open Android Player Settings:
    Selecting a target API for the Android SDK
  3. In the Other Settings section, change the Target API Level.

If you select a target API version newer than the latest installed version, the Unity Android SDK Updater can automatically download and install the new version. Unity displays a prompt and you can choose to either:

  • Automatically download and install the new version of the Android SDK.
  • Continue to use the highest installed version of the Android SDK.

If you select a target API version that isn’t installed and is older than the latest installed version, the Unity Android SDK Updater can’t perform the update and Unity displays an error message. In this case, to update the Android SDK Target API, you must use the Android sdkmanager from either Android Studio or the command-line tool. Regardless of the method you choose, make sure to select the correct Android SDK folder for Unity in the Edit > Preferences > External Tools window. For more information, see Customizing dependencies.

Important: On Windows, if you installed the Unity Editor in the default folder ( /Program Files/ ), you must run the sdkmanager with elevated privilege (Run as Administrator) to perform the update.

Chrome OS

In Unity, Chrome OS is part of the Android development environment. This means you can deliver new and existing Android applications to Chrome OS. Also, since many Chrome OS devices are laptops or have a laptop mode, you can use features such as mouse and keyboard input. For more information:

 

Добавить комментарий

Ваш адрес email не будет опубликован. Обязательные поля помечены *