Difference between revisions of "Installing Android SDK"

From Notes_Wiki
(Created page with "<yambe:breadcrumb>Android|Android</yambe:breadcrumb> =Installing Android SDK= To install android SDK use following steps: #Install i686 versions of libstdc++, libncurses and ...")
 
m
Line 7: Line 7:
#Go to tools directory
#Go to tools directory
#Run ./android and install 'Android SDK Platform-tools'.  Also install APIs for desired Android version.
#Run ./android and install 'Android SDK Platform-tools'.  Also install APIs for desired Android version.
#Go to platform-tools directory
#Try to run adb, aapt, etc. and ensure that all work without giving missing library error




Line 19: Line 21:
#Allow eclipse to restart
#Allow eclipse to restart
#Select andriod sdk is already installed and supply /opt as path
#Select andriod sdk is already installed and supply /opt as path
=Create Android virtual device=
#Start Eclipse
#Choose 'Window' -> Android Virtual Device Manager
#Click "New"
#Choose Device as '3.2" QVGA (ADP2) (320x480:mdpi)' or something similar.  The main point is to start with device with low resolution / screen size for initial testing.
#Choose Target as "Android 2.2 - API Level 8".  Choosing lesser version would allow simulator to boot / run faster.
#Enter AVD Name as "Android2.2" or something similar
#Leave other things to default
#Configure SD card storage as 1000MB
#Click Ok to create device
#Select the device and click start to launch emulator for created device.  In the second pop-up click "Launch".  Avoid closing the emulator till all work is done as it takes a while to boot.
=Run HelloWorld application to test setup=
==Run HelloWorld application on emulator==
#Start Eclipse
#Choose 'Window' -> Android Virtual Device Manager
#Select the device and click start to launch emulator for created device.  In the second pop-up click "Launch".  Avoid closing the emulator till all work is done as it takes a while to boot.
#In Eclipse choose 'File' -> "New" -> "Android Application Project"
#Give Application name as "My First App"
#Leave other options / values as it is and click next
#Choose some scratch/temp location for program location so that it can be deleted later on
#Untick custom launcher icon
#Click next
#Choose "Blank Activity" and click next
#Leave Acitivity Name, Layout Name, etc. to default values and click Finish
#Through "Package Explorer" go to "src -> com.example.myfirstapp -> MainActivity.java".  If "Package Explorer" is not visible then choose "Window -> Show View -> Package Explorer" to make package explorer appear and then go to MainActivity.java
#In Eclipse choose "Run" -> "Run".  Then choose "Android Application" and click ok.  If there are more than one devices available for running the application choose the emulated device for now.
#The application should get installed and executed on emulated device automatically in few seconds.
==Run Hello World application on actual device==
#Enable "USB debugging", "Stay awake", etc. options on phone
#Connect the phone through USB to computer.
#Open a root terminal
#Go to platform-tools folder inside SDK folder
#Run '<tt>./adb shell</tt>'.  If permission denied error message is displayed then use:
#:<pre>
#::./adb kill-server
#::./adb start-server
#:</pre>
#:Now again try '<tt>./adb shell</tt>' and it should work.
#Exit from adb shell using "exit"
#Start Eclipse
#Create a "My first app" project as explained in detail in "Run HelloWorld application on emulator" sub-section above
#Choose "Run" -> "Run".  Then choose "Android Application", if prompted and click ok.  If more than one devices are available then choose actual phone/device on which you want to install and test application.
#The application should get installed and executed on connected phone / tablet automatically.
<yambe:breadcrumb>Android|Android</yambe:breadcrumb>

Revision as of 15:20, 2 March 2013

<yambe:breadcrumb>Android|Android</yambe:breadcrumb>

Installing Android SDK

To install android SDK use following steps:

  1. Install i686 versions of libstdc++, libncurses and zlib using 'yum -y install libncurses.i686 libstdc++.i686 zlib.i686'
  2. Download and decompress the latest Android SDK. You can unpack it in any directory of your choice, for example /opt.
  3. Go to tools directory
  4. Run ./android and install 'Android SDK Platform-tools'. Also install APIs for desired Android version.
  5. Go to platform-tools directory
  6. Try to run adb, aapt, etc. and ensure that all work without giving missing library error


Installing Andriod Development Tools in Eclipse

  1. Start Eclipse
  2. Choose 'Help -> Install new software'
  3. Use 'Android', 'https://dl-ssl.google.com/android/eclipse/'
  4. Click on Available software sites and enable
  5. Complete the installation
  6. Allow eclipse to restart
  7. Select andriod sdk is already installed and supply /opt as path


Create Android virtual device

  1. Start Eclipse
  2. Choose 'Window' -> Android Virtual Device Manager
  3. Click "New"
  4. Choose Device as '3.2" QVGA (ADP2) (320x480:mdpi)' or something similar. The main point is to start with device with low resolution / screen size for initial testing.
  5. Choose Target as "Android 2.2 - API Level 8". Choosing lesser version would allow simulator to boot / run faster.
  6. Enter AVD Name as "Android2.2" or something similar
  7. Leave other things to default
  8. Configure SD card storage as 1000MB
  9. Click Ok to create device
  10. Select the device and click start to launch emulator for created device. In the second pop-up click "Launch". Avoid closing the emulator till all work is done as it takes a while to boot.


Run HelloWorld application to test setup

Run HelloWorld application on emulator

  1. Start Eclipse
  2. Choose 'Window' -> Android Virtual Device Manager
  3. Select the device and click start to launch emulator for created device. In the second pop-up click "Launch". Avoid closing the emulator till all work is done as it takes a while to boot.
  4. In Eclipse choose 'File' -> "New" -> "Android Application Project"
  5. Give Application name as "My First App"
  6. Leave other options / values as it is and click next
  7. Choose some scratch/temp location for program location so that it can be deleted later on
  8. Untick custom launcher icon
  9. Click next
  10. Choose "Blank Activity" and click next
  11. Leave Acitivity Name, Layout Name, etc. to default values and click Finish
  12. Through "Package Explorer" go to "src -> com.example.myfirstapp -> MainActivity.java". If "Package Explorer" is not visible then choose "Window -> Show View -> Package Explorer" to make package explorer appear and then go to MainActivity.java
  13. In Eclipse choose "Run" -> "Run". Then choose "Android Application" and click ok. If there are more than one devices available for running the application choose the emulated device for now.
  14. The application should get installed and executed on emulated device automatically in few seconds.


Run Hello World application on actual device

  1. Enable "USB debugging", "Stay awake", etc. options on phone
  2. Connect the phone through USB to computer.
  3. Open a root terminal
  4. Go to platform-tools folder inside SDK folder
  5. Run './adb shell'. If permission denied error message is displayed then use:
    ./adb kill-server
    ./adb start-server
    Now again try './adb shell' and it should work.
  6. Exit from adb shell using "exit"
  7. Start Eclipse
  8. Create a "My first app" project as explained in detail in "Run HelloWorld application on emulator" sub-section above
  9. Choose "Run" -> "Run". Then choose "Android Application", if prompted and click ok. If more than one devices are available then choose actual phone/device on which you want to install and test application.
  10. The application should get installed and executed on connected phone / tablet automatically.


<yambe:breadcrumb>Android|Android</yambe:breadcrumb>