Where is the sdk installed? Installing Android Studio, setting up SDK

Android Programming, Part One: Getting to Know the SDK

Installing the SDK, getting to know the SDK, SDK tools.

In this part, we'll go through the nitty-gritty of the Android Software Development Kit (SDK), see how it works, what tools it includes, and how to work with these tools. We won’t go into too much detail; we’ll just play around with individual programs to understand how everything works.

Preparing and installing the SDK

So let's get started. First of all, you need to install java sdk, only java runtime for full operation Android SDK not enough.

Let me remind you that everywhere I talk only about Linux. First, create a directory ~/android on your computer, where we will have everything we need for work. I do this on purpose so that all the tools are in one place and in all subsequent articles it is assumed that the SDK is installed exactly as will be described now.

% mkdir ~/android % cd ~/android

Next, download the SDK archive into this directory (take the link from the official website) and unpack it (the downloaded file is usually called something like adt-bundle-linux-x86-20130219.zip, it is quite large):

% unzip adt-bundle-linux-x86-20130219.zip

This archive contains the basic part of the SDK, it has been unpacked into a directory with a name like adt-bundle-linux-x86-20130219, you can go there and see what’s there, you don’t need to run anything yet. And there is the SDK itself and a pre-configured Eclipse development environment with all the necessary plugins. Do not rename or move any files or directories inside the SDK directory, as this may break Eclipse. You can read more about the files in the SDK on the website.

Let's start with Eclipse ADT, it is launched with the following command (instead of adt-bundle-linux-x86-20130219 there may be a different path, depending on the version of the downloaded SDK, then in all file names I will refer to it as adt-bundle- ):

% ~/android/adt-bundle- /eclipse/eclipse

You can create a symlink or remember this command in some other way. When you first start, you will be asked to select a directory for projects, the default option is quite suitable, you don’t have to change anything. Immediately after launch, you will see a welcome screen with short information about ADT and SDK. Everything is in English, of course, get used to it.

From the ADT window we launch the SDK manager, through the menu Window. It looks something like this:

The SDK is designed on a modular basis; modules can be installed and removed as needed. Some tools from the SDK can be launched both in dialog mode with UI windows and in command line mode; the second mode is sometimes more convenient, as it allows you to configure the software environment very flexibly.

By default, the SDK manager offers to install modules for the latest versions of Android. But we don’t need this yet, so let’s uncheck all the boxes (to do this, you can click on the link Deselect all in this window), but select the module Android SDK Platform-tools and install it (to do this, click the button at the bottom right, it also says something like Install 1 package..., we agree to the license terms, well, you’ll figure it out, in short, this is not the first time to install programs; however, this module may already be installed if you have just downloaded latest version SDK). In this module Platform tools contains all sorts of important programs, we will work with them a little later.

The SDK manager is quite buggy, so urgently I advise you to reboot it after each installation of modules.

SDK architecture

The SDK contains an emulator of Android platforms; it is built on the basis of qemu and is very leisurely (to put it mildly). The emulator allows you to create virtual devices ( Android Virtual Device or AVD in SDK terminology) on which you can run and test created applications. I recommend the abbreviation AVD remember, it will come up repeatedly in the future.

SDK modules can be divided into two groups: the first includes modules with data for developing applications for a specific version of the Android platform; they are usually designated in the list as SDK Platform inside a “folder” with the name of the platform version, it also includes additional components for specific devices, for example, for Samsung tablet Galaxy Tab has a separate module Android 2.2/GALAXY Tab by Samsung Electronics.; the second group includes all other modules (code examples, for example, or modules for supporting Google services, or API documentation).

Module SDK Platform usually unpacked into ~/android/adt-bundle- directory /platforms/platform-NNN , where NNN is the platform API version number (number). For each major release of the platform, a new version of the API is released, for example, for Android 2.2 the API version number is 8, for Android 2.3.1 - 9, for Android 2.3.3 - 10, for Android 4.2.2 - 17, and so on. The module contains the files necessary to run this platform in the emulator of Android platforms. I’ll say right away that Google services for Google Maps, for example, are not installed in this module. Modules with Google API support are highlighted separately and are usually called Google APIs by Google Inc. Basically, all modules deployed in the ~/android/adt-bundle- directory /platforms are approximately the same in structure - they contain files from which the image of the AVD virtual device is created.

