Learn the powerful enterprise adaptable database:

Getting Started With ADABAS & Natural

Sunday, March 24, 2013

Android Developer Tools (ADT) Bundle for Windows

Android - Building Your First App


1) This tutorial is based on 
http://developer.android.com/training/basics/firstapp/creating-project.html.

2) The Integrated Development Software used for this tutorial (ADT) is downloadable from 
http://developer.android.com/sdk/index.html#download (32 bit edition).

3) Download and extract the ADT software at the step (2). The top-level directory is as shown below:


4) Go into eclipse directory and locate Eclipse executable file.


5) Run eclipse.exe. An ADT Splash Screen pops up.


6) A Workspace Launcher dialog box appears. Set your Workspace directory, preferably "../workspace") which means it is located at top level of the ADT directory. Optionally, Tick "Use this ad the default and do not ask again".


7) Click Menu/Help/About ADT.


8) The About ADT window pops up.
A number of installed components are shown as icons. The green icons are those related to Android Development kit.
Checking the installed components is necessary during the first time running of Eclipse to ensure that you have the required Android Development kit. Without these, you cannot use Eclipse to build Android apps.
Click OK.


CREATING AN ANDROID EMULATOR

9) Before you develop an Android app, you need to setup an Android Emulator so that you can test your app on it.
10) Click Menu Window/Android Virtual Device Manager.


11) Set the machine configuration.
11.1) Click "Edit..."
11.2) Enter the required details. Click OK.
11.3) To test the machine, click Start…


12) Set Launch options.
12.1) Accept the default and click Launch.


12.2) The Starting progress windows pops up.


12.3) The Android emulator starts loading.


12.4) You have to wait for logon screen to appear. Use your mouse to tap on the padlock icon and drag it to the right to unlock the machine.


12.5) Look at the title of the window, 5554:WQVA33
5554 is the port number of the emulator that allows it to communicate with other software.
WQVA33 is the name given in Step (11).

13) You can leave this emulator window open while building the app.

CREATING NEW ANDROID PROJECT

14) Click Menu File/New/Android Application Project






15.1) The explanation as stated on the above website:
  • Application Name is the app name that appears to users. For this project, use "My First App."
  • Project Name is the name of your project directory and the name visible in Eclipse.
  • Package Name is the package namespace for your app (following the same rules as packages in the Java programming language). Your package name must be unique across all packages installed on the Android system. For this reason, it's generally best if you use a name that begins with the reverse domain name of your organizationor publisher entity. For this project, you can use something like "com.example.myfirstapp." However, you cannot publish your app on Google Play using the "com.example" namespace.
  • Minimum Required SDK is the lowest version of Android that your app supports, indicated using the API level. To support as many devices as possible, you should set this to the lowest version available that allows your app to provide its core feature set. If any feature of your app is possible only on newer versions of Android and it's not critical to the app's core feature set, you can enable the feature only when running on the versions that support it (as discussed in Supporting Different Platform Versions). Leave this set to the default value for this project.
  • Target SDK indicates the highest version of Android (also using the API level) with which you have tested with your application.
As new versions of Android become available, you should test your app on the new version and update this value to match the latest API level in order to take advantage of new platform features.
  • Compile With is the platform version against which you will compile your app. By default, this is set to the latest version of Android available in your SDK. (It should be Android 4.1 or greater; if you don't have such a version available, you must install one using the SDK Manager). You can still build your app to support older versions, but setting the build target to the latest version allows you to enable new features and optimize your app for a great user experience on the latest devices.
  • Theme specifies the Android UI style to apply for your app. You can leave this alone.
15.2) Click Next.
16) Configure New Android Application Project.
16.1) Click Menu Window/Android Virtual Device Manager.
16.2) Accept the default configuration and click Next.
17) Configure Launcher Icons.
17.1) Accept the default and click Next.
18) Create Activity.
18.1) Accept the default (Create Activity/Blank Activity) and click Next.
19) Set options for New Blank Activity
19.1) Accept the default and click Next.
20) Project Created
20.1) Look at the Package Explorer Panel. The file activity_main.xml is highlighted.
20.2) Look at the Design Panel. The draft of the application screen layout is shown.
20.3) Notice the text "Hello world!" at the center of the screen layout.
21) The project creation is done. 


RUNNING APP ON EMULATOR

22) Right-click the Project Name. Select Run As/Android Application.
23) The app is launched to the emulator.
23.1) Notice that the look of the app screen is similar to the layout in Step (20)
23.2) Notice the name "My First App"


24) Click Return Button to exit from My First App.

12 comments:

  1. I followed as mentioned above.But for some reason when i click run->run as->Android Application, the emulator doesn't start. Can anyone please help?

    ReplyDelete
    Replies
    1. Did you follow step 9 and 10?
      Did the emulator run well?

      Delete
    2. i got the same problem too..

      Delete
    3. Follow Step 10.
      Let the emulator run at the back. Don't shut it down.
      Proceed to Step 11.
      Type your code.
      Click Run As Android Application.
      Since the emulator is running at the back, you don't have to start it anymore.
      Check via DDMS perspective to see whether Eclipse is able to detect your emulator.

      Delete
  2. I follow all these steps but I got the error

    Starting emulator for AVD 'WQVGA33'
    Failed to create Context 0x3005
    emulator: WARNING: Could not initialize OpenglES emulation, using software renderer.
    Failed to allocate memory: 8
    This application has requested the Runtime to terminate it in an unusual way.
    Please contact the application's support team for more information.


    Please help..

    ReplyDelete
    Replies
    1. It could be a machine/windows-specific problem. I suggest that you try running on other machines and see if it works.

      Delete
  3. BUT I HAVE MOBILE OF ANDRIOD 2.2 SO WHAT CHANGES I SHOULD DO IN THE ABOVE STEPS? OR DO THE SAME?

    ReplyDelete
  4. @Bilal,

    Minimum Required SDK is the lowest version of Android that your app supports, indicated using the API level. To support as many devices as possible, you should set this to the lowest version available that allows your app to provide its core feature set. If any feature of your app is possible only on newer versions of Android and it's not critical to the app's core feature set, you can enable the feature only when running on the versions that support it (as discussed in Supporting Different Platform Versions). Leave this set to the default value for this project.

    Target SDK indicates the highest version of Android (also using the API level) with which you have tested with your application.
    As new versions of Android become available, you should test your app on the new version and update this value to match the latest API level in order to take advantage of new platform features.


    Compile With is the platform version against which you will compile your app. By default, this is set to the latest version of Android available in your SDK. (It should be Android 4.1 or greater; if you don't have such a version available, you must install one using the SDK Manager). You can still build your app to support older versions, but setting the build target to the latest version allows you to enable new features and optimize your app for a great user experience on the latest devices.

    Regards,
    ScienceUncle. (www.scienceuncle.com - Malayalam Science Portal)

    ReplyDelete
  5. step 6, 8 and step 12 image is not preview. what should i do

    ReplyDelete
    Replies
    1. Alternatively, read this, http://android-steps.blogspot.com/2014/02/android-eclipse-build-your-first-app.html

      Delete
  6. I cannot find Android Virtual Device Manager In Window on Eclipse.....Help me..

    ReplyDelete