Development of a mobile application for android eclipse. Building Android Applications with Eclipse and ADT. What is my marketing strategy


In order to write programs, you need a development environment. Google recommends using Eclipse with the Android Development Tools (ADT) plugin for this purpose. In this tutorial, we'll take a detailed look at how to install and set up this development environment.

I will describe the installation applicable to the operating Windows system 7.
I use this installation guide -
System requirements -

There are many screenshots and instructions in this article. Keep in mind that software versions are constantly changing and everything may look different for you and versions may be different.
How to update components is.

1. Java SDK - JDK

Because applications are developed in Java, we need to download and install the corresponding SDK, also called the JDK (unless, of course, it is already installed).

You can download. Recently, the seventh version has appeared. I can’t say anything about it, but there is something raw, so I recommend downloading the proven sixth version In the section Java Platform Standard Edition press JDK Download, check the box that you accept the license agreement and download the file according to your operating system. Installation shouldn't be a problem. After that, it is advisable to reboot.

2.Android SDK

The Android SDK includes the tools you need to develop Android apps. Content can be viewed and downloaded. It is recommended to download the EXE file, but I suggest downloading the ZIP version and unpacking it yourself into a directory convenient for you (if there is no ZIP link, click the Other Platforms link).

Please note that this should be a "forever" directory. And it is better not to move it anywhere, otherwise you will have to reconfigure the development environment. I suggest creating an Android directory somewhere. It is highly desirable that the path to it be short. Ideally - :\android (for me it will be f:\android). For ourselves, remember this directory under the pseudonym . And unpack our SDK archive into it, we get \android-sdk-windows.

3.Eclipse

Nice and convenient development environment, where we will create and create). We will take her. Google recommends us a version Eclipse Classic. We agree with him and download this particular version. Unpack the archive into, we get \eclipse.

4.ADT

By default, Eclipse is not very suitable for developing Android applications. ADT is a plugin that configures the development environment to use the Android SDK and adds a user-friendly development experience.

Launch Eclipse (\eclipse\eclipse.exe). At the first start, it will ask you to specify the working directory where it will store information about projects. Again, I propose not to go far and create a catalog \workspace and specify this directory.

So Eclipse is up and running. Download ADT plugin.

Launch in the menu Help > Install New Software...


Click the button Add in the upper right corner


Enter " AD Plugin" in field Name
URL address: https://dl-ssl.google.com/android/eclipse/- in field location


Click OK and wait for it to appear Developer Tools(If you have problems use http instead of https)
Put a tick on Developer Tools and click Next


We see the components that will be installed, click again Next



Read and accept the license agreement and click Finish


Component download begins. If it pops up security warning that the authenticity or validity of the software can't be established, press OK.

The process took me about a minute.
After completion, you need to restart Eclipse - Restart Now


After restarting Eclipse, it will display the following dialog:


The first item is needed for those who, for some reason, did not download and unpack the SDK at the second step of this instruction. Eclipse will be able to do it itself. And in addition, it will immediately download the latest Android platform. He also offers to download platform version 2.1, as the most supported by a bunch of devices.

We are interested in the second item - it allows you to specify where we unpacked the SDK in step 2. We have this - \android-sdk-windows. Click Next.

And in the window that appears, choose whether to send statistics to Google or not to send. It will not affect the work in any way.



5.Android platforms

And we fail in the SDK Manager.


Here it is proposed to select components for downloading via the Internet. On the right side, for each component, it is indicated whether it is already installed or not. So what are we going to download?

Be sure to download the still uninstalled contents of the Tools folder. Also in the Extras folder (at the end of the list) find the item Android Support Library and mark it if it exists.

For the rest of the Android versions you need, select only the SDK Platform. Keep in mind that each platform can weigh up to 150 meters!!! You won’t shake much at work, the admins will come for you later :) For the first lessons, you only need platforms 2.2 (API 8) And 2.3.3 (API 10). You can only download them for now.