Working with virtual devices

To create a virtual device, you must first install a module with images for it, for example, a module with an image of a “naked” android (a module named SDK Platform any API version); or an image of some device, for example, Galaxy Tab (the module is called Android 2.2 (API 8)/GALAXY Tab by Samsung Electronics).

The virtual device manager can be launched either from the Eclipse ADT window (menu Window), or from the SDK manager window (menu ToolsManage AVDS...) This manager looks like this:

To create a new device, click New..., a dialog approximately like this opens (here the fields are already filled in, their meaning is described after the screenshot):

In field AVD Name enter the name of the device, for starters, something like test-111 from the list will do Device select the “real” device that we want to emulate (or just screen resolution) from the list Target select the image on the basis of which the device will be created. In Group Memory options indicate the parameters random access memory devices. In field Internal storage enter the size of the “built-in flash drive”, you can also set the size of the “external” flash drive. When everything is done, click OK. You can leave out the remaining fields in the dialog for now; the default values ​​will do. After a pause, a dialog with a list of features of the virtual device is shown and a new line should appear in the list, select it and click on the button Start..., further on Launch. Loading the device can take a lot of time, but in the end everything will load as it should: a new window appears on the screen with an image of the device screen, you can click on the screen with the mouse (this is analogous to poking your finger on the screen), you can poke at the “hardware” buttons on the side.

Information Virtual devices are physically created in the ~/.android/avd directory; for each device with the name NNNN, a NNN.avd directory with disk and memory images is created there, as well as an NNN.ini config. You can launch the desired image in the emulator with the following command (in the -avd argument we indicate the name of our device, in this case it is test-111): % ~/android/adt-bundle-/tools/emulator -avd test-111

The emulator command has a bunch of different useful parameters, full list can be viewed with the command:

% emulator -help

Advice I highly recommend adding ~/android/adt-bundle- directories /tools and ~/android/adt-bundle- /platform-tools to the PATH environment variable so that programs in these directories can be called from anywhere without specifying the full path. In what follows, I will assume that you have done this, so I will indicate the program names without the path to the directory where they are located.

Android Debug Bridge (ADB)

The SDK has means of connecting to an Android device, and they work exactly the same with both real and virtual hardware. In the last step, we launched the virtual device in the emulator, let's now attach to it using the SDK tools.

The first one is called Android Debug Bridge- this is a command line utility called adb, located in the ~/android/adt-bundle- directory /platform-tools and allows you to perform debugging work on the connected device.

By this point, we should have a window hanging somewhere with a running virtual device, so we’ll connect to it. First, let's see what devices are generally available to us for debugging:

% adb devices List of devices attached emulator-5554 device

So, we see a device called emulator-5554, and we will work with it. All available options adb programs can be viewed with the adb help command, it will show a long list of various options with enough detailed description each.

Let's look at the system log of our virtual device, it is done like this (you can exit it using the standard hotkey Ctrl+C):

Analysis of the system log is one of the most important debugging tools; records about any action that occurred on the device are poured into the log; detailed messages about program execution errors and debugging information are also written there. The adb logcat command displays all log entries that are stored on the device at the time of the call, and then continues to work, displaying new messages as they are generated. The logcat command has filtering options that specify what exactly we want to see. Complete and detailed description This program can be found on the Android developer's website.

Let's play around with logcat a little more, first a little about the output format. Here is a small piece of the log:

D/dalvikvm(119): GC_EXTERNAL_ALLOC freed 4667 objects / 256808 bytes in 324ms V/MediaScanner(230): pruneDeadThumbnailFiles... V/MediaScanner(230): /pruneDeadThumbnailFiles... D/MediaScanner(230): prescan time: 987ms D/MediaScanner(230): scan time: 28ms D/MediaScanner(230): postscan time: 129ms D/MediaScanner(230): total time: 1144ms D/MediaScannerService(230): done scanning volume external I/Launcher.Model( 119): not binding apps: no Launcher activity

Each entry has a priority, it is indicated by a letter at the beginning of the message, for example, D means Debug, that is, debugging; V- this is the lowest possible priority, from the word Verbose. The priority of the message is indicated by the program that generated it; there are seven possible priorities (in increasing order of importance): Verbose, Debug, Info, Warning, Error, Fatal, Silent.

