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 |
||
(10 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
[[Main_Page|Home]] > [[Android]] > [[Installing Android SDK|Installing Android SDK]] | |||
To install android SDK use following steps: | To install android SDK use following steps: | ||
#Install i686 versions of libstdc++, libncurses and zlib using '<tt>yum -y install | #Install i686 versions of libstdc++, libncurses and zlib using '<tt>yum -y install ncurses-devel.i686 libstdc++.i686 zlib.i686</tt>' | ||
#Download | #Download latest Android SDK from https://developer.android.com/sdk/index.html | ||
#Go to tools directory | #Decompress the latest Android SDK in any directory of your choice, for example /opt. | ||
#Run ./android and install 'Android SDK Platform-tools'. Also install APIs for desired Android version. | #Go to tools directory inside extracted SDK | ||
#Run ./android and install 'Android SDK Platform-tools'. Also install APIs for desired Android version. It is advisable to install APIs for Android 2.2 which is most common android version in use and supported by all later versions. | |||
#Go to platform-tools directory | |||
#Try to run adb and ensure that it works without giving missing library error | |||
=Installing Andriod Development Tools in Eclipse= | =Installing Andriod Development Tools in Eclipse= | ||
'''If you have downloaded and installed adt bundle then you can run eclipse bundled with adt from eclipse folder without requiring to follow the below steps.''' | |||
#Start Eclipse | #Start Eclipse | ||
#Choose 'Help -> Install new software' | #Choose 'Help -> Install new software' | ||
#Use 'Android', 'https://dl-ssl.google.com/android/eclipse/' | #Use 'Android', 'https://dl-ssl.google.com/android/eclipse/' | ||
#Click on Available software sites and enable | #Click on Available software sites and enable | ||
#*"Eclipse Project Test Site" http://download.eclipse.org/eclipse/updates/3.6 | #*"Eclipse Project Test Site" http://download.eclipse.org/eclipse/updates/<version> version ex 3.6, 4.0, etc. | ||
#*Helios Milestone Repository http://download.eclipse.org/releases/helios | #*Helios Milestone Repository http://download.eclipse.org/releases/<codename> codename ex helios, juno, etc. | ||
#Complete the installation | #Complete the installation | ||
#Allow eclipse to restart | #Allow eclipse to restart | ||
# | #If asked for android sdk path, select andriod sdk is already installed and supply /opt/android/sdk as path | ||
=Create Android virtual device= | |||
#Go to /opt/android/sdk/tools and start ./android | |||
#Use Tools -> Manage AVDs | |||
#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== | |||
#Go to /opt/android/sdk/tools and start ./android | |||
#Use Tools -> Manage AVDs | |||
#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. | |||
#Start Eclipse | |||
#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. | |||
[[Main_Page|Home]] > [[Android]] > [[Installing Android SDK|Installing Android SDK]] |
Latest revision as of 13:55, 7 April 2022
Home > Android > Installing Android SDK
To install android SDK use following steps:
- Install i686 versions of libstdc++, libncurses and zlib using 'yum -y install ncurses-devel.i686 libstdc++.i686 zlib.i686'
- Download latest Android SDK from https://developer.android.com/sdk/index.html
- Decompress the latest Android SDK in any directory of your choice, for example /opt.
- Go to tools directory inside extracted SDK
- Run ./android and install 'Android SDK Platform-tools'. Also install APIs for desired Android version. It is advisable to install APIs for Android 2.2 which is most common android version in use and supported by all later versions.
- Go to platform-tools directory
- Try to run adb and ensure that it works without giving missing library error
Installing Andriod Development Tools in Eclipse
If you have downloaded and installed adt bundle then you can run eclipse bundled with adt from eclipse folder without requiring to follow the below steps.
- Start Eclipse
- Choose 'Help -> Install new software'
- Use 'Android', 'https://dl-ssl.google.com/android/eclipse/'
- Click on Available software sites and enable
- "Eclipse Project Test Site" http://download.eclipse.org/eclipse/updates/<version> version ex 3.6, 4.0, etc.
- Helios Milestone Repository http://download.eclipse.org/releases/<codename> codename ex helios, juno, etc.
- Complete the installation
- Allow eclipse to restart
- If asked for android sdk path, select andriod sdk is already installed and supply /opt/android/sdk as path
Create Android virtual device
- Go to /opt/android/sdk/tools and start ./android
- Use Tools -> Manage AVDs
- 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
- Go to /opt/android/sdk/tools and start ./android
- Use Tools -> Manage AVDs
- 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.
- Start Eclipse
- 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 './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.
- 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.