Eclipse with android developer

Установка Eclipse и подключение плагина Android Development Tools (ADT) для разработки андроид-приложений

Инструменты разработки Eclipse и Android Development Tools

После выхода официального релиза Android Studio у начинающих разработчиков появились проблемы с загрузкой и установкой все еще популярной среды разработки Eclipse и плагина Android Development Tools (ADT) для разработки андроид-приложений. Ниже приводим перевод инструкции с официального сайта, в которой вы узнаете, как скачать и установить Eclipse, а также как подключить и настроить плагин Android Development Tools (ADT), чтобы начать программировать под андроид.

Внимание! Плагин Eclipse ADT больше не поддерживается, согласно этому объявлению в июне 2015 года .

Плагин Eclipse ADT имеет много известных и потенциальных ошибок безопасности, которые не будут исправлены.

Вы должны немедленно переключиться на использование Android Studio , официальной IDE для Android. Для получения справки по переносу ваших проектов прочитайте Миграция в Android Studio .

Как скачать и установить Android Studio, смотрите здесь

Порядок установки

Вы должны сначала загрузить Eclipse, затем скачать Android SDK и установить плагин ADT (Android Development Tools).

Если Eclipse уже установлен, перед установкой ADT проверьте соответствие следующим требованиям:

Установлен Eclipse 3.7.2 (Indigo) или выше
Примечание: Eclipse 3,6 (Helios) больше не поддерживает последние версии ADT.
Установлен Eclipse JDT плагин (входит в большинство пакетов Eclipse IDE)
Установлена JDK 6 (пакет JRE не является достаточным)

Если все условия выполняются, можно пропустить несколько пунктов и перейти к загрузке и установке ADT плагина для Eclipse.

Если вы начинаете с нуля, то выполните все последующие шаги.

Установить JVM

Независимо от вашей операционной системы, вам нужно будет установить виртуальную машину Java (JVM). Вы собираетесь использовать Eclipse для разработки Java android, поэтому установите JDK (JDK включает в себя — среди других полезных вещей — исходный код для стандартных Java библиотек).

Если вы используете Windows, вы, возможно, уже устанавливали JRE, но этого не достаточно.

Установить JDK (Java Development Kit)

Если у вас не установлен пакет JDK, следуйте инструкции: Установка JDK (Java Development Kit)

Скачать Eclipse

Загрузка будет в виде сжатого (т.е. «.zip», или «.tar.gz») файла. Распакуйте этот файл в директорию по вашему выбору (например, «C:\eclipse» на Windows) и убедитесь, что у вас есть полный доступ на чтение и выполнение. При желании вы можете создать ярлык исполняемого файла («eclipse.exe» на Windows, или «Eclipse» на Linux).

Обратите внимание, что есть известная проблема с распаковкой архива во всех текущих версиях Windows . Мы рекомендуем использовать более надежный архиватор, такие как, например, архиватор с открытым исходным кодом 7zip, при распаковке пакета Eclipse. Некоторые пользователи сообщают об успехах при первоначальной распаковке Eclipse в корневом каталоге (например, C: \), а затем перемещении его на более подходящее место (например, C: \ Program Files \ Eclipse)

Для разработки приложений Android в Eclipse предлагается пользовательский плагин для Eclipse IDE, называемый Android Development Tools (ADT). Этот плагин представляет собой мощную, интегрированную среду разработки приложений для Android. Это расширяет возможности Eclipse, что позволит вам быстро создать новые Android проекты, построить интерфейс приложения, отлаживать свое приложение, а также подписывать и экспортировать пакеты приложения (APK) для распространения.

Загрузить ADT плагин для Eclipse:

Запустите Eclipse, затем выберите в главном меню Help > Install New Software.

Нажмите Add , в верхнем правом углу.


В хранилище диалоге Добавить окне введите «ADT Plugin» в поле Name и следующий адрес в поле Location:

Примечание: для обновления Android Developer Tools требуется безопасное соединение. Убедитесь, что URL обновления, который вы вводите начинается с HTTPS.
Нажмите OK .
В диалоге Software, установите флажок рядом с Developer Tools и нажмите Next .
В следующем окне вы увидите список инструментов для загрузки. Нажмите Next.
Прочитайте и примите условия лицензионного соглашения, а затем нажмите Finish.
Если вы получаете предупреждение системы безопасности, что подлинность и достоверность программного обеспечения не может быть установлена, нажмите ОК .
После завершения установки, перезагрузите Eclipse.