Immediately after the priority, after the symbol / indicated tag message, usually the name of the service or program that generated the message. Next, the PID of the process is indicated in parentheses, and after the colon the actual text of the message that the program sent to the log.

As you may have noticed, when displaying records, the time when the event occurred is not indicated. This can easily be fixed with the output formatting options:

% adb logcat -v time

This command prints the time of this event, accurate to milliseconds, before each log entry. You will find other formatting options on the adb documentation page.

Information If adb sees several devices, you will have to indicate which one you want to use. I don’t do this in local examples, since adb is a fairly smart command and in the case of only one device it automatically connects to it, but if there are several devices, you will have to specify which one should be used using the -s option: adb -s emulator-5554 logcat . There are also two useful options: -d allows you to connect to a real connected device, -e - to a virtual one; that is, if you have two devices connected (one virtual, the other real), then with the adb -e command you can connect to the virtual one, and with the adb -d command - to the real one without entering an identifier.

09.05.2018

This article will help all beginners and owners of Android devices get acquainted with SDK. You will learn how to install android sdk. Why is this needed: firstly, for hacking, secondly, to access the system part of the firmware and its subsequent change, and thirdly, to obtain root rights.
There is a tool in the SDK ADB (Android Debug Bridge) Debugging Bridge for Android or another interface for debugging Android, with it you can:

This manifest must be in the root directory of every application. Individual actions and settings, permissions and application settings such as icon, etc. are listed here. He has a detailed understanding of everything that is needed as a developer. Here we can set many filters, such as what activity we want to list, what application, what messages to write, etc. With this tool it's easy to find what exactly went wrong. We will find out which line is the error.

We find the item environment variables and find the item Path, click edit and without deleting anything, add your path separated by a semicolon C:\adt-bundle-windows\platform-tools(see picture). Click OK.

You can also download and install. Let's go to the official library website, go to the "Download" section and click "Download Installer". Finally, we have everything loaded, now there is only update and progress. Beginners fill out the boxes, as well as in the picture, advanced ones can be filled out according to themselves.

We'll get to know the library by creating a simple game in which we won't use the extension. The second to last thing should be to successfully develop our design base. And this will be the last one for today. The project was imported by us and we see that it consists of three directories.

Now let’s check if everything is working: go to Start, launch the command line (preferably as an administrator for Windows Vista/7) and enter the adb command and get the following.

Result

If you received it, then everything works great.

ADB Commands

Here is a list of useful commands:
adb devices - View a list of devices that are already connected to the computer
adb wait-for-device - Wait for the device to connect
adb get-serialno - View device serial number
adb logcat - See what's happening inside the device
adb logcat > c:\logcat.txt - The command will save all changes to a file
filters for logcat
V - Verbose (lowest priority, default mode)
D - Debug (debugging)
I - Info (information)
W - Warning
E - Error
F - Fatal (critical error)
S - Silent (highest priority, silent mode, do not output anything)
Example adb logcat *:W - Display only system error messages
adb logcat [-b ] - Displays system buffer information
radio - View the buffer containing messages from the radio/telephony module.
events - View a buffer containing messages of related events.
main - View the main log buffer (default)
Example adb logcat -b radio
adb reboot - Reboot the device.
adb reboot recovery - Reboot the device into recovery mode.
adb reboot bootloader - Reboot into bootloader mode.
adb shell cat /proc/mtd - View information about the “partitions” of the device’s memory.
adb shell df - View information about partitions and free resources.
adb push - Copy a file to the device.
adb pull - Copy a file to your computer.
adb install [-l] [-r] [-s] - installing the application
Example adb install from:/adb/app/autostarts.apk Install the autostarts.apk file located in the /adb/app/ folder on the disk with:
filters
-l Block the application.
-r Reinstall the application, saving the data.
-s Install the application to the memory card.
adb uninstall - Uninstalling an application.
Example adb uninstall autostarts.apk

We have to lay the foundation of our game, if you see the same thing as the image, you're totally cool and everything works as it should. The Czechs are desperately slow. As far as advanced compatibility is concerned, everything will work, but not necessarily follow the trends. Brew coffee or tea because it will take a long time.