For platforms version 4.X, select SDK Platform(the platform itself) and ARM EABI v7a System Image(for the emulator to work).

If you don’t feel sorry for the traffic, then add the following items for each platform:
Samples for SDKs- source codes of application examples
Google APIs by Google Inc.- necessary if you are going to work with Google applications (Map, Navigation, etc.)

If the traffic is not a pity at all - put all the daws. But it will take a long time to wait. And the whole thing will take more than one gig.

When everyone has chosen, press the button Install X packages bottom right.

In a new window, we confirm that we agree to download all this - Accept All. At the same time, here you can see the size and refuse something.


Click Install - the indicator ran and the log opened - the download began. With my choice of components, I waited 20 minutes. After that, the phrase appeared in the windows:

Installation completed. Close the log and SDK Manager.

For information - my new components took 1.5 gigabytes.

Then restart Eclipse and that's it. After completing these steps, we have a development environment with which we can code Android applications. Perhaps these actions will seem muddy and boring, but without them, unfortunately, in any way. Then things get more fun. If something doesn't work or gives an error - try to google, for sure you are not the first to face such a problem and the network already has a description of the solution. Well, or write to the forum.

In the next lesson, we will set up an Android Virtual Device (AVD) in Eclipse, create our first app and let's run it. AVD is a smartphone emulator with operating system Android on which you can run and test applications. Do not connect your smartphone every time) We will also look at the structure of the application project.

P.S. If you don't see this window


or you accidentally closed it - it's okay. The path to the SDK from step 2 can be specified manually.

In Eclipse menu Windows > Preferences


Left select Android, click Browse

Specify the directory where the SDK was unpacked - \android-sdk-windows. Click apply.

We are told that the component is missing - close this message and click OK


I also got this window:

It says that if we want to improve the product, we can send usage statistics. The choice is yours, you can always change it later in the settings. I left a daw, I'm not sorry)

After that, you can go to the SDK Manager (in the Eclipse menu Window > Android SDK Manager) and download platforms.

Due to the fact that some people are unable to run my projects, and after talking with them, I realized that the problem is not in the code, but in the assembly of Eclipse + Android SDK, I decided to write how to install this beauty, and bring it to mind.

