- Rebel code
- инструкции, руководства, документация
- Установка Android SDK, Java JDK, Android Studio в Ubuntu
- Инструкции по теме:
- 4 thoughts on “ Установка Android SDK, Java JDK, Android Studio в Ubuntu ”
- Добавить комментарий Отменить ответ
- Ubuntu Documentation
- Preparation and Installation
- Downloading the SDK Starter Package
- Setting up Java
- Downloading the SDK platform tools
- Post-Installation Configuration
- Modifying the PATH Environment Variable
- Preparing Hardware
- How to Install Android SDK Manager on Ubuntu 18.04
- Install Android SDK Tools Package
- Android SDK Manager usage from terminal
- List installed, available packages and updates
- Install, update and uninstall packages using sdkmanager
- Read also :
Rebel code
инструкции, руководства, документация
Установка Android SDK, Java JDK, Android Studio в Ubuntu
Установка Java JDK
В центре приложений Ubuntu предлагается воспользоваться OpenJDK Java 7 Runtime (JRE), это не подойдёт для работы Android Studio (для Eclipse кстати тоже), нам нужно именно Java JDK, тот самый от компании Oracle.
Возможная ошибка в случае несоответствия пакета Java:
«tool.jar is not in Android Studio classpath. Please ensure JAVA_HOME points to JDK rather than JRE»
Устанавливаем Oracle Java JDK, для этого нужно добавить новый репозиторий в систему:
Теперь выбираем нужную версию (если нет конкретных предпочтений, то можно утсановить самую свежую, например Java JDK 8).
Oracle JDK 6
Oracle JDK 7
Oracle JDK 8 (для примера используем эту версию)
Соглашаемся на установку дополнительных пакетов и проверяем установку:
В результате должно получится нечто подобное:
java version «1.8.0_20»
Java(TM) SE Runtime Environment (build 1.8.0_20-b26)
Java HotSpot(TM) 64-Bit Server VM (build 25.20-b23, mixed mode)
Так же можно проверить версию компилятора:
Если нужно использовать в системе определённую версию Java JDK, то ниже описано как это настроить Дополнительные опции установки Java JDK.
Есть хорошая подборка по установке Java в Ubuntu на английском языке How To Install Java on Ubuntu with Apt-Get
Установка Android SDK
Установка достаточно простая, для начала нужно скачать пакет для Linux с официального сайта Get the Android SDK
Нам нужен пакет Linux 32 & 64-bit в разделе SDK Tools Only.
После скачивания распаковываем содержимое в папку /opt. Должно получится /opt/android-sdk-linux
Открыть SDK Manager очень просто, нужно запустить файл /opt/android-sdk-linux/tools/android через консоль или nautilus. В открывшемся окне устанавливаем нужную версию Android API и желательно установить все сервисы Google Play*.
Установка Android Studio
Скачиваем пакет для Linux с официального сайта Getting Started with Android Studio
После скачивания распаковываем содержимое в папку /opt. Должно получится /opt/android-studio
Теперь нужно запустить файл /opt/android-studio/bin/studio.sh через консоль или nautilus. Удобнее всего создать иконку запуска (ярлык) Android Studio на рабочем столе, например так:
с таким содержимым (пути указать в соответсвии со своей установкой):
[Desktop Entry]
Encoding=UTF-8
Terminal=0
Exec=/opt/android-studio/bin/studio.sh
Icon=/opt/android-studio/bin/idea.png
Type=Application
Categories=Development;
StartupNotify=true
Name=AndroidStudio
GenericName=AndroidStudio
файл должен быть исполняемый:
После запуска откроется окно выбора проекта, создание нового или клонирование удалённого репозитория. Последний пункт очень распространённый и нужно помнить — чтобы клонировать удалённый git-репозиторий, для начала следует установить Git:
Дополнительные опции установки Java JDK
Просмотр текущих альтернатив Java:
Ручное указание JAVA_HOME:
Редактируем /etc/environment и добавляем нужный путь JAVA_HOME=/usr/lib/jvm/java-8-oracle
Выбор пакета Java по-умолчанию:
После выполнения на экране отобразится примерно такое:
Инструкции по теме:
4 thoughts on “ Установка Android SDK, Java JDK, Android Studio в Ubuntu ”
есть такая замечательная штука, как java-package (в ubuntu тоже есть) — позволяет паковать православный java от oracle в deb пакет, в итоге получаешь самый свежий jdk из всех возможных
на выходе получаешь:
а смысл щас в 8 версии?если у гугла своя машина которая поддерживает 6 версию языка.Насчет новой вм гугла хз,но это факт только версии андройда 5+
Не могу установить. Она просто не распаковывается м не копируется содержимое ахива в /opt. При запуски .sh долго думает и ничего не происходит((.
А у вас есть права для доступа к папке /opt?
Добавить комментарий Отменить ответ
Для отправки комментария вам необходимо авторизоваться.
Источник
Ubuntu Documentation
This is a general overview of what the Android SDK is, what it does, and how it can benefit you. This guide also contains instructions on how to set up the Android SDK on Ubuntu 10.04 onwards.
The Android Software Development Kit (AKA SDK) is a software suite for the Android mobile operating system that allows you to write applications for Android in the Java programming language. Most people who use the Android SDK either develop applications for the Android operating system OR they use it for other purposes, such as obtaining elevated privileges on an Android device with the help of third-party software or use it for diagnostic purposes in case of malfunctioning.
The vast majority of Android users probably won’t have to make use of the Android SDK, however, it is useful if you wish to learn more about the Android operating system and even then it’s still a handy tool to have in case something goes wrong.
This tutorial covers Ubuntu 10.04 Lucid Lynx onwards. For anything prior to Lucid, you will have to find it yourself.
Preparation and Installation
Before we set up the SDK, we have some preparation to do. Due to some major changes in the Android SDK made in the last couple of months, setting up the Android SDK is not as easy as it was two years ago, when Android was starting to take off. Setting up the SDK itself is relatively easy once the preparation has been done.
Downloading the SDK Starter Package
First things first, we have to obtain the starter package. The SDK starter package can be obtained at http://developer.android.com/sdk/index.html.
Download the one for Linux (.tgz file) and once it’s finished downloading, extract it to somewhere safe and easy to reach. For example, the home folder. To do so, open up a terminal, navigate to the directory where the SDK was downloaded and enter the following command:
$ tar -xvzf android-sdk_rXX-linux.tgz && mv android-sdk-linux
As of 12 May 2012, the Android SDK is currently up to r18, however that is set to change in the near future, and as such, replace XX with the version of your SDK.
Setting up Java
Prior to SDK r08, everything you’ll need to develop applications was included on a 100-200MB .tgz archive. However, with the release of SDK r08, the tools necessary for creating and building applications was removed and can be obtained by using the Android SDK and AVD Manager which is located in the / /tools folder.
However, you should not execute the Android SDK and AVD manager just yet, as you’ll most likely get a Parse: XML error notice. The reason for this is that after SDK r08, it’s now required to have Java installed before you set up the SDK. To do this, we’ll download the OpenJDK and the Icedtea browser plugin. In a terminal window, enter the following command:
$ sudo apt-get install openjdk-6-jre openjdk-6-jdk icedtea6-plugin
This will download and install the OpenJDK implementation of Java, which will be sufficient enough for us to download the SDK platform tools.
Downloading the SDK platform tools
This is pretty much the actual «installation» of the SDK’s platform tools. One key reason why this step is important is that it contains an important protocol called the Android Debug Bridge (ADB).
ADB comes bundled with the SDK platform tools. It is a command-line tool used to communicate with and control the device over a USB link from a computer. The tool comes bundled with the Android SDK and is commonly used for diagnosing problems with the device. Once you have ADB installed, you can use ADB to copy files to and from the device’s internal memory, install apps, run commands, see logs and more. This makes it an invaluable tool if your device is running into some trouble that might warrant a new device.
Now, in order to obtain the SDK platform tools, we’ll need to initialize the Android SDK and AVD Manager that I mentioned earlier. To do so, enter the following commands in a terminal. The first command will direct you to where the Android SDK and AVD Manager is located, and the second will execute said program.
/android-sdk-linux/tools
Once you do that, a new window will pop up, which is the actual Android SDK and AVD Manager. Click on «Available Packages» and you will be presented with two boxes. One is the Android Repository and the other is the Third-party Add-ons. Click on «Android Repository» then click on Install Selected. A confirmation window will pop up. Click on «Accept All» and then click on the Install button to install the SDK platform tools. It’s quite a bit to download so make sure you have at least 512MB to 2GB of hard drive space available. Once the download has finished, you’ll get a notice saying that the ADB daemon needs to be restarted. Click on «Yes» and everything will finish downloading.
Post-Installation Configuration
Now once the download has finished, or while you’re waiting for the download to finish, we have to configure Ubuntu a little to meet our needs. First, we have to set up the PATH variable to include ADB and other SDK tools, and we have to make sure our hardware will be detected once we initialize ADB.
Modifying the PATH Environment Variable
In the days before Android 2.2, a good number of people used to place their various projects and applications in the directories where the necessary tools they used existed. This was in itself a very flawed method because it cluttered up the directories, and while cleaning up the SDK, one might accidentally delete a crucial file, which will cause the SDK to fail and having to completely reinstall everything.
Modifying the PATH Environment Variable will help out immensely when it comes down to making use of SDK tools like ADB. Doing this will also allow you to execute certain protocols like ADB from ANY location. So if you’re operating from the Desktop, you don’t have to redirect to the SDK’s platform-tools folder to make use of ADB if you need to make use of it.
Enough chatter, let’s get busy. To modify the PATH variable of your system, you need to edit your .bashrc file. To do so, in a terminal, execute the following command:
You will now have the Nano text editor enabled on the terminal. Now, at the very top of the file, enter the following:
/android-sdk-linux/tools
/android-sdk-linux/platform-tools
Once you’re finished, press CTRL + X, Y, and then hit Enter to save your changes and exit the Nano text editor.
Preparing Hardware
Now that we have our PATH variable set up, we need to make sure our hardware will be detected once we initialize ADB. However, up until Natty, udev in Ubuntu wouldn’t allow ADB access to the Android phone via USB. This was fixed in udev version 165-0ubuntu1 — if you are running an earlier version ( apt-cache policy udev will tell you whether you are), you’ll need need to create a new udev rule file as root.
In a terminal, execute the following command that will create the rule file. This will utilize the graphical sudo command, so that we can still have control over the file if we’re not a root user.
$ gksudo gedit /etc/udev/rules.d/51-android.rules
Copy and paste the following udev rules in the text editor that opened up which contains the new rule file we created. The rules included should work with most if not all Android devices across multiple manufacturers, such as HTC, Motorola, LGE, and so forth.
SUBSYSTEM==»usb», ATTRS SUBSYSTEM==»usb», ATTRS SUBSYSTEM==»usb», ATTRS SUBSYSTEM==»usb», ATTRS SUBSYSTEM==»usb», ATTRS SUBSYSTEM==»usb», ATTRS SUBSYSTEM==»usb», ATTRS SUBSYSTEM==»usb», ATTRS SUBSYSTEM==»usb», ATTRS SUBSYSTEM==»usb», ATTRS Once you’ve copied and pasted the udev rules in the text editor which contains your newly created rule file, save your changes and quit. Now that you’ve set your udev rules you have to reboot so that ADB will be in your path. To test your changes, open up a terminal and execute the following: $ adb devices Note: You may need to enable USB debugging mode on your phone first in order for it to be recognised. This will give you two messages: 1) It will tell you it’s initializing the ADB daemon. 2) It should show you a list of connected devices. If all went well you should see your device’s serial number under the list of connected devices. If you see a message like: List of connected devices . No permissions This means your hardware was detected, however you made a mistake in configuring Ubuntu or the udev rule for your phone’s manufacturer was not listed. AndroidSDK (последним исправлял пользователь uusijani 2012-07-28 15:47:15) The material on this wiki is available under a free license, see Copyright / License for details Источник The sdkmanager is a CLI tool that allows users to view, install, update, and uninstall available packages for the Android SDK. This tutorial is going to teach you how to install Android SDK Manager on Ubuntu 18.04 using terminal. Earlier we have seen how to Install Android SDK Manager on Ubuntu 16.04. If you’re already using Android Studio, you don’t need to use sdkmanager as you can manage your SDK packages from the IDE instead. The sdkmanager tool is provided in the Android SDK Tools package, so we are going to install the latter to be able to use sdkmanager. Before installing the preferred tool, we need to update all packages and install JAVA, as the Android SDK requires it to run. To do so you can run the following commands in the order mentioned below: Once JAVA is installed on the machine we can run the following command to check the java version and to be sure it has been installed correctly: The output must look like this After successful JAVA installation, we can proceed to the installation of Android SDK. We need to download the binaries from Android Developers Website. If you open the link above in the browser you can find available zip files under the «Command Line Tools only» part. To download binaries from terminal run the command below: Once it’s installed unzip with the following command A new directory will be created named tools. To complete the installation we need to add the following paths to our PATH environment variable. To do so, you can run the command below: If you’ve downloaded or unzipped the SDK-tools package into other directory, please don’t forget to use appropriate paths. To add the directories permanently, just add the line above to the Once Android SDK has been installed we can use sdkmanager tool to view, install, update and uninstall packages for the Android SDK from terminal. To list all installed, available packages and ones that have update we can run: The output will look like the one below: You can have issues when running this command. E.g. the output of the command can be an error like the one below: To resolve this issue edit the sdkamanger script which is located in bin folder of the installation folder (in our case the full path to the file was /home/ubuntu/tools/bin/sdkamanager ) and add the following line in the 31st line: After the editing, that line must look like below: Once you’ve edited the file and saved you can run the sdkmanager —list command again. Only installed packages will be shown and another error message will appear which will be like the one below: Actually there are two separate errors in the message above. One is related to secure connection due to which it cannot view available packages and check the packages for updates. The second one says that sdkmanager cannot load /home/ubuntu/.android/repositories.cfg file. To fix the errors we create the repositories.cfg file (as it hasn’t been created by default) and run the sdkmanager —list command with —no_https flag. Run the following commands in the order below: After running these commands you will be able to see the output shown above in this article. To install package, run the following command: If you want to uninstall several packages you can add them to a file and use —package_file flag. For example Note that package_name must be from available packages list and if you don’t use no_https flag it will throw the same error when we ran the sdkmanager —list command. To update all packages, you can run: Note that if you update SDK tools you need to edit /home/ubuntu/tools/bin/sdkamanager file again and add -XX:+IgnoreUnrecognizedVMOptions —add-modules java.se.ee in the 31st line, as the mentioned above file will be fetched from the server and will become the default one. To uninstall package, run the command below: The installation of Android SDK Manager itself is very simple, but during the process you may face different issues which are related to JAVA. However, there are workarounds described for types of issues you can face. So using this tutorial you can be sure that you’ll make it work. Источник
You can contribute to this wiki, see Wiki Guide for detailsHow to Install Android SDK Manager on Ubuntu 18.04
Install Android SDK Tools Package
Android SDK Manager usage from terminal
List installed, available packages and updates
Install, update and uninstall packages using sdkmanager
Read also :