Using virtual devices

If not, download and install it first. You must enable debugging directly on your phone or tablet. In the Name field, enter what you want your virtual device to be named. You will open a window that is worth your attention. An interesting one is the "Scale" option for actual size, which allows you to adjust the size of your phone display and the softness of your laptop display. The result is that you can display an 800px portrait on a laptop screen with a 768px portrait, and part of it still occupies different stripes.



Thanks to the Android SDK, you can open any Android application on your computer. For example, you can play Froot Ninja or Talking Tom on your work system. This program will be relevant for owners of mobile devices of this popular platform, software developers, or those who are planning to purchase a smartphone on Android OS. This utility can be used to select the necessary applications for your phone, however, the process of installing them on your computer is quite complicated. Let's try to download Android SDK for free and install its new version on your computer.

If everything worked out so well, what would you have planned? Enter a project name in the Project Title and click Next. The package name must contain the name of your application package. Create the action you want to test and don't change the name. What does this mean later?

Then click "Finish" and the application will be created. Double click on it and browse through the many forms and several tabs below. Don't worry, we will explain everything in other works. You'll get about 13 lines of source code for something obscure and a bit unknown. If you have a properly connected phone, the app will download to it.

Possibilities:

  • emulation of mobile applications;
  • selecting the desired Android device to display applications;
  • installation of different versions of Android OS;
  • choice of interface design.

Principle of operation:

The program interface looks like a mobile device. The main function of the Android SDK is emulation of applications for phones with the Android platform. When using the program, many users may experience problems during installation of applications. This utility will be useful for software developers for smartphones; it allows you to see the results of your work. At the stage of installing the program, you need to select the versions of Android OS required for installation. After that, you can add the necessary applications to the program to test and view them.

If not, you'll see a window where you choose which device runs the app. We'll explain all this next time, show you how to launch another from one activity and how to use some view. If you don't know any advice, don't be afraid to ask in the comments. I don't like the translation of the source at all. Writing resources is so much English. If the username associated with your Application includes a company name or brand, you must either authorize that company to use the company name or brand in your username or change your username to remove the company name or brand. Your application meets the application requirements. You are solely responsible for all aspects of the development and use of your Application, including related documentation, user assistance, support and warranty.

  • Responsibility for use.
  • Ownership of program materials.
You agree that the form and nature of the Program Materials are subject to change without notice and that future versions of the Program Materials may be incompatible with applications developed in previous versions of the Program Materials.

Android SDK runs on Windows XP, Vista, 7 and 8.

Pros:

  • testing of all Android applications;
  • support for various Android devices;
  • the ability to download free Android SDK to your computer;
  • simple interface.

Minuses:

  • English interface;
  • There may be difficulties in working for beginners.

Android SDK is very useful for Android application developers. You can test any mobile program directly on your PC.

This Agreement begins on the date on which you indicate your acceptance of the terms and conditions of this Agreement and remains in full force and effect until terminated in accordance with the terms of this Agreement. Either party may terminate this Agreement for any reason whatsoever. However, provisions that would naturally survive termination of this Agreement shall survive. Each party represents and warrants to the other: it has all necessary rights, powers and abilities to perform and perform the obligations contemplated by this Agreement; no authorization or approval of any third party is required in connection with that party's execution, delivery or performance of this Agreement; this Agreement constitutes a legal, valid and binding obligation to be performed in accordance with its terms; and such party's obligations under this Agreement do not violate any Law or violate any other agreement to which such party is bound. You represent and warrant that you have all intellectual property rights, including all necessary patents, trademarks, trade secrets, copyrights or other proprietary rights in the Application and the Submission. If you use third party materials, you represent and warrant that you have the right to distribute the third party material in the application. You may have rights that vary from jurisdiction to jurisdiction; however, the foregoing disclaimers apply to the maximum extent permitted by applicable law. Except where prohibited, you agree that all disputes, claims and proceedings directly or indirectly arising out of or related to this Agreement will be resolved individually, without any form of class action and exclusively in governmental or federal courts located in Johnson County, Kansas. You agree to waive all defenses of lack of personal jurisdiction and forum non conveniens with respect to venue and jurisdiction in the state and federal courts in Johnson County, Kansas. Neither the course of conduct between the parties nor trade practice will modify this Agreement. If any provision in this Agreement is held invalid, the remainder of this Agreement will continue to apply. If any provision in this Agreement is determined to be unlawful, void or unenforceable, then that provision will be deemed severable from this Agreement and the remaining provisions will continue to be valid and enforceable. Any purported assignment in violation of this Agreement is void. You may not use, export, re-export, import, sell or transfer any of the Program Materials except as permitted by United States law and other applicable laws in the jurisdiction in which you obtain such Program Materials. Convention on Contracts for the International Sale of Goods. . However, special certifications and service profiles are required.