Installing Eclipse and Android SDK

  • Download the Android SDK for your platform (Windows, Mac OS X or Linux).
  • Unpack the downloaded files to any memorable place on your hard drive (on my Windows it's D:\eclipse\).
  • If Eclipse is already installed, download and install the Eclipse IDE for Java Developers package. For programming, Google recommends using Eclipse 3.5 (Galileo).
  • Launch Eclipse and select Help->Install New Software.
  • Click Add in the Available Software window.
  • Enter Android Development Tools in the field Name and https://dl-ssl.google.com/android/eclipse/ in the box location.
  • Click OK and check Developer Tools in the list of available software. This will install the Android Development Tools and DDMS, a debugging tool for Android. If you have problems installing ADT then use old version ADT 15.0. Update to version 15.0

    • Click Next And Finish to install the plugin. You need to restart Eclipse once after installation.
    • After restarting Eclipse select Window->Preferences and you will see Android in the category list.
    • Now we need to tell Eclipse where the installed Android SDK is located. Click Android, then Browse to select the location of the unpacked SDK files. For instance, C:\Program Files\android\android-sdk

  • Android Platform Orientation

    Before you start writing Android applications, you need to download the SDK for the Android platform. Each platform has its own version of the Android SDK installed on users' devices. For Android version 1.5 and above, there are two platforms: Android Open Source Project And Google.

    Android Open Source Project- open source platform but does not include Google extensions such as Google maps. If you do not wish to use the Google API, the Google Maps functionality will not be available to your application. Unless you have a specific reason to do this, I would recommend that you target one of the Google platforms, as this will allow you to use Google's own extensions.

    • Select Window->Android SDK Manager.
    • Click Available Packages in the left column and check the repository to show the list of available android platforms.
    • You can select platforms to download from the list, or leave all checked to download all available platforms. When finished, click Install Selected and follow the installation instructions.

    Once everything has successfully uploaded, you are ready to start developing for Android.

    Creating a New Android Project

    The Eclipse New Project Wizard will help you create android application, generating files and code ready to run to the right of the block. This is a quick way to make sure it works and a good starting point when starting to develop applications:

    After pressing Finish, Eclipse will create a new Android project ready to run. Remember you told Eclipse to generate an Activity called MyFirstAndroidProjectActivity ? This is the code that Android actually uses to run the app. The generated code will be displayed as a simple 'Hello World' message.

    Packages

    The package name is an identifier for your application. When it's time to publish the result to the Android Market, this ID will be used to track updates for the app, so it's important make sure this id is unique. Although we're using the name com.my.first.project here, for a real application it's better to choose something like com.yourcompanyname.yourapplication .

    SDK versions

    The Min SDK Version (the name says it all) is the earliest version of Android that the app will run on. With every new release of Android, the SDK adds and changes various methods. When you select an SDK version, Android (and the Android Market) knows that your app will only run on devices with the specified version of Android and above.

    Launching your application

    Now let's try to run our application in Eclipse. Since this is the first run, Eclipse will ask you which project type you are working with:

    • Select Run->Run or click Ctrl+F11.
    • Select Android Application and press OK.

    Eclipse will try to run the application on the Android device. At the moment, however, you do not have devices under Android control, so the project will fail to run and you will be prompted to create a new device Android Virtual Device(AVD).

    Virtual devices (Android Virtual Devices)

    Android Virtual Device (AVD) emulates the Android environment, be it mobile phone or tablet PC. You can create as many AVD devices as you like, with different versions of the Android platform. For each AVD, you can configure various device settings such as physical keyboard, GP support, camera resolution, and so on.

    Before running the application, you must create your first AVD device with the platform SDK (Google API, 1.6).

    Let's move away from the topic of markups a bit. Everything has changed a lot on the Alma Mater website. Android Studio is now the environment for Android app development. But since a lot of examples and tutorials are focused on Eclipse, it's still worth having it in your arsenal.

    In addition, Java 8 was released. And in connection with all this, we will once again install the JDK, Eclipse + ADT, and then Android Studio and JetBrains IntelliJ IDEA 14.0.2. Well, without fail Genymotion.

    And so, let's go!

    1) Install JDK

    And choose JDK Download

    We agree with the license

    And choose the version to download depending on the bitness of your Windows (I have Win 8.1 x64).

    Downloaded, run JDK for installation

    during the installation process, the JRE will also be installed

    We all click Close. This completes the JDK installation.

    Checking the JDK installation with the command java-version.

    If we see a similar output of the command (it may differ for you if you downloaded a different version or build of java), then everything is fine. Move on.

    2) Installing Eclipse

    And download Stand-alone SDK Tools

    We download exactly the zip archive with the SDK and then unzip it to C: \ android-sdk-windows (you can choose another directory, whichever is convenient). We see the following

    This completes the SDK installation.

    4) Installing the ADT Plugin for Eclipse

    We start Eclipse. Choose Install New Software

    And in the window that opens, enter the address https://dl-ssl.google.com/android/eclipse/

    Press Enter. We are waiting for Eclipse to find packages to install. We mark everything as in the screenshot and click Next

    Wait a bit and click Next again

    We agree to licenses

    There might be a warning like this

    Just click OK

    Once installed, Eclipse will prompt you to restart for the changes to take effect.

    We agree and after the restart we see such a picture

    ADT swore that he did not see the Android SDK and this is normal, since he does not know where it is. But we will tell him.

    Click Close and Eclipse will prompt us to enter the path to the Android SDK

    Choose the path where we unzipped the Android SDK and click Next

    And click Finish

    Can swear like that

    Click Open SDK Manager

    For now, it is important to choose what is marked in yellow. Other packages can be installed at any time.

    Click Install...

    We agree with the licenses and click Install again and wait until everything is downloaded and installed

    During installation, a log may be displayed

    You shouldn't be afraid

    Downloading and installing the Android SDKs can take a long time.

    At the end you should see such a window

    which can be closed. Also in this Eclipse window, you can click Close

    And restart Eclipse

    Now we see that Eclipse started without problems and errors, and it is also clear that it sees the Android SDK.

    Now it remains to brush it all up a bit and run the first test application to check the operation of this entire economy.

    5) Install additional Android SDK packages

    Packages are placed on a need-to-know basis. Those. if you want to develop and test your programs under different versions of Android, then you need to install the necessary packages. They can be removed or added at any time.

    For the first time, you can install such packages (well, or whatever you see fit)

    After downloading these packages, the daddy from the Android SDK began to weigh almost 7.5 GB

    So calculate the space on your disks.

    6) AVD (Android Virtual Devices) storage location setup

    By default, the Android SDK creates and stores AVD files in the directory

    C:\Users\USER\.android\avd

    This is not very convenient for me, so I will transfer this folder to the directory C:\AVD

    For this

    1. Create a folder C:\AVD

    2. Create a Windows environment variable called ANDROID_SDK_HOME and a parameter pointing to our directory

    3. Copy the .android subdirectory to the H:\AVD directory

    4. Run AVD Manager and see that its directory is in the new location where we specified

    We don't have AVDs created yet, but we'll fix that.

    In the meantime, you need to install and configure Intel® HAXM

    7) Installing and configuring Intel Hardware Accelerated Execution Manager (Intel® HAXM)

    System requirements and installation instructions here:

    You can install both manually and through the Android SDK. But I chose to install manually, since the Intel site usually contains a more recent version of HAXM.

    And so we download HAXM here (at the moment version 1.1.1 and the file weighs only 1.7Mb):

    Unzip and run the installation file

    In order to check that everything is installed correctly and works, you need to command line execute:

    sc query intelhaxm

    After executing this command, you will see the current status of the service

    You may also need a way to stop the service:

    sc stop intelhaxm

    Start service:

    sc start intelhaxm

    With this, we only prepared for the launch of AVD. Now you need to create an AVD device

    8) Create an AVD

    Launch AVD Manager

    We create an AVD. In CPU / ABI select Intel Atom

    After clicking OK, information about the created AVD will be displayed

    And as a result we see our AVD

    And we launch it by pressing Start ...

    As a result, we see the emulator in operation

    The Android 2.2.3 emulator started up pretty fast and also works almost without brakes. Let's create an Android 4.x AVD and see how it behaves

    This one has been running for much longer

    It can be seen that HAXM works

    But one way or another, the speed of AVD on Android 4.1.2 is quite decent. Much better than it was a year ago.

    And one more trick. If you set too much RAM for AVD

    As we can see, a yellow triangle icon with an exclamation mark appears. And when you start the emulator swears at this and may not start

    It is treated quite simply. Need to open file \.android\avd\ .avd\config.ini and change the line hw.ramSize=2048 on the hw.ramSize=2048MB

    True, the startup time is still much longer than on AVD 2.x

    Now it remains to check the launch of the real program on the AVD.

    9) Run test program on AVD

    Launching Eclipse and creating a test application

    The master generated a project for us

    Well, let's run it on AVD 2.x

    Everything works. But AVD is a very capricious and unpredictable thing. Therefore, we'd better put Genymotion.

    10) Install Genymotion

    Installing Genymotion consists of two steps: Installing VirtualBox and installing Genymotion itself. Genymotion uses VirtualBox to install android virtual machines.

    And so we download VirtualBox from the manufacturer's website https://www.virtualbox.org/wiki/Downloads

    and install it

    A warning will come out and we agree with it

    Setting up VirtualBox

    Specify where it will be stored virtual machines

    And that is all. Just in case, after installing VirtualBox, it is better to restart the computer.

    Now install Genymotion

    And register (if not already registered) to download free version

    The current Genymotion version is 2.3.1

    And so we set

    Setting up Genymotion

    Now we need to add virtual devices

    To do this, once again enter our login and password, which we created when registering on the site.

    After that, we will get a list of devices that can be downloaded and installed.

    They can be filtered by Android version and device

    Here we see that we are shown only devices with Android 2.3.7

    But before downloading devices, you need to tweak Genymotion a little. To do this, click Cancel and go to the Genymotion settings

    And specify the path to the previously created directory where the virtual machines will be stored

    As well as the path to the directory with the Android SDK

    Now click OK and proceed to add devices

    I chose Google Nexus One 2.3.7

    And also Google Nexus S 4.1.1

    This is what they look like installed

    To start the device, press start. I launched Google Nexus One 2.3.7 and checked the launch of the test application on it.

    In principle, from Eclipse, you can easily run applications in Genymotion without a plugin, but for convenience, we will integrate Genymotion with Eclipse.

    To do this, install the Genymotion plugin in Eclipse

    Press Enter, wait until the plugin appears, mark it and click Next

    After the reboot, we see the Genymotion launch icon in the Eclipse toolbar

    We click on it and see such muck

    You need to specify the path to the Genymotion directory. Click OK and specify the path to the directory

    Now when we click on the Genymotion icon on the panel we will see this

    Well, that's almost all. Now there are minor cosmetic improvements. appearance Eclipse which I usually always do. Well, you can, in principle, delete all the images of AVD virtual devices that we downloaded in the SDK Manager, since, by and large, there is no need for them, and they eat up space and are not small.

    Go to Help –> Eclipse Marketplace

    And in the search we drive in Jeeeyul and then install this plugin.

    Well, with its help, we color everything as we want.

    My Eclipse after settings looks like this

    What I like about this plugin is that you can create themes and then export and import them.

    Now let's remove the Intel AVD device packages.

    The SDK folder before deletion weighs 7.5 GB

    After removal weighs 3GB

    Total difference is 4.5 GB…. not a little

    That seems to be everything. Now let's add Android Studio to this kit, but that's in the next topic.

    This article will describe how to set up Eclipse for Android application development. I will list all the necessary software: 1) JDK 6 (Java Development Kit - Java Development Kit) 2) Eclipse Classic 3) Android SDK (Software Development Kit - Software Development Kit) 4) ADT (Android Development Tools - Tools for Android development ) - plugin for Eclipse JDK The JDK installation process is described in the article: Eclipse After installing the JDK, let's move on to installing Eclipse. Download the latest version of Eclipse from the official site eclipse.org. Click on bookmark Downloads, you will be presented with various builds of Eclipse. For our purposes, we need classic Eclipse - Eclipse Classic(at the time of writing latest version was 4.2.2). Unpack the downloaded archive into a directory c:\eclipse(or wherever you prefer) For convenience, create a shortcut to the executable file eclipse.exe. Run eclipse. On first launch, you will be prompted to select a directory for your workspace. Workspaces group projects. If one workspace is enough for you, then you can set the flag "Use this as the default and don't ask again". By setting this flag, eclipse will not display this window next time, and will immediately open your default workspace. Android SDK Go to the download page http://d.android.com/sdk On this page, it is proposed to say an assembly that has everything you need for android development. But we will go the other way. Download only Android SDK. Select an item "DOWNLOAD FOR OTHER PLATFORMS"(download for other platforms), in the table titled "SDK Tools Only"(SDK only) download the Windows SDK installer (*.exe). After reading and agreeing to the license agreement, download this installer. Before installing the Android SDK, you need to make sure that the environment variable is set JAVA_HOME(), otherwise the installer will swear without finding the JDK. Run the installer installer_r21.1-windows.exe. In the welcome window, click Next
    In the next step, the installer determines the location JDK by system variable JAVA_HOME. If the JDK is found, click the button "next".
    In the user selection window, select the option "Install for anyone this computer"(install for all computer users). If you want to install only for yourself, then select the second option "Install just for me". Click "next".
    In the window for choosing the installation location, leave everything as default and click "next".
    In the window for creating a shortcut in the menu, you can also leave everything unchanged and click .
    After successful installation, click "next".
    In the final window of the installer, leave a checkmark "Start SDK Manager", to start it SDK Manager, after pressing the button "Finish".
    Once launched, the SDK Manager will prompt you to install the latest version of the API. If you need previous versions, specify them and click the button "Install packages..."
    Agree with the license "Accept License" and press
    The download of your selected packages from the Internet will begin. ADT Installing the ADT plugin for Eclipse. We start Eclipse. On the menu Help select "Install New Software...". Click the button "Add..."(Add) Add storage window will appear:
    Give it a name Android Development Tools and location address "https://dl-ssl.google.com/android/eclipse/". Click "OK" After a few seconds of waiting, an entry should appear in the list "Development Tools", tick it and click "next". In the next window, also click "next". In the license agreement overview, agree to it and click "Finish". A window will pop up during installation. Security Warning just click in it OK. Upon completion of the plugin installation ADT will be prompted to restart Eclipse, agree to this. At startup Eclipse the following error may occur:
    Eclipse can't find the SDK because we installed the default SDK in the directory: C:\Program Files (x86)\Android\android-sdk. To reassign the path to the SDK, open the menu Windows -> Preferences. In the window Preferences in field SDK Location indicate the path to Android SDK and press OK.
    Everything Eclipse ready for development Android-applications.

    Android provides a special plugin for the Eclipse IDE called Android Development Tools (ADT). It provides a powerful IDE in which you can build Android applications. ADT extends the power of Eclipse so that you can quickly and easily create a new Android project, design user interface applications, debug the application, and export APK files to distribute your application.

    Comment: If you prefer to work in a different IDE, then you don't need to install either Eclispe or ADT. Instead, you can directly use the SDK's capabilities to build and debug your application.

    Download ADT plugin

    1. Start Eclipse, select Help > Install New Software.
    2. Click Add in the upper right corner.
    3. In the Add Repository dialog that appears, enter "ADT Plugin" in the field Name and the following url in the field location:

    https://dl-ssl.google.com/android/eclipse/

    1. Click OK.
    If you have problems when trying to get the plugin, then try in the field location write "http" instead of "https" (https is used for security reasons).
    1. In the Available Software dialog, check the box next to Developer Tools and click Next.
    2. In the next window, you will see a list of tools to download. Click Next.
    3. Read and accept the license agreement, then click Finish.
    If you receive security warnings that authenticity and validity software cannot be installed, click OK.
    1. After installation is complete, restart Eclipse.

    Configuring the ADT Plugin

    After restarting Eclipse, you must specify the directory with your Android SDK:

    1. Select Use existing SDKs in the window that appears.
    2. Find and select the directory containing the Android SDK you recently downloaded and unzipped.
    3. Click Next.

    Troubleshoot installation

    If you are having difficulty downloading the ADT plugin after the steps above, then here are some solutions:

    • If Eclipse cannot find the remote update site containing the ADT plugin, then try changing the site link to

    http://dl-ssl.google.com/android/eclipse/

    • If you have a firewall (or corporate firewall) enabled, make sure you have entered the correct proxy settings in Eclipse. In Eclipse, you can set up proxy from the main menu from Window(on Mac OS X, Eclipse)> Preferences > General > Network Connections.

    If you are still unable to download the ADT plugin using Eclipse from the remote update site, you can download the ADT zip file to your computer and install it manually:

    For Linux Users

    If you are facing problem installing ADT plugin for Eclipse view:

    An error occurred during provisioning. Cannot connect to keystore. JKS

    This means that you do not have a suitable Java VM on your computer. Installing Sun Java 6 will solve this problem and then you can reinstall the ADT plugin.

    Share with friends or save for yourself:

    Loading...