{"id":1473,"date":"2011-01-20T20:01:48","date_gmt":"2011-01-20T14:31:48","guid":{"rendered":"http:\/\/naveenbalani.com\/?p=1473"},"modified":"2017-03-24T17:55:26","modified_gmt":"2017-03-24T12:25:26","slug":"getting-started-with-android-creating-android-application","status":"publish","type":"post","link":"https:\/\/navveenbalani.dev\/index.php\/articles\/getting-started-with-android-creating-android-application\/","title":{"rendered":"Getting Started with Android \u2013 Creating Android Application"},"content":{"rendered":"<p>This is ongoing blog on <a href=\"http:\/\/naveenbalani.com\/index.php\/tag\/android\/\">Getting Started with Android<\/a>. In <a href=\"http:\/\/naveenbalani.com\/index.php\/2011\/01\/getting-started-with-android\/\">earlier blog<\/a>, I provided an architecture overview of android application. In this blog, I would setup the development environment for Android and create a simple hello world application.<\/p>\n<p>I would say are two ways you could develop Android applications-<\/p>\n<ul>\n<li>The web development way: &#8211; Utilizing your web development skills like- HTML, CSS 3 and JavaScript (JQuery libraries). For instance, software\u2019s like <a href=\"http:\/\/www.phonegap.com\/\">PhoneGap <\/a>let you create web applications and uses a native bridge to run your applications to most leading mobiles- Android, IPhone and Blackberry.<\/li>\n<\/ul>\n<ul>\n<li>Android SDK : &#8211; Using the Android SDK and third party android Java libraries to create applications using IDE like Eclipse.<\/li>\n<\/ul>\n<p>I would start development with the later approach, but I plan to include web development also as part of this android series.<\/p>\n<p>Here are the software\u2019s you would need to create Android applications \u2013<\/p>\n<p><em>Eclipse IDE <\/em>\u2013 I plan to use Eclipse IDE. You would need to install the Eclipse SDK \u201cclassic\u201d platform. I have used the latest version 3.6. Download it from <a href=\"http:\/\/www.eclipse.org\/downloads\/packages\/eclipse-classic-361\/heliossr1\">here<\/a>.<\/p>\n<p><em>Android SDK Starter Package<\/em> &#8211; Download the android starter package windows installer from &#8211;<a href=\"http:\/\/dl.google.com\/android\/android-sdk_r08-windows.zip\">http:\/\/dl.google.com\/android\/android-sdk_r08-windows.zip<\/a> . The Starter package lets you choice and installs Android SDK components. Run the Android SDK Starter Package installer. The Android SDK Starter Package requires Java 5 or 6 and it would detect during installation. Once you install Android SDK Starter Package, run the SDK Manager.exe from installed location. On the Choose packages to install, click Cancel as we would install required packages only. Note that the applications developed on new versions of android are not backward compatible, for instance applications developed on 2.3 would not work on 2.2, but applications developed on 2.2 should continue to work on 2.3. (how ever this may no be the case always, so its best to test out the application on emulator).<\/p>\n<p>Click on Available Packages and select SDK platform 2.3 (latest version) and Samples for SDK API 9 as shown\u00a0\u00a0 below. This would installed Android SDK and its dependent components.<\/p>\n<p><a href=\"http:\/\/naveenbalani.com\/wp-content\/uploads\/2011\/01\/Andriod-Available-Package.jpg\"><img loading=\"lazy\" class=\"aligncenter size-full wp-image-1476\" title=\"Andriod-Available-Package\" src=\"http:\/\/naveenbalani.com\/wp-content\/uploads\/2011\/01\/Andriod-Available-Package.jpg\" alt=\"\" width=\"400\" height=\"201\" srcset=\"https:\/\/navveenbalani.dev\/wp-content\/uploads\/2011\/01\/Andriod-Available-Package.jpg 400w, https:\/\/navveenbalani.dev\/wp-content\/uploads\/2011\/01\/Andriod-Available-Package-300x150.jpg 300w\" sizes=\"(max-width: 400px) 100vw, 400px\" \/><\/a><\/p>\n<p><em>Android ADT<\/em> \u2013 Android development toolkit is an eclipse plug-in, which provides an integrated environment in eclipse for building and testing android applications. You can use the update manager in eclipse and install the ADT automatically or download the ADT Plugin zip from &#8211; <a href=\"http:\/\/dl.google.com\/android\/ADT-8.0.1.zip\">http:\/\/dl.google.com\/android\/ADT-8.0.1.zip<\/a> and install it manually. I prefer to use download the plug-in and install it manually. Once downloaded, follow these instructions \u2013<\/p>\n<ul>\n<li>Start eclipse . Click on Help -&gt; Install New Software<\/li>\n<li>Click on Add. In the Add Repository, Click Archive and provide the location of downloaded ADT zip file. Enter Name as ADT local. Click Ok<\/li>\n<li>Click on Developer Tools and Click Next<\/li>\n<li>Click Next. Accept the licenses and Click Finish.<\/li>\n<li>This would install ADT plug-in. Restart eclipse<\/li>\n<li>Next specify the location of Android<\/li>\n<li>Click on Windows -&gt; preferences<\/li>\n<\/ul>\n<p>Next, Click on Android. In the Android preferences, click SDK location, click Browse and provide the location Android SDK location. Click Apply.<\/p>\n<p>To check our installation was fine, we will create a hello world application and run it via Android emulator. Before running the Android application, you need to create an Android Virtual Device (AVD). AVD as the name suggest is a virtual device that emulates an android device and runs the application. The eclipse plug-in internally used android avd command, to create the AVD.<\/p>\n<ul>\n<li>Click on Window &gt; Android SDK and AVD Manager. \u00a0On the Virtual devices editor,Click New<\/li>\n<li>Specify the Target as Android 2.3- API Level 9. (or the android environment which you want to create applications) , specify size of \u00a0SD card and skin for the emulator as shown below. Click Create AVD.<\/li>\n<\/ul>\n<p><a href=\"http:\/\/naveenbalani.com\/wp-content\/uploads\/2011\/01\/AVD-Device.jpg\"><img loading=\"lazy\" class=\"aligncenter size-full wp-image-1484\" title=\"AVD-Device\" src=\"http:\/\/naveenbalani.com\/wp-content\/uploads\/2011\/01\/AVD-Device.jpg\" alt=\"\" width=\"232\" height=\"300\" \/><\/a><\/p>\n<p>Once the AVD is created, we will create a simple hello world application by carrying out the following<\/p>\n<ul>\n<li>Select File &gt; New &gt; Project.<\/li>\n<li>Select Android &gt; Android Project, Click Next.<\/li>\n<li>Enter the following information for the project &#8211;<\/li>\n<\/ul>\n<p style=\"padding-left: 60px;\">Project name &#8211; \u00a0WasuppAndroid<\/p>\n<p style=\"padding-left: 60px;\">Build Target &#8211; Android 2.3<\/p>\n<p style=\"padding-left: 60px;\">Application name &#8211; \u00a0Wasupp Android<\/p>\n<p style=\"padding-left: 60px;\">Package name &#8211; org.android.samples<\/p>\n<p style=\"padding-left: 60px;\">Create Activity &#8211; \u00a0Wasupp<\/p>\n<p style=\"padding-left: 60px;\">Min SDK Version &#8211; \u00a09<\/p>\n<ul>\n<li>Click Finish<\/li>\n<\/ul>\n<p>This would create a Project called WasuppAndroid in your workspace, Open up the Wasupp class and replace the onCreate method with the following onCreate() method as shown in listing below. Following shows the complete code listing.<\/p>\n<pre>\r\npackage org.android.samples;\r\n\r\nimport android.app.Activity;\r\n\r\nimport android.os.Bundle;\r\n\r\nimport android.widget.TextView;\r\n\r\npublic class Wasupp extends Activity {\r\n\r\n\/** Called when the activity is first created. *\/\r\n\r\n@Override\r\n\r\npublic void onCreate(Bundle savedInstanceState) {\r\n\r\nsuper.onCreate(savedInstanceState);\r\n\r\nTextView tv = new TextView(this);\r\n\r\ntv.setText(\"Wasupp, Android\");\r\n\r\nsetContentView(tv);\r\n\r\n}\r\n\r\n}\r\n\r\n<\/pre>\n<p>This project would display &#8211; Wasupp, Android on the device when the application is executed. To build the project, select Project -&gt; Clean<\/p>\n<p>To run the WasuppAndroid Android application, click on it and select Run As &gt; Android Application.<\/p>\n<p>On the eclipse console, you would see the following similar message \u2013<\/p>\n<p>[WasuppAndroid] Performing org.andrroid.samples.Wasupp activity launch<\/p>\n<p>[WasuppAndroid] Automatic Target Mode: launching new emulator with compatible AVD &#8216;AVD&#8217;<\/p>\n<p>[WasuppAndroid] Launching a new emulator with Virtual Device &#8216;AVD&#8217;<\/p>\n<p>[WasuppAndroid] Waiting for HOME (&#8216;android.process.acore&#8217;) to be launched&#8230;]<\/p>\n<p>You should see the Android AVD being launched. After the above message, it takes a while (2-3 minutes) for the first time to get the Android home page on the emulator.<\/p>\n<p>After the device is started, you should see the following message on console..<\/p>\n<p>[WasuppAndroid] Uploading WasuppAndroid.apk onto device &#8217;emulator-5554&#8242;<\/p>\n<p>[WasuppAndroid] Installing WasuppAndroid.apk&#8230;<\/p>\n<p>[WasuppAndroid] Success!<\/p>\n<p>[WasuppAndroid] Starting activity org.andrroid.samples.Wasupp on device emulator-5554<\/p>\n<p>If the application doesn\u2019t show up on the emulator, Click on Menu option on the emulator and you would see the Wasupp android application and message being displayed.<\/p>\n<p><a href=\"http:\/\/naveenbalani.com\/wp-content\/uploads\/2011\/01\/Android-Emulator.jpg\"><img loading=\"lazy\" class=\"aligncenter size-full wp-image-1477\" title=\"Android-Emulator\" src=\"http:\/\/naveenbalani.com\/wp-content\/uploads\/2011\/01\/Android-Emulator.jpg\" alt=\"\" width=\"400\" height=\"282\" srcset=\"https:\/\/navveenbalani.dev\/wp-content\/uploads\/2011\/01\/Android-Emulator.jpg 400w, https:\/\/navveenbalani.dev\/wp-content\/uploads\/2011\/01\/Android-Emulator-300x211.jpg 300w\" sizes=\"(max-width: 400px) 100vw, 400px\" \/><\/a><\/p>\n<p>With the environment up and running, in the next blog we will look at how to create Android applications.<\/p>\n<p><strong>Issues faced during running the AVD &#8211;<\/strong><\/p>\n<p>I got the following issue while running the AVD. I was using IBM JDK and had to switch it to Sun JDK to make the emulator work.<\/p>\n<p>&#8220;- WasuppAndroid] Failed to install WasuppAndroid.apk on device &#8217;emulator-5554!<br \/>\n&#8211; WasuppAndroid] (null)<br \/>\n&#8211; Launch canceled!&#8221;<\/p>\n<p>Turning the debug on, I notice the problem seems to be with the keystore classes.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This is ongoing blog on Getting Started with Android. In earlier blog, I provided an architecture overview of android application. In this blog, I would setup the development environment for Android and create a simple hello world application. I would say are two ways you could develop Android applications- The web development way: &#8211; Utilizing [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":1478,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[149,3,10,80,87],"tags":[145,148,260],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v16.0.2 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Getting Started with Android \u2013 Creating Android Application - Current and Future Technology Trends by Navveen Balani<\/title>\n<meta name=\"description\" content=\"Getting Started with Android \u2013 Creating Android Application -\" \/>\n<link rel=\"canonical\" href=\"https:\/\/navveenbalani.dev\/index.php\/articles\/getting-started-with-android-creating-android-application\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Getting Started with Android \u2013 Creating Android Application - Current and Future Technology Trends by Navveen Balani\" \/>\n<meta property=\"og:description\" content=\"Getting Started with Android \u2013 Creating Android Application -\" \/>\n<meta property=\"og:url\" content=\"https:\/\/navveenbalani.dev\/index.php\/articles\/getting-started-with-android-creating-android-application\/\" \/>\n<meta property=\"og:site_name\" content=\"Current and Future Technology Trends by Navveen Balani\" \/>\n<meta property=\"article:published_time\" content=\"2011-01-20T14:31:48+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2017-03-24T12:25:26+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/navveenbalani.dev\/wp-content\/uploads\/2011\/01\/AndroidHome.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"130\" \/>\n\t<meta property=\"og:image:height\" content=\"180\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\">\n\t<meta name=\"twitter:data1\" content=\"5 minutes\">\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebSite\",\"@id\":\"https:\/\/navveenbalani.dev\/#website\",\"url\":\"https:\/\/navveenbalani.dev\/\",\"name\":\"Current and Future Technology Trends by Navveen Balani\",\"description\":\"Current and Future Technology Trends by Navveen Balani\",\"publisher\":{\"@id\":\"https:\/\/navveenbalani.dev\/#\/schema\/person\/51f7ab14b20611d95e3c7fd4ea0950bf\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":\"https:\/\/navveenbalani.dev\/?s={search_term_string}\",\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"ImageObject\",\"@id\":\"https:\/\/navveenbalani.dev\/index.php\/articles\/getting-started-with-android-creating-android-application\/#primaryimage\",\"inLanguage\":\"en-US\",\"url\":\"https:\/\/navveenbalani.dev\/wp-content\/uploads\/2011\/01\/AndroidHome.jpg\",\"width\":\"130\",\"height\":\"180\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/navveenbalani.dev\/index.php\/articles\/getting-started-with-android-creating-android-application\/#webpage\",\"url\":\"https:\/\/navveenbalani.dev\/index.php\/articles\/getting-started-with-android-creating-android-application\/\",\"name\":\"Getting Started with Android \\u2013 Creating Android Application - Current and Future Technology Trends by Navveen Balani\",\"isPartOf\":{\"@id\":\"https:\/\/navveenbalani.dev\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/navveenbalani.dev\/index.php\/articles\/getting-started-with-android-creating-android-application\/#primaryimage\"},\"datePublished\":\"2011-01-20T14:31:48+00:00\",\"dateModified\":\"2017-03-24T12:25:26+00:00\",\"description\":\"Getting Started with Android \\u2013 Creating Android Application -\",\"breadcrumb\":{\"@id\":\"https:\/\/navveenbalani.dev\/index.php\/articles\/getting-started-with-android-creating-android-application\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/navveenbalani.dev\/index.php\/articles\/getting-started-with-android-creating-android-application\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/navveenbalani.dev\/index.php\/articles\/getting-started-with-android-creating-android-application\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"item\":{\"@type\":\"WebPage\",\"@id\":\"https:\/\/navveenbalani.dev\/\",\"url\":\"https:\/\/navveenbalani.dev\/\",\"name\":\"Home\"}},{\"@type\":\"ListItem\",\"position\":2,\"item\":{\"@type\":\"WebPage\",\"@id\":\"https:\/\/navveenbalani.dev\/index.php\/articles\/getting-started-with-android-creating-android-application\/\",\"url\":\"https:\/\/navveenbalani.dev\/index.php\/articles\/getting-started-with-android-creating-android-application\/\",\"name\":\"Getting Started with Android \\u2013 Creating Android Application\"}}]},{\"@type\":\"Article\",\"@id\":\"https:\/\/navveenbalani.dev\/index.php\/articles\/getting-started-with-android-creating-android-application\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/navveenbalani.dev\/index.php\/articles\/getting-started-with-android-creating-android-application\/#webpage\"},\"author\":{\"@id\":\"https:\/\/navveenbalani.dev\/#\/schema\/person\/51f7ab14b20611d95e3c7fd4ea0950bf\"},\"headline\":\"Getting Started with Android \\u2013 Creating Android Application\",\"datePublished\":\"2011-01-20T14:31:48+00:00\",\"dateModified\":\"2017-03-24T12:25:26+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/navveenbalani.dev\/index.php\/articles\/getting-started-with-android-creating-android-application\/#webpage\"},\"commentCount\":12,\"publisher\":{\"@id\":\"https:\/\/navveenbalani.dev\/#\/schema\/person\/51f7ab14b20611d95e3c7fd4ea0950bf\"},\"image\":{\"@id\":\"https:\/\/navveenbalani.dev\/index.php\/articles\/getting-started-with-android-creating-android-application\/#primaryimage\"},\"keywords\":\"android,hello world android sample,Mobile Computing\",\"articleSection\":\"Android,Articles,Featured,Mobile Computing,Upcoming technology trends and reviews\",\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\/\/navveenbalani.dev\/#\/schema\/person\/51f7ab14b20611d95e3c7fd4ea0950bf\",\"name\":\"Navveen\",\"image\":{\"@type\":\"ImageObject\",\"@id\":\"https:\/\/navveenbalani.dev\/#personlogo\",\"inLanguage\":\"en-US\",\"url\":\"https:\/\/navveenbalani.dev\/wp-content\/uploads\/2019\/07\/navveen_balani.jpeg\",\"width\":200,\"height\":200,\"caption\":\"Navveen\"},\"logo\":{\"@id\":\"https:\/\/navveenbalani.dev\/#personlogo\"},\"sameAs\":[\"http:\/\/naveenbalani.com\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","_links":{"self":[{"href":"https:\/\/navveenbalani.dev\/index.php\/wp-json\/wp\/v2\/posts\/1473"}],"collection":[{"href":"https:\/\/navveenbalani.dev\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/navveenbalani.dev\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/navveenbalani.dev\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/navveenbalani.dev\/index.php\/wp-json\/wp\/v2\/comments?post=1473"}],"version-history":[{"count":24,"href":"https:\/\/navveenbalani.dev\/index.php\/wp-json\/wp\/v2\/posts\/1473\/revisions"}],"predecessor-version":[{"id":2381,"href":"https:\/\/navveenbalani.dev\/index.php\/wp-json\/wp\/v2\/posts\/1473\/revisions\/2381"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/navveenbalani.dev\/index.php\/wp-json\/wp\/v2\/media\/1478"}],"wp:attachment":[{"href":"https:\/\/navveenbalani.dev\/index.php\/wp-json\/wp\/v2\/media?parent=1473"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/navveenbalani.dev\/index.php\/wp-json\/wp\/v2\/categories?post=1473"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/navveenbalani.dev\/index.php\/wp-json\/wp\/v2\/tags?post=1473"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}