However, using the utility requires special knowledge and can be problematic for novice users.

Thanks to the Android SDK, you can open any Android application on your computer. For example, you can play on your working system in Froot Ninja or Talking Tom. This program will be relevant for owners of mobile devices of this popular platform, software developers, or those who are planning to purchase a smartphone on Android OS. This utility can be used to select the necessary applications for your phone, however, the process of installing them on your computer is quite complicated. Let's try to download Android SDK for free and install it new version on computer.

Possibilities:

  • emulation of mobile applications;
  • selecting the desired Android device to display applications;
  • installation different versions"android" OS;
  • choice of interface design.

Principle of operation:

the program interface looks like mobile device. The main function of the Android SDK is emulation of applications for phones with the Android platform. When using the program, many users may experience problems during installation of applications. This utility will be useful for software developers for smartphones; it provides an opportunity to see the results of their work. At the stage of installing the program, you need to select the versions of Android OS required for installation. After this you can add to the program required applications to test and review them.

Android SDK runs on Windows XP, Vista, 7 and 8.

Pros:

  • testing of all Android applications;
  • support for various Android devices;
  • the ability to download free Android SDK to your computer;
  • simple interface.

Minuses:

  • English interface;
  • There may be difficulties in working for beginners.

Android SDK is very useful for Android application developers. You can test any mobile program directly on your PC.

However, using the utility requires special knowledge and can be problematic for novice users.

Android SDK allows you to hack the software of Android devices, obtain Root rights, access system files and change them. That is, everything you can imagine when working with any smartphone or tablet based on operating system Android.

SDK, short for Software Development Kit, is a complete set of all development tools that allows you to create applications for a specific software package, as well as core development software, hardware platform, game consoles, computer system, various operating systems and platforms. In our case, this is an SDK for a mobile operating system Android systems.

ADB (Android Debug Bridge, an element of the Android SDK) also allows you to view which compatible Android devices are currently connected and capable of working with ADB, view the system log file of the Android operating system, copy files from and to the Android device, install or uninstall applications on a mobile gadget, clear the data section or overwrite it, execute scripts to control an Android device and much more.

So, let's start installing the Android SDK. To do this, go to the website //developer.android.com, where we open the tab, respectively, SDK, and select the SDK version for the operating system of your computer. It is preferable to download the SDK in a zip archive. Download and unzip this archive to the root of drive C:

After this, you need to download the JRE from //oracle.com. To do this, select the Downloads tab on the specified site at the top, then JAVA for Developers, and then JRE. Download and install software JRE.

Next, we launch the SDK Manager program in the SDK folder, in which we select the packages we need for further work. We recommend choosing those shown in the images below. After confirmation, the manager will independently download and install the necessary components, we wait for the process to complete.

Go to the folder C:AndroidSDKWindowsplatform-tools, copy the path to this folder, since the files we need should be located here, including adb.exe.

After this, if you have Windows XP, you need to open the Control Panel, in System Properties - Advanced and select “Environment Variables” at the bottom. If Windows Vista/7 is installed, then in the control panel open “System”, then “Advanced system settings”.

In “Environment Variables” we find the Path item, click “Edit” and without deleting anything, add the path that we copied above using a semicolon (“;”):

C:Android-SDK-Windowsplatform-tools

Confirm the changes by clicking “Ok”. We check the changes made. To do this we go to command line by pressing a key combination Win+R. Enter the command adb and we get the following on the screen if we did everything correctly:

Now let's look at a list of fairly useful and frequently used commands.

adb devices– displays information about which devices are currently connected.

adb wait-for-device– gives the command to wait for the device to connect.

adb get-serialno– displays serial number devices to the screen.

