What is android sdk root folder

How to install Android SDK and setup AVD Emulator without Android Studio

If you are trying to develop to Android, you probably will end up installing the Android Studio to get the Android SDK and the AVD Emulator working properly.

But if you are using another code editor, like Sublime Text or VSCode, installing the Android Studio will just mess up with your setup and consume your precious RAM for no good reason.

I had a hard time figuring out how to properly do this setup due the lack of documentation about it, so i hope this article helps you. 🙂

Recommended previous knowledge:

  • SDK (Standard Development Kit); Read about on Wikipedia;
  • AVD (Android Virtual Device); Read about on docs;
  • CLI (Command Line Interface); Read about on Wikipedia;
  • Android API levels; Read about on Vanderbilt University;
  • How to open, navigate and execute files in your OS terminal;
  • Know what are environmental variables;

Understanding the Android SDK

Basically, the Android SDK is a bunch of packages necessary to develop for Android.

These packages stays in subfolders of a folder called “sdk” (or “android-sdk” sometimes). You do not need to know how these packages really work, just what they do.

The picture below is my Android SDK folder, these are the basic packages you will need in order to get everything working properly.

Here is a brief explanation of each package:

  • tools: This package is mainly used to manage the other packages and to create AVD’s;
  • emulator: As the name suggest, this is the Android emulator;
  • platform-tools: Some tools to communicate with Android devices when you plug then in your computer;
  • patcher: This package is automatically downloaded by the SDK. I didn’t find what exactly this is for, so just leave it as it is;

The folders bellow contain sub-folders with the packages for each Android API level.

  • platforms: The platform packages are required to compile your app for the specified API level.
  • system-images: These are the android images used in the emulator.
  • build-tools: These are necessary to build your Android apps

Installing the Android SDK

In order to install the SDK we will use the Command Line Tools. These are some quite simple CLI’s used to manage the Android SDK. You can read the documentation here for more details.

Step 1 — Download the tools package

First, you need to download the tools package. And with this package you can download the others.

  1. First, go to the Android Studio download page: https://developer.android.com/studio;
  2. Then click in “ Download Options”;
  3. There you will find a table named “ Command line tools only”;
  4. This table contain some zip files. Download the appropriate file for your system ( Windows, Mac or Linux);
  5. Extract this zip and you will get a folder called tools: This is the tools package i explained earlier;

Create a folder anywhere you prefer to place your SDK. I recommend you to stick with one of these commonly used places:

  • Globally: C:\Android\sdk or C:\android-sdk (this is not default, but i usually set my SDK here on Windows)
  • One user only: C:\Users\ \AppData\Local\Android\sdk
  • Globally: /Library/Android/sdk
  • One user only: /Users/ /Library/Android/sdk

And move the tools folder to this new sdk folder. Make sure you have admin access to this folder and any sub-folders inside it, or the tools package will fail to download new packages.

Note: You can also download a pre-build package for your SO (like the one available on Ubuntu repository). But i do not recommend you do to so, because they probably will not be updated and will be harder to manage, since it was automatically installed.

Step 2— You need Java 8!

The Android SDK packages require Java 8. If you do not have it, you need to download. If you are using a newer version, you have to downgrade to Java 8 or you will eventually get some errors, because it is not compatible.

Читайте также:  Android textview font size

If you do not have the Java 8 SDK, here is how you can install it:

On Ubuntu run these commands:

  • # sudo apt-get update
  • # sudo apt-get install openjdk-8-jdk

Sorry for MacOS users, i don’t know how to install it on this OS.

Step 3 — Download the essential packages

Now, download the platform-tools and the emulator packages, because they contain some CLI binary files you will need later. I decided to download these packages first in order to set all the necessary environment variables at once and make the rest of the process easier.

Open a terminal window (you need to use a terminal, not the file explorer), go to your sdk folder and navigate to the /tools/bin directory.

This folder contain the SDKManager binary: this is a CLI used to list the available packages in the Google’s repository and download, update or remove them from your SDK folder.

The bellow command will list all packages installed (the first items on the list) and all packages available to download:

To download the packages, simply copy the package names and pass it as a parameter to the SDKManager CLI using the terminal:

# ./sdkmanager platform-tools emulator

If you open your sdk folder you should see these packages folders there.

Step 4 — Set your environmental variables

You need to set the below environmental variables containing the path to our SDK, so any running program can find it in your pc:

ANDROID_SDK_ROOT = Path to your SDK folder

ANDROID_HOME = The same as ANDROID_SDK_ROOT. This variable is now deprecated, but i recommend setting it because some programs still using it to locate your sdk.

And add these folders to the PATH variable, making their binary files accessible from everywhere:

To add the environment variables on WIndows, just follow these steps:

  1. Open the “Control Panel”;
  2. Go to “ System and Security” option in the side menu;
  3. In the window “ System Properties” open the tab “ Advanced”;
  4. Click in the button “ Environment Variables” in the bottom of the page;
  5. In the “ Environment Variables” window you will see two tables: “User Variables” and ” System Variables”.
  6. If you created your sdk folder for one user only, set the variables in the “ User Variables” table;
  7. But, if you create your sdk folder globally, set the variables in the “ System Variables” table instead;