Если вы не смогли использовать Eclipse, чтобы скачать плагин ADT с удаленного сайта обновлений, вы можете скачать ADT архив на свой компьютер и вручную установить его:

Скачать сжатый файл ADT Plugin (не распаковывать его!):

Запустите Eclipse, затем выберите Help > Install New Software .
Нажмите Добавить , в верхнем правом углу.
В диалоговом окне репозитория добавить, нажмите кнопку Архив .
Выберите загруженный ADT-23.0.6.zip файл и нажмите OK .
Введите «ADT Plugin» в качестве имени и нажмите ОК .
В диалоге Software, установите флажок рядом с Developer Tools и нажмите Next .
В следующем окне вы увидите список инструментов для загрузки. Нажмите Next.
Прочитайте и примите условия лицензионного соглашения, а затем нажмите Finish.
Если вы получаете предупреждение системы безопасности, что подлинность и достоверность программного обеспечения не может быть установлена, нажмите ОК .
После завершения установки, перезагрузите Eclipse.

Скачать пакет SDK

Скачайте пакет инструментов Android SDK по этой ссылке.

Cкачайте пакет Android SDK для вашей операционной системы

Читайте также:  При прошивки андроид нужен

В открывшейся по ссылке таблице выберите пакет для вашей операционной системы. Для Windows их два: установщик и архив (на выбор). Архив следует распаковать в папку, например, D:\android\sdk. Если выберете установщик, он по умолчанию укажет путь, например, C:\Users\ \AppData\Local\Android\android-sdk, лучше изменить его на более короткий, как в примере выше.

Внимание! В пути к SDK не должно быть кириллицы! Это может быть источником многих проблем в будущем.

Настроить Android SDK

После того, как Eclipse, перезагрузится, необходимо указать расположение каталога Android SDK:

В окне приветствия выберите Использовать существующие пакеты SDK (Use existing SDKs).
Нажмите Обзор (Browse) и выберите расположение каталога SDK (там, куда вы указали путь при загрузке SDK).
Нажмите Next .
Ваше Eclipse IDE теперь настроена для разработки приложений для Android, но вы должны добавить новые средства SDK платформы и андроид платформу для вашей среды. Чтобы получить эти пакеты , запустите менеджер SDK, и выберите для загрузки необходимые платформы и пакеты.

В Eclipse в меню открывайте Window > Android SDK Manager.

Android SDK Manager

Здесь нам показывают SDK-компоненты, которые мы можем скачать, обновить или удалить.

Сначала идет папка Tools — в ней находятся утилиты, необходимые для разработки под Android. Далее идет список версий Android. И в самом низу еще есть папка Extras, в которой обычно находятся дополнительные библиотеки.

Справа от каждого компонента в списке виден его статус: Installed — установлен, Not installed — не установлен, Update available — доступно обновление. Мне сразу автоматически предлагают обновить и установить некоторые компоненты, на них включены чекбоксы. Нажмите снизу ссылку Deselect All, чтобы снять все галки, а затем Updates, чтобы выделить только те пункты, которые требуют обновления. И пока оставим все так, ничего не загружаем.

Нас сейчас интересуют папки с именами версий Android. Для начала установите Android 4.4.2. Когда освоитесь в разработке, вы всегда сможете вернуться сюда и скачать те версии Android, которые вам необходимы. А пока будем работать с проверенной Android 4.4.2 (API 19).

Как минимум для разработки нам необходимы два компонента в папке Android 4.4.2 (API 19):

1) SDK Platform — используется для разработки. Говоря простыми словами, здесь содержатся все программные компоненты системы Android, которые мы будем использовать при создании приложений — т.е. окна, кнопки и т.п.

2) ARM EABI v7a System Image — образ Android системы. Используется для создания эмулятора Android, который нужен будет для тестирования приложений прямо на компе, без подключения реальных устройств.

Т.е. мы сможем создать приложение, использующее компоненты и возможности Android версии 4.4.2 и запустить это приложение на эмуляторе версии 4.4.2. Этого вполне достаточно для начала. Ставьте галки на двух этих пунктах в папке Android 4.4.2 (API 19).

Если вам понадобятся другие версии Android, заходите в SDK Manager и устанавливайте эту пару компонентов для нужной вам версии.

