How to setup Android SDK in Eclipse for developers

Even I'm iPhone fan I wanted to try to develop for Android. I have and idea in my head about application which can change the world, but I need to setup Android SDK 😦 You can find detail instructions for setup on Android Developers page, but it is soo long and wordy 😦 So, I decided to prepare compressed guide from the  beginning to your first Android application, Hello Wold πŸ™‚

  1. Install Java JDK 6 (http://www.oracle.com/technetwork/java/javase/downloads/index.html)

  2. Android Developers (http://developer.android.com/index.html)

  3. Quick Start (http://developer.android.com/sdk/index.html)

    1. A Java or RCP version of Eclipse is recommended. For Eclipse 3.5, the "Eclipse Classic" version is recommended (http://www.eclipse.org/downloads/packages/eclipse-classic-352/galileosr2). Unpack Eclipse.
    2. Download the Android SDK (http://developer.android.com/sdk/index.html) – android-sdk_r07-windows.zip (http://dl.google.com/android/android-sdk_r07-windows.zip). Unpack Android SDK.
    3. Add the location of the SDK's primary tools directory to your system PATH. The primary tools/ directory is located at the root of the SDK folder, e.g. c:\Utility\android-sdk-windows\tools\. Tools Overview (http://developer.android.com/guide/developing/tools/index.html).
    4. Installing the ADT Plugin for Eclipse (http://developer.android.com/sdk/eclipse-adt.html):
      1. Start Eclipse, then select Help > Install New Software.
      2. In the Available Software dialog, click Add….
      3. In the Add Site dialog that appears, enter a name for the remote site (for example, "Android Plugin") in the Name field. In the Location field, enter this URL: https://dl-ssl.google.com/android/eclipse/
        Note: If you have trouble acquiring the plugin, you can try using "http" in the URL, instead of "https" (https is preferred for security reasons).
        Click
        OK.
      4. Back in the Available Software view, you should now see "Developer Tools" added to the list. Select the checkbox next to Developer Tools, which will automatically select the nested tools Android DDMS and Android Development Tools. Click Next.
      5. In the resulting Install Details dialog, the Android DDMS and Android Development Tools features are listed. Click Next to read and accept the license agreement and install any dependencies, then click Finish.
      6. Restart Eclipse.
      7. Select Window > Preferences… to open the Preferences panel. 
      8. Select Android from the left panel.
      9. For the SDK Location in the main panel, click Browse… and locate your downloaded SDK directory.
      10. Click Apply, then OK.
    5. Adding SDK Components (http://developer.android.com/sdk/adding-components.html):
      1. Open Eclipse.
      2. Select Window > Android SDK and AVD Manager.
      3. Select Available Packages in the left panel. This will reveal all of the components that are currently available for download from the SDK repository.
      4. Select the component(s) you'd like to install and click Install Selected.
      5. Verify and accept the components you want and click Install Accepted. The components will now be installed into your existing Android SDK directories.
      6. New platforms are automatically saved into the <sdk>/platforms/ directory of your SDK; new add-ons are saved in the <sdk>/add-ons/ directory; samples are saved in the <sdk>/samples/android-<level>/; and new documentation is saved in the existing <sdk>/docs/ directory (old docs are replaced).
      7. Restart Eclipse.
    6. Android Virtual Device (AVD) (http://developer.android.com/resources/tutorials/hello-world.html):
      1. In Eclipse, choose Window > Android SDK and AVD Manager.
      2. Select Virtual Devices in the left panel.
      3. Click New. The Create New AVD dialog appears.
      4. Type the name of the AVD, such as "my_avd".
      5. Choose a target. The target is the platform (that is, the version of the Android SDK, such as 2.1) you want to run on the emulator. You can ignore the rest of the fields for now.
      6. Click Create AVD.
    7. Hello World tutorial (http://developer.android.com/resources/tutorials/hello-world.html)
      1. Create a New Android Project
        1. From Eclipse, select File > New > Project.
          If the ADT Plugin for Eclipse has been successfully installed, the resulting dialog should have a folder labeled "Android" which should contain "Android Project".
        2. Select "Android Project" and click Next.
        3. Fill in the project details with the following values:
          • Project name: "HelloAndroid" 
          • Application name: "Hello, Android"
          • Package name: "com.example.helloandroid"
          • Create Activity: "HelloAndroid"
        4. Check Build Target for Android 2.2.
        5. Click Finish.
        6. Your Android project is now ready. It should be visible in the Package Explorer on the left. Open the HelloAndroid.java file, located inside HelloAndroid > src > com.example.helloandroid. It should look like this.
          
          package com.example.helloandroid;
          
          import android.app.Activity;
          import android.os.Bundle;
          import android.widget.TextView;
          
          public class HelloAndroid extends Activity {
             /** Called when the activity is first created. */
             @Override
             public void onCreate(Bundle savedInstanceState) {
                 super.onCreate(savedInstanceState);
             }
          }
          
          
      2. Construct the UI – Take a look at the revised code below and then make the same changes to your HelloAndroid class.
        
        package com.example.helloandroid;
        
        import android.app.Activity;
        import android.os.Bundle;
        import android.widget.TextView;
        
        public class HelloAndroid extends Activity {
           /** Called when the activity is first created. */
           @Override
           public void onCreate(Bundle savedInstanceState) {
               super.onCreate(savedInstanceState);
               TextView tv = new TextView(this);
               tv.setText("Hello, Android");
               setContentView(tv);
           }
        }
        
        
      3. Run the Application
        1. Select Run > Run.
        2. Select Android Application.
        3. The Eclipse plugin automatically creates a new run configuration for your project and then launches the Android Emulator. Depending on your environment, the Android emulator might take several minutes to boot fully, so please be patient. When the emulator is booted, the Eclipse plugin installs your application and launches the default Activity. You should now see something like this:
    8. Next Steps (http://developer.android.com/sdk/installing.html#NextSteps)
  4. It is Done πŸ™‚

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s