On Linux, you can set your environment variables in many places. So i choose the ones I found the most appropriate:

    If you created your sdk folder for one user only, set your environment variables in the file

/.bashrc;

  • If you created your sdk folder globally, set your environment variables in the /etc/environment file. But, be very careful! if you do something wrong with the path variable in this file you will broke your system (yes, i did this). This file is not a script, so you can’t use variables like $HOME, you need to write the full path to the folders. Variables declared in this file just will take effect after you logout .
  • Here is how i set these variables in my Ubuntu, using the file /etc/environment:

    And sorry again, no MacOS instructions for this task.

    You can find more about these environmental variables in the oficial docs here.

    Now your SDK is ready! If you do not need to run the emulator there’s no need to follow the next steps.

    Step 5 — Download the platform specific packages you want

    You need more three packages: The platform, the system-image and the build-tools. You can download these packages for any Android version you prefer. In this article, i will download the packages for the API Level 28.

    Use the “ sdkmanager — list” command to find these packages and download them using the command “ sdkmanager

    Here’s an example:

    Step 5 — Create a AVD device

    Creating a AVD device is a simple task: run the AVDManager command (this is a binary file located in the tools/bin folder of your sdk) with the create avd option, a name for the new AVD and the image you want to use.

    Here is a example:

    # avdmanager create avd — name android28 — package “system-images;android-28;default;x86”

    You will be asked if you want to alter some configurations. You can also modify these configurations later in the file config.ini, located in the avd folder (this folder usually is created in your user folder, under the android directory). The currently active configurations can be find in the file hardware-qemu.ini (this file just will be created after the emulator runs for the first time).

    Читайте также:  Автоматический перевод экрана андроид

    Step 6 — Run the Android Emulator

    Now you just need to run the emulator command (remember that we added this package to the environmental variables?):

    The emulator take some time to init for the first time. But if you done everything correctly you should see this screen:

    Источник

    Где находится android_sdk_root? И как его установить?

    Я установил android_sdk_home, чтобы мое приложение могло найти .android при попытке запустить. Теперь я получаю сообщение об ошибке, указывающее, что android_sdk_root не определен. Я запускаю win 7, новую установку Android-студии, внутри параллелей на macbook pro.

    Благодарю за ваш ответ. Я проверил местоположение, и он идентифицирован как то же место, что и путь среды ANDROID_SDK_HOME. Он все еще говорит, что root не определен. Я создал путь окружения ANDROID_SDK_ROOT к тому же местоположению, и он все еще не определен.

    Android_sdk_root – системная переменная, указывающая на корневую папку инструментов android sdk. Вероятно, вы получите ошибку, потому что переменная не установлена. Чтобы установить его в Android Studio, перейдите по ссылке:

    1. Файл -> Структура проекта в структуре проекта
    2. Слева -> местоположение SDK
    3. Местоположение SDK выберите местоположение Android SDK

    Если вы установили SDK для Android, обратитесь к этому ответу, чтобы найти путь к нему: https://stackoverflow.com/a/15702396/3625900

    Я получил ту же ошибку после установки студии Android и попытался запустить мир привет. Я думаю, вам нужно использовать SDK Manager внутри Android Studio, чтобы сначала установить некоторые вещи.

    Откройте Android Studio и нажмите на Диспетчер SDK на панели инструментов.

    Теперь установите необходимые инструменты SDK.

    • Инструменты -> Android SDK Tools
    • Инструменты -> Android SDK Platform-tools
    • Инструменты -> Android SDK Build-tools (самая высокая версия)

    Для каждого выпуска Android, на который настроен таргетинг, нажмите соответствующую папку Android XX и выберите (как минимум):

    • Платформа SDK
    • Системное изображение для эмулятора, такое как ARM EABI v7a System Image

    Менеджер SDK будет запускаться (это может занять некоторое время) и загрузить и установить различные SDK.

    Внутри Android Studio, File-> Project Structure покажет вам, где установлены ваши Android-устройства. Как вы видите, мой – это c: \ users \ Joe \ AppData \ Local \ Android \ sdk1.

    Если я перейду к C: \ Users \ Joe \ AppData \ Local \ Android \ sdk1 \ sources, вы сможете увидеть различные Android SDK, установленные там …

    Источник

    What Is the Android SDK and How to Start Using It

    Android SDK is a software development kit developed by Google for the Android platform. The Android SDK allows you to create Android apps, and you don’t need to be an expert to use it. In this tutorial, I’ll explain what the Android SDK is and how to get started with it.

    Android SDK comes bundled with Android Studio, Google’s official integrated development environment (IDE) for the Android operating system. You can learn about Android Studio and the Android App Development Kit in another of my articles.

    In this post, we’ll look at:

    • What is the Android SDK?
    • How to install the Android SDK
    • What is the Android SDK Manager?
    • What are the components of the Android SDK?

    What Is the Android SDK?

    The Android SDK is a collection of software development tools and libraries required to develop Android applications. Every time Google releases a new version of Android or an update, a corresponding SDK is also released which developers must download and install. It is worth noting that you can also download and use the Android SDK independently of Android Studio, but typically you’ll be working through Android Studio for any Android development.

    The Android SDK comprises all the tools necessary to code programs from scratch and even test them. These tools provide a smooth flow of the development process from developing and debugging, through to packaging.

    The Android SDK is compatible with Windows, macOS, and Linux, so you can develop on any of those platforms.

    How to Install the Android SDK

    The Android SDK is optimized for Android Studio, and hence to effectively reap its benefits, you will need to install Android Studio. Having the Android SDK managed from within Android Studio is easier since support for languages like Java, Kotlin, and C++ is handled automatically. Not only that, but updates to the Android SDK are handled automatically by Android Studio.

    To install the Android SDK from within Android Studio, first start Android Studio.

    • From the Android Studio start page, select Configure > SDK Manager.

    • If you already have Android Studio open, the SDK Manager icon is found on the top right corner, as shown below.

    Install the required Android SDK platform packages and developer tools. A good start is to install:

    Читайте также:  Драйвера для андроида самсунг галакси

    • Android SDK Build-Tools
    • Android Emulator
    • Android SDK Platform-Tools
    • Android SDK Tools
    • Documentation for Android SDK

    Click Apply, and Android Studio will install the selected tools and packages.

    What Is the SDK Manager?

    The Android SDK is composed of modular packages that you can download, install, and update separately using the Android SDK Manager. The SDK Manager helps to update new SDK releases and updates whenever a new Android platform is released. The SDK manager can be found in the top-right corner of the Android Studio screen, as shown below.

    All that is required to follow the instructions provided, and the updates will be immediately downloaded to your environment.

    What Are the Components of the Android SDK?

    The Android SDK consists of an emulator, development tools, sample projects with source code, and the required libraries to build Android applications. Let’s look at the key components one by one.

    Android SDK Tools

    Android SDK Tools is a component of the Android SDK. It includes a complete set of development and debugging tools for Android, and is included with Android Studio. The SDK Tools also consist of testing tools and other utilities required to develop an app.

    SDK Build Tools

    Build tools are required for building components for building the actual binaries for your Android app. Always ensure your build tools component is up to date by downloading the latest version in the Android SDK Manager.

    SDK Platform-Tools

    Android Platform-Tools are used to support the features for the current Android platform and are necessary for Android app development. These tools interface with the Android platform on the device you use for testing. They include:

    • Android Debug Bridge (adb): This is a handy command-line tool that lets you communicate with a device. The adb command allows you to perform device actions, such as installing and debugging apps. It also provides access to a Unix shell that you can use to run a variety of commands on a device.
    • fastboot: This lets you flash a device with a new system image.
    • systrace: This tool helps collect and inspect timing information across all processes running on your device at the system level. It’s crucial for debugging app performance.

    SDK Platform-Tools are backward compatible, so you need only one version of the SDK Platform-Tools.

    SDK Platform

    For each version of Android, there’s one SDK Platform available. These are numbered according to the Android version (e.g. Android 7 Nougat) and an API version (e.g. API Level 24). Before you build an Android app, you must specify an SDK Platform as your build target. Newer SDK Platform versions have more features for developers, but older devices may not be compatible with the newer platform versions.

    Google APIs

    Google provides a number of exclusive Google APIs to make developing your app easier. They also offer a system image for the emulator so you can test your app using the Google APIs.

    Android Emulator

    The Android Emulator is a QEMU-based device-emulation tool that simulates Android devices on your computer, allowing developers to test applications on different devices and Android API levels, without needing to have physical devices for each. The emulator comes with configurations for various Android phones, tablets, Wear OS, and Android TV devices.

    The Android emulator provides almost all of the capabilities of a real Android device. You can perform the following activities:

    • simulate phone calls and text messages
    • simulate different network speeds
    • specify the location of the device
    • simulate hardware sensors such as rotation
    • access Google Play Store and much more

    Often it is faster and easier to test your app with an emulator instead of using a physical device.

    Conclusion

    In this post, we looked at some of the basics of the Android SDK. The Android SDK is the only way to develop for Android devices. Fortunately, it contains extensive documentation, tutorials, samples, best practice guidance, and an array of tools for many different development tasks.

    Premium Android App Templates From CodeCanyon

    Android Studio comes with some default templates to help start an app, but these are very basic and provide minimal, generic functionality.

    CodeCanyon is an online marketplace that has hundreds of additional templates, which are way more feature-rich and domain-specific too. You can save days, even months, of effort by using one of them.

    An Android app template is a great way to jump-start your app project or to learn some new skills by exploring the source code of a professionally made app.

    Take a look at some of our roundups of the best Android app templates:

    Источник

    Оцените статью