adb logcat– viewing the functions performed by the device.

adb logcat > c:log.txt– saves the executed functions to the specified file.

logcat supports the following filters:

V - Verbose (lowest possible priority, this mode enabled by default)

D - Debug (debugging or debugging)

I - Info (information output)

W - Warning

E - Error (error output)

F - Fatal (displays critical errors)

S - Silent (highest available priority, complete silent mode, that is, nothing is output)

For example: adb logcat *:E- only information about errors in the operating system is displayed.

adb logcat [-b ]- displays information regarding system buffers.

radio- displays information from a buffer that contains information about messages from the module responsible for radio/telephony.

events- displays information from a buffer that contains information about messages of related events.

main- displays information from the main buffer.

adb reboot– reboots the device.

adb reboot recovery– reboots the device in recovery mode.

adb reboot bootloader– reboots in bootloader mode.

adb shell cat /proc/mtd– displays information about the “partitions” of the device’s memory.

adb shell df– displays information about partitions and currently free device resources.

adb push– copies the file to the device.

adb pull– copies a file from the device to a personal computer.

adb install [-l] [-r] [-s]– installs the specified application.

For example: adb install from:/adb/app/prog.apk– the file will be installed prog.apk which is in the folder /adb/app/ on disk C:

Available filters:

L – application blocking.

R – reinstall the application, saving the data.

S – installation of the application on the memory card.

adb uninstall– deletes the application.

For example: adb uninstallprog.apk

Last update: 11/14/2017

Everything we do on Android using Java depends on the Android SDK - if we create an application for a specific version, for example, for Android Nougat, then we must have the appropriate SDK tools installed. This must be taken into account during development.

Let's open Android Studio. By default, if we run the program for the first time, then some initial menu opens to us. At the very bottom of the program’s start screen, find the “Configure” button and click on it:

For a more detailed view of all components for each platform, click on the Show Package Details link at the bottom of the window.

Here we can see in detail which packages are installed for each platform. All components are grouped by a specific SDK version, for example, Android API 27, Android 8.0 (Oreo), Android 7.1.1 (Nougat) and so on. Each SDK version actually represents a specific version or subversion of the Android OS. But each version of the SDK includes a wide range of components, including tools for development for TVs, smart watches, etc. Not all of these tools may be needed, so there is no point in installing all versions of the SDK completely.

In this case, we will be primarily interested in the item Android SDK Platform. Android SDK Platform contains all the main functionality that is used during development. This item can be selected for all those platforms for which we are going to compile the application. In particular, I recommend choosing the latest platforms - Android 8.0/7.1, as well as those that will be used as minimal platforms, for example, Android 5.0 / 5.1.

In addition to the SDK Platform, each platform, as a rule, contains a number of components that are intended for testing the application on an emulator:

    Android TV Intel x86 Atom System Image

    Android Wear Intel x86 Atom System Image

For earlier platforms, the list of components may vary.

If you do not plan to use an emulator, then these components are not so important. And vice versa, if testing will take place on an emulator, then you should install a system image for this Google APIs Intel x86 Atom System Image or Google Play Intel x86 Atom System Image.

Here, the most important packages for us are:

    Android Support Repository

    Android Support Library

    Google Play Services

    Google Repository

    Google USB Driver

These packages install android repositories and services google play. In addition, if you want to use a Google smartphone - Nexus 5/5X and 6/6P or Google Pixel - to test applications, then you must install the Google Usb Driver package, which provides a driver for working with these smartphones. If you intend to use a smartphone from another manufacturer, then in this case you will need to install a USB driver directly from this manufacturer. As a rule, when you connect a smartphone, the system itself tries to install the driver.

If you plan to use an emulator, you should also install the package Intel x86 Emulator Accelerator (HAXM installer).

And if during the development or testing process problems arise with some versions of the Android OS, then it is likely that the root of the problem lies in the lack of the necessary components for certain platforms. In this case, you can launch the SDK Manager from Android Studio and manually install the missing components.

Subsequently, every time launching Android Studio will display pop-up notifications about the availability of updates by platform, which is quite convenient and will allow projects to keep up with latest updates from Google.

If we later need to call the SDK Manager, we can do this from Android Sudio itself through the toolbar.

Publications on the topic