[GUIDE] How To Install and Use Android SDK

6,587 posts
Thanks Meter: 3,609
By Apex, Senior Member on 20th August 2012, 05:15 AM
Post Reply Email Thread
*If you find this Guide Thread helpful, feel free to hit the "thanks" button below!
What is Android SDK?

Everyone wants to program on Android; unfortunately, not everyone knows quite how to get started with their development environment. Google has put out both the Android SDK and the Android ADT in order to help developers integrate Android into their dev environment as well as facilitate more Android development. In this guide, we’ll take a look at how to set up a development environment for Android so you can start creating projects. Android SDK and Android ADT are essentials that you will need to include in your Android Developer Toolbox for use with many things, and can be a very powerful set of components from the simple, to the complicated. When it comes to Android modding, most novice users are confused or left wondering by reference over reference to a certain “adb”. This is specially true when you are looking up something on modding your device, or root it in particular. ADB is the wonder toy of Android and everyone seems to love it, so lets have a look at understanding what it is and why you need it, and how you can get it.
What is ADT?

ADT (Android Developer Tools) is a plugin for Eclipse that provides a suite of tools that are integrated with the Eclipse IDE. It offers you access to many features that help you develop Android applications quickly. ADT provides GUI access to many of the command line SDK tools as well as a UI design tool for rapid prototyping, designing, and building of your application's user interface. Because ADT is a plugin for Eclipse, you get the functionality of a well-established IDE, along with Android-specific features that are bundled with ADT. The following describes important features of Eclipse and ADT:

Integrated Android project creation, building, packaging, installation, and debugging
  • ADT integrates many development workflow tasks into Eclipse, making it easy for you to rapidly develop and test your Android applications.
SDK Tools integration
  • Many of the SDK tools are integrated into Eclipse's menus, perspectives, or as a part of background processes ran by ADT.
Java programming language and XML editors
  • The Java programming language editor contains common IDE features such as compile time syntax checking, auto-completion, and integrated documentation for the Android framework APIs. ADT also provides custom XML editors that let you edit Android-specific XML files in a form-based UI. A graphical layout editor lets you design user interfaces with a drag and drop interface.
  • Integrated documentation for Android framework APIs
You can access documentation by hovering over classes, methods, or variables.
What is ADB?

ADB stands for Android Debug Bridge. It comes as a part of the standard Android SDK, which you can grab here in this guide. Basically, it provides a terminal-based interface for interacting with your phone’s file system. Since Android platform is based on Linux, command-line is sometimes the only way to obtain and manipulate root access often required to perform certain advanced operations on your device using root access. While these things can be done directly on the device itself using some terminal emulator, it will be rather difficult to execute complex commands on such a small screen. ADB provides the bridge between your machine and your computer.
Preface: Dev Environment Notes:

Just a general rule to reduce headaches, if you're serious about Android development, your development machine should primarily be a development machine, as installation of other various programs may clutter it up and produce unexpected errors or other bizarre happenings. While this is rare, it’s not uncommon, and an exclusive development machine is recommended. If an extra machine is not available, a virtual machine used as a development machine works very well also. If this isn't an option either, you can always install Ubuntu 12.04 on your Windows PC and select whichever operating system you'd like at boot/reboot. The latter is my setup, since I run Windows 7 primarily, and Ubuntu for selected other functions -namely Android SDK. It's all your preference here, but keep in mind that if you start getting too deep in the rabbit hole with your Android development, you may want to consider a dedicated dev machine, or re-partition your Ubuntu setup to allow for more capabilities within it.
Step 1: Install the JDK

Most of you probably have the Java JRE installed, but Android requires the JDK “Java Development Kit” to compile Java programs. The JDK is available on Oracle’s Java webpage. Install the version of the JDK appropriate for your OS; the Java EE 6 bundle is recommended, but you can install any bundle you like so long as it contains the JDK.

(Getting started on Ubuntu, see THIS PAGE)

Getting started on Windows:

Your download package is an executable file that starts an installer. The installer checks your machine for required tools, such as the proper Java SE Development Kit (JDK) and installs it if necessary. The installer then saves the Android SDK Tools into a default location (or you can specify the location). Make a note of the name and location of the SDK directory on your system—you will need to refer to the SDK directory later, when setting up the ADT plugin and when using the SDK tools from the command line. Once the tools are installed, the installer offers to start the Android SDK Manager. Start it and continue with the installation guide by clicking the Next link on the right. The Android SDK requires JDK version 5 or version 6. If you already have one of those installed, skip to the next step. In particular, Mac OS X comes with the JDK version 5 already installed, and many Linux distributions include a JDK. If the JDK is not installed, go to http://java.sun.com/javase/downloads and you'll see a list of Java products to download.

Linux users: Many Linux distributions come with an open source variant of the JDK, like OpenJDK or IcedTea. While you may be tempted to use these in support of open-source or for whatever reason, for maximum compatibility install the official Oracle JDK. You may choose to ignore this warning, but you may end up encountering obscure, strange errors because of it; if you do, most likely it’s some minor difference in the two JDKs.
Step 2: Install Your IDE of Choice

You can by all means code straight up in Emacs or Vi; if you prefer doing that, this guide is not for you. For the rest of us, install a Java IDE; Eclipse is recommended as it is the IDE that the Android developers use and the IDE with official plugin support from Google. The rest of this guide will assume Eclipse is the IDE you’re using, but NetBeans has Android plugin support for it as well. When you download Eclipse, make sure to download Eclipse Classic or Eclipse for Java EE developers; there are quite a few flavors of Eclipse for download on their page, and you don’t want to end up with the C++ or PHP versions of Eclipse.

Obtain Eclipse

These alternatives may be available to obtain a copy of Eclipse for installation:
  • Download a current stable build of Eclipse from the Eclipse Web Site; note that the installation file is large (over 120 MB)
  • For the recommended package to download and install, click the link Eclipse IDE for Java EE Developers on the Eclipse Packages page. For the reason why this is the recommendation, see the following bullets:
  • There are a number of downloadable packages available, each a different "flavor" of Eclipse, which can be compared and contrasted from the Compared Eclipse Packages page. The recommended Eclipse package is the Eclipse IDE for Java EE Developers. This recommendation is made for those who develop in other languages / on other platforms as well, for the following reasons:
  • The "slimmer" Eclipse IDE for Java Developers lacks data tools, testing support, and parts of the Web Standard Tookit useful to all Java web application developers
  • The Eclipse Classic seems like it ought to be "slimmer" but in fact it is a larger download than the JEE package. Downloading and installing this package, then picking and choosing among additional packages described on the Eclipse Classic page is a viable alternative, but requires each developer to spend time researching the contents and utility of the multiple options.

Install Eclipse

