Saturday, May 20, 2017

Android SDK on Linux Mint 13 Maya

Android SDK on Linux Mint 13 Maya


In my previous blogs, I showed how to install various flavors of Java on Linux Mint 13 - both 32 and 64 bits versions. Now I will show how to install and configure the Google Android SDK to be used together with Java, for Android software development.

  1. First head over to:

      http://developer.android.com/sdk/index.html

    and download the latest (as of July 2012) file:

    android-sdk_r20-linux.tgz

    IMPORTANT NOTE:
    If you are using 64-bit Linux Mint 13 you MUST download and install the ia32-libs package since the Android SDK is a 32-bit application and requires the 32 bit library to operate properly. To download and install, open a terminal and execute:
       sudo apt-get install ia32-libs

  2. Start a terminal and unzip the downloaded file:

    tar xvf ~/Downloads/android-sdk_r20-linux.tgz

    This will create a new directory android-sdk-linux in your home directory containing all the unzipped files. Why the home directory? The simple answer is to avoid file permission problems. Note that by installing the SDK in the home directory, only the current user can access it - so security is guaranteed.

    If, however, you want the SDK to be accessed by other users, then you may have to install it somewhere else - perhaps the /opt directory. This article will not describe how to do that - it just assumes that the current user is the only one that can access the SDK.

  3. Change directory and execute the android SDK:

    cd android-sdk-linux/tools
    ./android

    TIP: You can set the PATH environment to point to your Android SDK tools directory so that you can start the android program anywhere. Edit the .profile file in your home directory and add the following lines to the end of the file:

      # set PATH so it includes users Android SDK if it exists
      if [ -d "$HOME/android-sdk-linux" ] ; then
          PATH="$HOME/android-sdk-linux:$HOME/android-sdk-linux/tools:$PATH"
      fi

    This will only take effect on the next logout/login or restart.

    The SDK Manager will start as shown in the screenshot below.



    Notice the progress bar at the bottom of the screen - this indicates that the SDK Manager is querying for updates from Google. Wait this is finished - you will then notice that it automatically selects a set of recommended packages. However it seems to have missed the Android SDK Platform-tools which, according to Google, is required when you install the SDK for the first time. So place a check mark on that item by clicking in the check-box. Also de-select the item Google APIs since this can only be downloaded and installed AFTER all the rest of the marked item has been installed. The final screen will look like the one shown below.



  4. Click on the Install 6 packages button - a window will pop up (shown below) listing all the packages to be installed. Notice that the Accept radio button is selected - so just press the Install button to start the process of downloading and installing the packages. The progress bar at the bottom indicates the status of this process. Also a log screen may appear if there are problems during install - ignore the Stopping ADB server failed (code -1) message if it appears on the log - this seems to be harmless.



    When install is complete, close the log windows (if open) and then place a tick mark on the Google APIs item and press the Install 1 package button. When the package list appears, press Accept, then the Install button, and then wait until this package is installed. Thats it - you have installed the recommended (and latest) Android packages necessary for software development. As of July 2012 this is Android 4.1(API 16) - codenamed Jelly Baby. Is it necessary to install all the other packages (API 3 to 15)? This is entirely up to you - if you really need to develop software only for an Android version, then, by all means download and install it using the SDK Manager.

  5. Now we need to set up at least one AVD (Android Virtual Device) on which you can test your developed software. The AVD is an emulator which emulates the ARM processor. To set up the AVD we need to invoke the AVD Manager which is part of the SDK Manager. Click on Tools (in the menu bar) and then click on the Manage AVDs... item. You will the screen as shown below.



  6. Click on the New button - a new window will pop-up (see below). Give the new AVD a name - for example MyJellyBaby. Select Android 4.1 - API Level 16 as the target for the AVD.

    Then enter the size of the SD card - I use 128 MiB which should be sufficient for testing. Leave the rest at default except for the Device ram size under hardware. To make the AVD load a bit faster and if you have at least 4GB of system RAM, change the size to 768 by clicking on the default 512 and changing it to 768.

    Next to make the emulator perform even faster, enable GPU emulation by clicking the New... button and then click on the double arrow on the Property: button and select GPU emulation from the list. Then click on the value item and change it to yes.

    The final screen will look like the one shown below. Then click on the Create AVD button.If there are no errors, you will see a screen like the one below. Press OK - the AVD list will then show the new AVD - MyJellyBaby in this case (see figure).







  7. To start the AVD, first select it on the list, then click the Start button - a window will pop-up (see below). You can set the display size and wipe the user data from here if you wish - then click on the Launch button. You will see a Starting Android Emulator screen (see below) and then the emulator will start loading as shown. Note the flashing Android sign while the emulator is loading.







  8. While the emulator is loading (may take time depending on the RAM size set and the speed of your system CPU and GPU), a thank-you windows from Google will pop-up (see below) - if you wish you can agree to send usage statistic to Google - then click on Proceed to dismiss the window.



    After a while the Android 4.1 JellyBaby emulator will appear (see below). The emulators screen is blank except for 3 notifications on the top right-hand screen. To start the emulator for the first time, click the power button on the right side (above the keyboard) to switch off and then click on it again to power on. The login screen will appear (see below) - slide (using the mouse) to unlock the device. The Home help screen will appear (see below) - click on OK on the help screen and the actual Home screen will be shown (see below).









  9. You can play with the emulator at this stage - close the main window when done. Then close the Starting Android Emulator screen. To dismiss the AVD list, press the Esc key and you will be beck at the Android SDK Manager window. Close it if you wish.
Thats it - you now have a working Android SDK and you are now almost ready to start developing Android software on your Linux Mint 13. The next blog will describe installing Eclipse - a programming environment for developing Java programs - and with the help of several Google plugins for Eclipse - a programming environment for developing Android programs as well.
get
 

Copyright © Video game tester Design by Free CSS Templates | Blogger Theme by BTDesigner | Powered by Blogger