Снизу справа жмем кнопку Install packages, чтобы он установил все компоненты которые мы выделили. Учтите, что плафтормы могут весить несколько сотен мегабайт.

Появится окно со списком установки, отмечаем в нем Accept license и жмем Install. Процесс пошел, снизу замелькали проценты, килобайты и секунды. По завершению процесса снизу будет надпись Done loading package. Все готово для работы. Закрываем и начинаем обучение разработке android приложений.

Источник

Android SDK: Working with Eclipse

In this series you’ll learn about Android development from the beginning. In the first section we setup the Android SDK and Eclipse. In this part we will acquaint ourselves with the Eclipse software. Eclipse is an IDE (Integrated Development Environment) for Java. Together with the ADT (Android Developer Tools) plugin, Eclipse provides an environment in which you can build, code, design, and run Android apps. We will learn more about Eclipse throughout the series, but in this tutorial we will explore the basic features of the Eclipse user interface so that you know your way around before we start developing.

At the time of writing this tutorial, Eclipse is the officially supported IDE for Android, but be aware that this is set to change with the new Android Studio program. We will look at Android Studio in the next tutorial, but it’s only available as an early access preview at the moment, so you should initially focus on Eclipse for your Android development projects.

1. Create an Android Project

Step 1

To begin, simply open Eclipse. To get started in the Eclipse environment, let’s go ahead and create an Android project we will later build on. Don’t worry too much about the details at this stage, we will explore each element of Android projects as the series progresses. For the moment we just need to create a basic project so that we can use it to become familiar with the Eclipse interface. Also, keep in mind that there is a lot more to Eclipse than what we will cover here. In this tutorial we will focus on what you need to know to get going in Android.

Eclipse models each app you create as a project, with the coding and other resources related to the app stored and managed from within a directory for the project in your workspace. Creating a new Android project involves a few steps, which we will gloss over at this stage just to get a project setup to show how the Eclipse workspace will look while you are working on an Android app. Click the «New» button.

Читайте также:  Как ускорить оперативную память андроида

In the wizard, expand the «Android» folder and select «Android Application Project». This is the process you will use whenever you create a new project for an Android app. Click «Next».

Step 2

In the «New Android Application» screen, you will see various fields you can set. When you click on the text-fields, Eclipse will display some informative text near the bottom of the window. Enter «MyFirstApp» as the Application Name. This will automatically be populated in the Project Name field and a package name will also automatically populate. You can alter these but for the moment leave them with their default contents.

You can also leave the SDK options as they stand — these allow you to target particular API levels and to specify the minimum level you wish to support. As you progress with your Android development skills, you will see that the types of functionality you include will sometimes have implications in terms of which platform levels your app will support. Of course you want to aim to support as wide a range of devices as possible but this can sometimes be tricky. To continue, click «Next».

The next screen you will see lets you configure the project. By default Eclipse selects certain settings. Check the options to create a launcher icon for your app, create an Activity for it (this is a user interface screen), and to create the project in your workspace. Click «Next».

Step 3

Next you will see the Launcher Icon screen. In general you will likely use this to specify a launcher icon image file and to set display properties, but for now just leave it as is and click «Next».

In the next screen get Eclipse to generate an Activity for you. This is likely what you will do for a majority of the apps you create at first. The Activity generated is a single user interface screen, which most apps need at the very least. Leave the «Create Activity» box checked, with «Blank Activity» selected and click «Next».

Step 4

We’re almost there! In the last screen you will see an overview of the project Activity details before it is created. You can alter the Activity and layout names, but leave them as they are for this tutorial. Click «Finish» to create your project.

Eclipse will create your project, opening the Activity file. Don’t worry too much about the contents of the files or the project directory at this stage, we will explore them in future tutorials. But for the moment we will use this basic project to get used to Eclipse.

2. Using Eclipse Views

Step 1

Now that we have a project open we can see what Eclipse will look like while you develop your Android apps. You will see various tabbed areas within the Eclipse window, all of which can be modified to suit your own preferences. These tabbed sections are referred to as views. By default you should see a central editor area in which files appear for viewing and editing. To the left you should see the Package Explorer view and to the right the Outline view. Beneath the editor you should see a few default tabs providing additional information.