There is no installer (executable program) used to install Eclipse. The process described below involves un-archiving (unzipping) a directory tree of files and placing it in an appropriate location on your hard disk. It is very strongly recommended that you locate the eclipse\ directory at the root of your computer's hard drive; or, minimally, on a directory path with no spaces in its name (e.g., C:\mystuff\eclipse\. It is worth noting that Eclipse does not write entries to the Windows registry; therefore, you can simply delete (or move) the installed files, shortcuts, and/or the workspace: there is no executable uninstaller either.
  • Unzip (or copy/unjar/check-out) the software into an appropriate location on your hard disk (e.g., C:\eclipse).
  • These instructions are written assuming that you are running eclipse from C:\eclipse; if you are using a different path, adjust accordingly.
  • Once the unzipped (copied/unjarred/checked-out) files are located on your filesystem, get started using Eclipse:
  • Run Eclipse by running C:\eclipse\eclipse.exe
  • The first time you run Eclipse, you will be prompted to identify a location for your Eclipse workspace. This is where local copies of your projects (files you check in and/or out of code repositories) will live on your file system. Do not create the workspace in a directory path that has spaces in it - i.e., not in the default C:\Documents and Settings\... directory presented by default on the first startup of Eclipse. Instead, it is recommended that your workspace be located at the root of your machine's hard disk, e.g., C:\workspace.
  • It is advisable to pass JVM arguments to Eclipse at startup to reserve a larger memory space for the IDE than the default. To, specify recommended JVM arguments, create a shortcut (probably on your desktop) with the following target (modified if you're using different directories):

C:\eclipse\eclipse.exe -jvmargs -Xms128m -Xmx512m -XX:MaxPermSize=128m
Step 3: Install the Android SDK

Now it’s time to install the Android SDK. You can grab it from the Android Developer website at:
Download the installer for your particular operating system, and open it up when you’re done:

Android SDK Manager

The Android SDK Manager is modular, meaning that you download the initial package and then download separate packages within the framework in order to provide more functionality. This lets the SDK be more flexible, as you don’t need to keep downloading entire packages every time a new version comes out; you can simply download the latest module and pop it into the SDK. You can pick and choose which modules to install, but if you’ve got the hard drive space I recommend installing all of the different flavors of Android; it will help later when debugging apps, especially on older Android OSes.
Step 4: Install the Android ADT for Eclipse

NOTE: if you’re using NetBeans, you want the nbandroid plugin, found here:
Now that the SDK is installed, you should install the Android ADT plugin. It’s not strictly necessary to do so, but the ADT offers powerful integration with many of the Android tools, including the SDK Manager, the AVD Manager, and DDMS, or dynamic debugging. All of these are extremely useful to have when creating an Android application, and if you want to skip them you should do so at your own peril!
Eclipse ADT Plugin

To install the ADT, you’re going to have to add a custom software package to Eclipse. To do so, head over to the “Help” button on Eclipse’s menu and click the “Install New Software” button. Click “Available Software”, click “Add Remote Site”, and pop in this URL:
Eclipse ADT Install
Occasionally, for whatever reason, some people have trouble downloading the ADT from that secure site. If you’re having issues downloading the ADT, simply remove the “s” off the end of the “https”, and the download should work as intended. Once that’s done, head back over to the Available Software tab and check the boxes for Developer Tools, Android DDMS, and Android Development Tools; again, none of these are mandatory, but they’re all going to be very useful later on. The packages will take a bit to download; once they’re done, restart Eclipse!
Step 5: Create an Android Virtual Device (or AVD)

Like the previous step, this step isn’t entirely necessary; you could do all your debugging and development work on an actual Android handset. Creating AVDs is a great way to see how your application might work across different operating systems and handset types, as AVDs can mimic not only different Android OSes but also different hardware; you can change such settings as heap size, display type, and maximum memory, making it useful to try and figure out where bugs are happening when you don’t own a multitude of different handsets to test on! To create an AVD, you can open the Android AVD manager from Eclipse from the “Window” button on the top bar, and go to “Virtual Devices”. From there, you can add, configure and delete them:

Android Virtual Device (AVD) Manager
NOTE: This isn’t IDE specific. For those of you running a different IDE, the AVD Manager can be accessed in the same manner as the Android SDK is accessed outside of Eclipse; this is just a very easy shortcut for those with the Android ADT installed. Need More Help? Try this 30-minute video put together by Guy Cole, that walks you through the complete step-by-step setup.
The Following 80 Users Say Thank You to Apex For This Useful Post: [ View ] Gift Apex Ad-Free
20th August 2012, 05:15 AM |#2  
Apex's Avatar
OP Senior Member
Flag Siglufjörður, Norðurland eystra, Iceland
Thanks Meter: 3,609
Prompt So, You've Installed Android SDK, Now What?
The Android platform provides support for both speech recognition and speech synthesis. In this tutorial, we will create a simple Android app which allows the user to speak, attempts to recognize what they say, and then repeats what was recognized back to them using the Text To Speech engine.

Step 1: Start an Android Project
Create a new Android project in Eclipse. Alternatively, if you want to implement the speech recognition functionality in an existing app, open it instead. For this tutorial we have a minimum SDK version of 8, and you do not need to make any particular additions to your Manifest file, the default contents should suffice.
Step 2: Define the User Interface
Let’s start by defining the user interface. When the app launches, the user will be presented with a button. On pressing the button, the app will prompt them to speak, listening for their voice input. When the speech recognition utility processes the speech input, the app will present a list of suggested words to the user. As you’ll know if you’ve tried speech recognition as a user, the recognizer is not always accurate, so this list is essential. When the user selects an item from the list, the app will speak it back to them using the TTS engine. The TTS part of the application is optional, so you can omit it if you prefer.

The app is going to use a few text Strings as part of the interface, so define them by opening the “res/values/strings.xml” file and entering the following content:

<string name="intro">Press the button to speak!</string>
<string name="app_name">SpeechRepeat</string>
<string name="speech">Speak now!</string>
<string name="word_intro">Suggested words…</string>

Of course, you can alter the String content in any way you like.

Open your “res/layout/main.xml” file to create the main app layout. Switch to the XML editor if the graphical editor is displayed by default. Enter a Linear Layout as the main layout for the app’s launch Activity:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
androidaddingBottom="5dp" >

The Linear Layout contains various style declarations including a background color. Inside the Linear Layout, first enter an informative Text View:

<TextView android:layout_width="fill_parent"
android:textColor="#ffffff33" />

Notice that the Text View refers to one of the Strings we defined. It also sets various display properties which you can alter if you wish. After the Text View, add a button:

<Button android:id="@+id/speech_btn"
android:text="@string/speech" />

The user will press this button in order to speak. We give the button an ID so that we can identify it in the Java code and display one of the Strings we defined on it. After the button, add another informative Text View, which will precede the list of suggested words:

<TextView android:layout_width="fill_parent"
android:textStyle="italic" />

Again, this Text View uses a String resource and contains style properties. The last item in our main.xml Linear Layout is the list of suggested words:

<ListView android:id="@+id/word_list"
android:background="@drawable/words_bg" />

The List View will be populated with data when the app runs, so we give it an ID for identification in Java. The element also refers to a drawable resource, which you should add to each of the drawables folders in your app’s “res” directory, saving it as “words_bg.xml” and entering the following content:

<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:angle="180" />
<corners android:radius="10dp" />
android:color="#66ffffff" />

This is a simple shape drawable to display behind the List View. You can of course alter this and the List View style properties if you wish. The only remaining user interface item we need to define now is the layout for a single item within the list, each of which will display a word suggestion. Create a new file in “res/layout” named “word.xml”and then enter the following code:

<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:textSize="16dp" >

Each item in the list will be a simple Text View. That’s our interface design complete. This is how the app appears on initial launch:

Step 3: Setup Speech Recognition
Now we can implement our Java code. Open your app’s main Activity and add the following import statements at the top:

import java.util.ArrayList;
import java.util.List;
import java.util.Locale;

import android.app.Activity;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
import android.os.Bundle;
import android.speech.RecognizerIntent;
import android.speech.tts.TextToSpeech.OnInitListener;
import android.speech.tts.TextToSpeech;
import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.ListView;
import android.widget.Toast;
import android.widget.TextView;

You may not need all of these if you do not implement the TTS functionality – Eclipse should highlight imports you have not used so check them when you finish coding. Extend your opening class declaration line as follows, altering the Activity name to suit your own:

public class SpeechRepeatActivity extends Activity implements OnClickListener, OnInitListener {

The “OnInitListener” is only required for the TTS function. Add the following instance variables inside your class declaration, before the “onCreate” method:

//voice recognition and general variables

//variable for checking Voice Recognition support on user device
private static final int VR_REQUEST = 999;

//ListView for displaying suggested words
private ListView wordList;

//Log tag for output information
private final String LOG_TAG = "SpeechRepeatActivity";//***enter your own tag here***

//TTS variables

//variable for checking TTS engine data on user device
private int MY_DATA_CHECK_CODE = 0;

//Text To Speech instance
private TextToSpeech repeatTTS;

Inside your “onCreate” method, your class should already be calling the superclass method and setting your main layout. If not, it should begin like this:

//call superclass
//set content view

Next, still inside your “onCreate” method, retrieve a reference to the speech button and list we created, using their ID values:

//gain reference to speak button
Button speechBtn = (Button) findViewById(R.id.speech_btn);
//gain reference to word list
wordList = (ListView) findViewById(R.id.word_list);

The List View is an instance variable, accessible throughout the class. Now we need to find out whether the user device has speech recognition support:

//find out whether speech recognition is supported
PackageManager packManager = getPackageManager();
List<ResolveInfo> intActivities = packManager.queryIntentActivities(new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH), 0);
if (intActivities.size() != 0) {
//speech recognition is supported - detect user button clicks
//speech recognition not supported, disable button and output message
Toast.makeText(this, "Oops - Speech recognition not supported!", Toast.LENGTH_LONG).show();

We query the environment to see if the Recognizer Intent is present. If it is, we instruct the app to listen for the user pressing the speech button. If speech recognition is not supported, we simply disable the button and output an informative message to the user.
Step 4: Listen for Speech Input
Let’s setup the click listener for the speech button we’ve instructed the app to detect clicks for. Outside the “onCreate” method, but inside your Activity class declaration, add an “onClick” method as follows:

* Called when the user presses the speak button
public void onClick(View v) {
if (v.getId() == R.id.speech_btn) {
//listen for results

Now implement the method we’ve called here after the “onClick” method:

* Instruct the app to listen for user speech input
private void listenToSpeech() {

//start the speech recognition intent passing required data
Intent listenIntent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH);
//indicate package
listenIntent.putExtra(RecognizerIntent.EXTRA_CALLI NG_PACKAGE, getClass().getPackage().getName());
//message to display while listening
listenIntent.putExtra(RecognizerIntent.EXTRA_PROMP T, "Say a word!");
//set speech model
listenIntent.putExtra(RecognizerIntent.EXTRA_LANGU AGE_MODEL, RecognizerIntent.LANGUAGE_MODEL_FREE_FORM);
//specify number of results to retrieve
listenIntent.putExtra(RecognizerIntent.EXTRA_MAX_R ESULTS, 10);

//start listening
startActivityForResult(listenIntent, VR_REQUEST);

Some of this code is standard for setting up the speech recognition listening functionality. Areas to pay particular attention to include the line in which we specify the “EXTRA_PROMPT” – you can alter this to include text you want to appear for prompting the user to speak. Also notice the “EXTRA_MAX_RESULTS” line, in which we specify how many suggestions we want the recognizer to return when the user speaks. Since we are calling the “startActivityForResult” method, we will handle the recognizer results in the “onActivityResult” method.

When the app is listening for user speech, it will appear as follows:

Step 5: Present Word Suggestions
Implement the “onActivityResult” method inside your class declaration as follows:

* onActivityResults handles:
* - retrieving results of speech recognition listening
* - retrieving result of TTS data check
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
//check speech recognition result
if (requestCode == VR_REQUEST && resultCode == RESULT_OK)
//store the returned word list as an ArrayList
ArrayList<String> suggestedWords = data.getStringArrayListExtra(RecognizerIntent.EXTR A_RESULTS);
//set the retrieved list to display in the ListView using an ArrayAdapter
wordList.setAdapter(new ArrayAdapter<String> (this, R.layout.word, suggestedWords));

//tss code here

//call superclass method
super.onActivityResult(requestCode, resultCode, data);

Here we retrieve the result of the speech recognition process. Notice that the “if” statement checks to see if the request code is the variable we passed when calling “startActivityForResult”, in which case we know this method is being called as a result of the listening Intent. The recognizer returns the list of 10 suggested words, which we store as an Array List. We then populate the List View with these words, by setting an Array Adapter object as Adapter for the View. Now each of the items in the List View will display one of the suggested words.

If the app successfully recognizes the user input speech and returns the list of words, it will appear as follows:

Alternatively, if the app does not recognize the user speech input, the following screen will appear:

Step 6: Detect User Word Choices
We want to detect the user selecting words from the list, so let’s implement a click listener for the list items. Back in your “onCreate” method, after the existing code, set the listener for each item in the list as follows:

//detect user clicks of suggested words
wordList.setOnItemClickListener(new OnItemClickListener() {

//click listener for items within list
public void onItemClick(AdapterView<?> parent, View view, int position, long id)
//cast the view
TextView wordView = (TextView)view;
//retrieve the chosen word
String wordChosen = (String) wordView.getText();
//output for debugging
Log.v(LOG_TAG, "chosen: "+wordChosen);
//output Toast message
Toast.makeText(SpeechRepeatActivity.this, "You said: "+wordChosen, Toast.LENGTH_SHORT).show();//**alter for your Activity name***

We use the “setOnItemClickListener” method to assign a listener to each item in the list. Inside the new “OnItemClickListener”, we implement the “onItemClick” method to respond to these clicks – this method will fire when the user selects a suggested word from the list. First, we cast the View that has been clicked to a Text View, then we retrieve the text from it. This text is the word the user has selected. We write the chosen word out to the Log for testing and output it back to the user as a Toast message. Depending on the needs of your own application, you may wish to carry out further processing on the chosen word – this code is purely for demonstration.

The user can press the touchscreen or use a trackball to select words in the list.

When the user selects a word, the Toast message appears confirming it.

Step 7: Setup TTS Functionality
If you do not want to implement the Text To Speech functionality, you can stop now and test your app. We only require a little more processing to make our app repeat the user’s chosen word. First, to set up the TTS engine, add the following code to the section in your “onCreate” method where you queried the system for speech recognition support. Inside the “if” statement, after “speechBtn.setOnClickListener(this);”:

//prepare the TTS to repeat chosen words
Intent checkTTSIntent = new Intent();
//check TTS data
checkTTSIntent.setAction(TextToSpeech.Engine.ACTIO N_CHECK_TTS_DATA);
//start the checking Intent - will retrieve result in onActivityResult
startActivityForResult(checkTTSIntent, MY_DATA_CHECK_CODE);
Like the speech listening process, we will receive the result of this code checking for TTS data in the “onActivityResult” method. In that method, before the line in which we call the superclass “onActivityResult” method, add the following:

//returned from TTS data check
if (requestCode == MY_DATA_CHECK_CODE)
//we have the data - create a TTS instance
if (resultCode == TextToSpeech.Engine.CHECK_VOICE_DATA_PASS)
repeatTTS = new TextToSpeech(this, this);
//data not installed, prompt the user to install it
//intent will take user to TTS download page in Google Play
Intent installTTSIntent = new Intent();
installTTSIntent.setAction(TextToSpeech.Engine.ACT ION_INSTALL_TTS_DATA);

Here we initialize the TTS if the data is already installed, otherwise we prompt the user to install it. For additional guidance on using the TTS engine, see the Android SDK: Using the Text to Speech Engine tutorial.

To complete TTS setup, add the “onInit” method to your class declaration, handling initialization of the TTS as follows:

* onInit fires when TTS initializes
public void onInit(int initStatus) {
//if successful, set locale
if (initStatus == TextToSpeech.SUCCESS)
repeatTTS.setLanguage(Locale.UK);//***choose your own locale here***

Here we simply set the Locale for the TTS, but you can carry out other setup tasks if you like.
Step 8: Repeat the User Choice
Finally, we can repeat the user’s chosen word. Back in your “onCreate” method, inside the “OnItemClickListener” “onItemClick” method, after the line in which we output a Toast message, add the following:

//speak the word using the TTS
repeatTTS.speak("You said: "+wordChosen, TextToSpeech.QUEUE_FLUSH, null);
This will cause the app to repeat the user’s chosen word as part of a simple phrase. This will occur at the same time the Toast message appears.

That’s our complete Speak and Repeat app. Test it on an Android device with speech recognition and TTS support – the emulator does not support speech recognition so you need to test this functionality on an actual device. The source code is attached, so you can check if you have everything in the right place. Of course, your own apps may implement speech recognition as part of other processing, but this tutorial should have equipped you with the essentials of supporting speech input.
The Following 25 Users Say Thank You to Apex For This Useful Post: [ View ] Gift Apex Ad-Free
20th August 2012, 05:16 AM |#3  
Apex's Avatar
OP Senior Member
Flag Siglufjörður, Norðurland eystra, Iceland
Thanks Meter: 3,609
Prompt Android SDK Commands & Explanations
Adb has many built in commands. Some are interactive (meaning they keep running until you stop them) and some just perform a simple task. Below is a list of the commands in the 1.0 SDK version of adb.
Android Debug Bridge version 1.0.20

-d                            - directs command to the only connected USB device
                                 returns an error if more than one USB device is present.
 -e                            - directs command to the only running emulator.
                                 returns an error if more than one emulator is running.
 -s <serial number>            - directs command to the USB device or emulator with
                                 the given serial number
 -p <product name or path>     - simple product name like 'sooner', or
                                 a relative/absolute path to a product
                                 out directory like 'out/target/product/sooner'.
                                 If -p is not specified, the ANDROID_PRODUCT_OUT
                                 environment variable is used, which must
                                 be an absolute path.
 devices                       - list all connected devices

device commands:
  adb push <local> <remote>    - copy file/dir to device
  adb pull <remote> <local>    - copy file/dir from device
  adb sync [ <directory> ]     - copy host->device only if changed
                                 (see 'adb help all')
  adb shell                    - run remote shell interactively
  adb shell <command>          - run remote shell command
  adb emu <command>            - run emulator console command
  adb logcat [ <filter-spec> ] - View device log
  adb forward <local> <remote> - forward socket connections
                                 forward specs are one of:
                                   localabstract:<unix domain socket name>
                                   localreserved:<unix domain socket name>
                                   localfilesystem:<unix domain socket name>
                                   dev:<character device name>
                                   jdwp:<process pid> (remote only)
  adb jdwp                     - list PIDs of processes hosting a JDWP transport
  adb install [-l] [-r] <file> - push this package file to the device and install it
                                 ('-l' means forward-lock the app)
                                 ('-r' means reinstall the app, keeping its data)
  adb uninstall [-k] <package> - remove this app package from the device
                                 ('-k' means keep the data and cache directories)
  adb bugreport                - return all information from the device
                                 that should be included in a bug report.

  adb help                     - show this help message
  adb version                  - show version num

 (no option)                   - don't touch the data partition
  -w                           - wipe the data partition
  -d                           - flash the data partition

  adb wait-for-device          - block until device is online
  adb start-server             - ensure that there is a server running
  adb kill-server              - kill the server if it is running
  adb get-state                - prints: offline | bootloader | device
  adb get-product              - prints: <product-id>
  adb get-serialno             - prints: <serial-number>
  adb status-window            - continuously print device status for a specified device
  adb remount                  - remounts the /system partition on the device read-write

  adb ppp <tty> [parameters]   - Run PPP over USB.
 Note: you should not automatically start a PDP connection.
 <tty> refers to the tty for PPP stream. Eg. dev:/dev/omap_csmi_tty1
 [parameters] - Eg. defaultroute debug dump local notty usepeerdns

adb sync notes: adb sync [ <directory> ]
  <localdir> can be interpreted in several ways:

  - If <directory> is not specified, both /system and /data partitions will be updated.

  - If it is "system" or "data", only the corresponding partition
    is updated.
Common Use:
Some of the more common commands in adb are push, pull, shell, install, remount, and logcat.

Push sends a file from your desktop computer to your Android device:

adb push test.txt /sdcard/test.txt
Pull pulls a file from your Android device to your desktop computer:
adb pull /sdcard/test.txt test.txt

lets you run an interactive shell (command prompt) on the Android device:

adb shell
Install lets you install an android APK file to your Android device:

adb install myapp.apk

remounts the /system partition as writable (or readonly if it is already writeable):

adb remount
Logcat lets you view the devices debug logs in real time (must press control+c to exit):

adb logcat
The Following 23 Users Say Thank You to Apex For This Useful Post: [ View ] Gift Apex Ad-Free
20th August 2012, 05:16 AM |#4  
Apex's Avatar
OP Senior Member
Flag Siglufjörður, Norðurland eystra, Iceland
Thanks Meter: 3,609
Further Notes On This Subject
The Following 8 Users Say Thank You to Apex For This Useful Post: [ View ] Gift Apex Ad-Free
20th August 2012, 05:54 AM |#5  
41rw4lk's Avatar
Senior Member
Flag Springfield, MO
Thanks Meter: 327
It's great to see guides like these. I think every device forum should have these stickied in their general section. We all have/had to start somewhere. Having nice guides with accurate up-to-date information is only going to benefit everyone, and makes learning and understanding much easier. Fact is, we're all here for the same reason, to capitalize on the potential our devices have, and enjoy them. So, thanks for putting this together. It might seem trivial to a lot of the more experienced people, but those who aren't will definitely appreciate it.
The Following 4 Users Say Thank You to 41rw4lk For This Useful Post: [ View ] Gift 41rw4lk Ad-Free
20th August 2012, 06:28 AM |#6  
Junior Member
Flag Bangalore
Thanks Meter: 1
Thanks. This is helpful.

Sent from my MB865
The Following User Says Thank You to droidusr For This Useful Post: [ View ] Gift droidusr Ad-Free
20th August 2012, 03:08 PM |#7  
Drgravy's Avatar
Senior Member
Thanks Meter: 2,544
Hey Apex great job on the guide

I just wish this was here the first time I installed the the android sdk
I'm sure it will be useful to alot of members
The Following User Says Thank You to Drgravy For This Useful Post: [ View ] Gift Drgravy Ad-Free
20th August 2012, 05:12 PM |#8  
Thanks Meter: 0
Originally Posted by 41rw4lk

I think every device forum should have these stickied in their general section.


Speak only when it improves on your silence.
The Following User Says Thank You to For This Useful Post: [ View ] Gift Ad-Free
20th August 2012, 05:32 PM |#9  
vinamilk's Avatar
Senior Member
Thanks Meter: 49
Sorry for OT, this is not for Atrix 2 but I have question :
I want to extract included kernel in CM9 Rom, it is inside boot.img file. I've used Android Kitchen for extracting, it's ok now. I had zImage file.
So now how can I build flash-able zip file for CWM ? Tried UpdateZipCreator program but it showed error (7) when flashing.

I just wanna test many difference kernels and then come back to original but no flashable CM9 kernel here on xda.
21st August 2012, 05:28 PM |#10  
Apex's Avatar
OP Senior Member
Flag Siglufjörður, Norðurland eystra, Iceland
Thanks Meter: 3,609
Originally Posted by vinamilk

Sorry for OT, this is not for Atrix 2 but I have question :
I want to extract included kernel in CM9 Rom, it is inside boot.img file. I've used Android Kitchen for extracting, it's ok now. I had zImage file.
So now how can I build flash-able zip file for CWM ? Tried UpdateZipCreator program but it showed error (7) when flashing.

I just wanna test many difference kernels and then come back to original but no flashable CM9 kernel here on xda.

Okay, Jim will probably be the one to ask on this. I don't recall which device you have currently (viewing from my phone) but he's the one who wrote the kernel for CM9 on the SGS3. I'm assuming you want to run the CM9 rom with 'experimental' kernels, so I'd PM him and ask (Sorry Jim, lol) but I'm not the expert on kernels or Android Kitchen, least not as knowledgeable as I should be to give a suitable answer...

Sent from my SAMSUNG-SGH-I747 using xda premium
The Following 2 Users Say Thank You to Apex For This Useful Post: [ View ] Gift Apex Ad-Free
21st January 2013, 08:48 AM |#11  
Junior Member
Thanks Meter: 0
Smile oh! thanks a lot! I am very happy to find this!
long long ago! I start to find this resourse
Post Reply Subscribe to Thread

adb, adt, ide, jdk, sdk

Guest Quick Reply (no urls or BBcode)
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes