Saturday, October 12, 2013

How I Set Up My Windows 8 System for Android Development

I MAY HAVE GIVEN THE IMPRESSION THAT I'M ONLY ABOUT IOS DEVELOPMENT, BUT ANDROID DEVELOPMENT IS ALSO IN MY SIGHTS AS WELL. One of the reasons was to get learn how to write Android apps, an undertaking that's been delayed by life, work, and all sorts of nonsense from which I expect to free myself really soon.



I recently got around to setting up my systems for Android development, with a Lenovo laptop computer running Windows 8 as the development machine, and my S III as the testing device. I took screenshots along the way, and have put together this little bit of documentation in the hope that someone out there will find it useful.




PART 1: INSTALL SAMSUNG'S ANDROID USB DRIVERS FOR WINDOWS



If you're using Windows to develop Android apps and plan to use Samsung devices while developing, the first thing you should do is get the installer for Samsung's Android USB drivers for Windows. Point your browser at the charmingly misspelled :



Download the SAMSUNGUSBDRIVERFORMOBILEPHONES.ZIP and unzip it. Run the enclosed installer; you should see this:



Click NEXT:



Choose the appropriate language and country for you. I went with the plain and simple "US English / United States of America", then click NEXT. You'll see this:



In most cases, the default installation location of C:Program FilesSAMSUNGUSB Drivers should work. Click INSTALL to start the installation process, where you'll see



which will then be followed by



Click EXIT, and the first part of the Android development setup will be done.



PART 2: INSTALL ORACLE'S JAVA SE DEVELOPMENT KIT



Now that the drivers have been installed, it's time to install a JDK. Go to the :



Scroll down to the JAVA SE DEVELOPMENT KIT 7U40 table, where the JDKs for supported platforms are listed:



In order download the Java SE Development Kit, you have to sell your soul to Oracle and accept Larry Ellison as your Dark Master. Do this by clicking the ACCEPT LICENSE AGREEMENT radio button. The table's appearance will change slightly



after which you can choose the JDK to download. I'm running the 64-bit version of Windows 8.1 RC (I like to live a little dangerously), so I downloaded the Windows x64 installer.



Once the installer is downloaded, run it. You should see this window:



Click NEXT:



The default setting, which installs all the development tools and source code, is good one. Just go with it and click NEXT. Installation will begin you'll see this:



After which you'll see this:



The installation process is now complete; click the CLOSE button.



Java is now installed on your system, but your system doesn't necessarily know where to find Java. It's time to edit the PATH environment variable. Go to explorer and right-click on the THIS PC icon (on pre-8.1 Windows systems, it's called COMPUTER, and on Windows 7 and earlier, it's MY COMPUTER), and select the PROPERTIES item from the menu that appears:



This window (or one similar to it) will appear:



In the list of items along the left side of the window, click on ADVANCED SYSTEM SETTINGS. You'll be shown the SYSTEM PROPERTIES dialog box:



Click the ENVIRONMENT VARIABLESbutton, and you'll be shown the ENVIRONMENT VARIABLES dialog box:



We want to edit your system's PATH variable, so select the PATH item in the SYSTEM VARIABLES list and click the EDITbutton



We want to add C:Program FilesJavajre7bin to Path. Do this by adding the following to the end of the contents of the VARIABLE VALUE text field:



;C:Program FilesJavajre7bin



Click OK, which will take you back to the ENVIRONMENT VARIABLES window:



At this point, you can dismiss all the other windows that you opened in the process of setting the PATH variable.



There's only one more application to retrieve



PART 3: INSTALL ADT -- ANDROID DEVELOPER TOOLS



Go to the :



Click on the DOWNLOAD THE SDK button, which will take you to this page:



Check the I HAVE READ AND AGREE WITH THE ABOVE TERMS AND CONDITIONS checkbox, which declares your soul the property of Larry and Sergei forever, and then:



* If you downloaded and installed the 32-bit (x86) version of the Java development kit, choose the 32-bit version of ADT.

* If you downloaded and installed the 64-bit (x64) version of the Java development kit, choose the 64-bit version of ADT.



Make sure you've chosen the correct version of ADT; the 32-bit ADT will not work with 64-bit Java, and the 64-bit version of ADT will not work with 32-bit Java!



Click the DOWNLOAD THE SDK ADT BUNDLE FOR WINDOWS button, which will start the download process of a .zip file. The .zip file I got had the filename ADT-BUNDLE-WINDOWS-X8664-20130917.ZIP; yours should have a similar one. The .zip file will contain a single folder with the same name as the .zip file, minus the .ZIP filename extension:



Unlike most Windows applications, ADT doesn't have to be installed using an installer. You simply unzip it, and it's ready to run. I renamed my ADT folder to simply just ADT and put it into the PROGRAM FILES directory. You don't have to do this, but it keeps things consistent.



PART 4: CONFIRM EVERYTHING WORKS BY BUILDING "HELLO WORLD"



You'll be using the Eclipse IDE to write and compile Android apps. Eclipse is in the ADT folder's ECLIPSE directory:



Open the ECLIPSE directory and double-click ECLIPSE.EXE to start Eclipse:



You'll see this splash screen:



Followed by this dialog box, asking where your Android projects should be stored. I went with the default, which is typically USERSYOUR LOGIN NAMEWORKSPACE:



I checked USE THIS AS THE DEFAULT AND DO NOT ASK AGAIN and then clicked OK, after which this was displayed:



Once ADT has fully loaded, you should see a window that looks like this:



Let's build a quick and dirty application. Click the NEW ANDROID APPLICATIONbutton that appears below the "Welcome!" message. This will open the NEW ANDROID APPLICATION dialog box:



Enter HELLO WORLD into the APPLICATION NAME text box. The PROJECT NAME and PACKAGE NAME text boxes will fill themselves in appropriately as you type. Then click the NEXT button. You'll be taken to the next step:



The defaults work for what we want to do, so just click the NEXT button. You'll be taken to this window:



This window lets you define the icon for your app. The default "Android" icon works just fine, so click NEXT. You'll be taken to this window:



The simplest way to describe an Android activity is "a 'screen' presented to the user". Android developers who are a little more pedantic might disagree, but for now, it's a good enough explanation. Make sure that CREATE ACTIVITY is checked and that BLANK ACTIVITY is selected in the list, then click the Next button. You'll be led to one more setup window:



For the purposes of this quick-and-dirty app, the defaults are fine. Click the FINISH button to conclude this setting-up phase, and you'll be taken to the ADT IDE's main window:



If you haven't done so already, connect your Android mobile device to the computer with a USB cable.



Let's run our newly-created app to see if it works. from the menu bar, open the RUN menu and choose the RUN item:



You'll be shown this window:



Make sure ANDROID APPLICATION is selected, then click the OK button. You'll be taken to the ANDROID DEVICE CHOOSER:



With my Samsung Galaxy S III plugged in, it showed up in the CHOOSE A RUNNING ANDROID DEVICE list as SAMSUNG-SGHI747M-4908D022. If you successfully installed the drivers for your device, it should appear in the list. Select your device and click the OK button. If everything's working, you should see the following on your device's screen after a moment or two:



Success! You've now got a working Android developer setup.
Full Post

No comments:

Post a Comment