You can add views to the visible display by choosing «Window» then «Show View» and making a selection. To remove a view from display simply close it using the cross on its tab. You can also minimize and maximize visible views at any time using the buttons in the top right corners of each. Views in Eclipse are designed to let you see and interact with the various items within your projects in different ways. Let’s look at each of the most relevant views in turn.

Step 2

To the left of your Eclipse window you should see the Package Explorer. You can think of this as a file explorer, presenting the content of your projects within a directory structure. You can click to expand and collapse the folders in a project, as well as double-click to open any editable files in the editor. Each project is stored in a dedicated directory in your workspace, represented in tree form within the Package Explorer. This will be your main source for accessing the files that you need to work on when developing your apps.

If you expand the «src» folder in your new project, you will see the package you originally created when starting the project. Inside that you will see the Activity class file, which should automatically have opened in the editor. Your Java files are always organized into packages like this inside your projects. Most of your initial Android projects only use a single package, but you can have more than one. We will look into Java class files later on in this series, so don’t worry if you haven’t used them before.

Читайте также:  Running free для android

When we look closer at the application project structure in the upcoming tutorials we will pay particular attention to the «res» directory and the Manifest file, so take a moment to locate and browse these in the Package Explorer. When we begin developing, most of our attention will be paid to the «src» and «res» folders.

Step 3

The editor area is displayed in the center of the Eclipse window. You should see the Activity file you created along with your project opened for editing. Don’t worry about the content of the file just now — we’ll get to that soon. The editor view displays all files you have open at any time.

Eclipse also should have opened the layout file for your app. Switch to it now by clicking the top of the tab where it reads «activity_main.xml». Initially the layout file will be opened for editing graphically as this file represents the user interface for your app’s main screen. Click on the «activity_main.xml» tab. You should see at the bottom of the view to switch from the Graphical Layout. As you can see, the editor displays the XML code for editing directly.

As you will see when we start coding, the Eclipse editor aids the programming process by displaying suggested code excerpts as you type. This applies to Java and XML files, both of which you will be using plenty of.

Step 4

To the right of the editor, you should see the Outline view. We will explore more about the Outline view when we look at the basic programming tasks involved in Android. For now all you need to understand is that the view presents a structural overview of the content of any open Java or XML files. You will be able to use the outline to navigate your source code quickly.

Step 5

At the bottom of the Eclipse window, you will see a few views displayed by default, including the Problems, Javadoc, and Declarations views. Developers often use this area for outputting error and debugging messages, typically with the Eclipse Console view, which you can add to the display if you wish. However, the Android tools include a dedicated view for outputting messages that will help you to develop and debug your apps, so let’s open that now.

Select «Window», then «Show View», and choose «Other». In the Show View pop-up, expand the «Android» folder, select «LogCat», and click «OK». The LogCat view will appear in the bottom area of the Eclipse window. We will use this when we start to develop. With the LogCat view, we will write messages out during the execution of our apps. This step helps us find out what happens as the programs run.

3. Using Eclipse Perspectives

Step 1

The Eclipse views we’ve looked at provide different ways to interact with the content of your projects. As you have seen, you can configure the visible views in a way that suits your needs most effectively. Eclipse also provides Perspectives, which give you a quick way to switch between useful collections of views for common tasks. The default perspective you see initially is called «Java». Near the top right corner of the window you should see a button with «Java» on it.

For most of your Android development you will use the Java perspective. However, when you debug your apps you may also find the DDMS (Dalvik Debug Monitor Server) perspective useful. We will explore the details of this perspective later in the series. For now try switching to it to acquaint yourself with how the perspectives work. Choose «Window» then «Open Perspective», or click the «Open Perspective» button next to the «Java» button. Select DDMS from the list. At the moment the perspective will not show much — it will display virtual or connected physical devices when we work with them later.

Switch back to the Java perspective now by clicking the «Java» button or using the «Window» menu again. As you can see, Eclipse will display buttons for perspectives you recently used to make switching faster.

Conclusion

Now we have completed our Eclipse familiarization phase. Bear in mind that most of the aspects of the software will make a lot more sense to you once we start working on some Android projects. In the next part of the series we will look at Android Studio as we have with Eclipse, since you may wish to use it now and will certainly use it later if you continue with Android development. After that we will get to grips with the task of developing an Android app, including the basics of Java programming. Feel free to continue exploring Eclipse on your own. It is a highly configurable program that you can setup to reflect your own preferences at any time.

Источник

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