Throughout most of this course, I'll be using the Android tools through Eclipse, but all of the tools that are included in the SDK are also available from the command line, and there are times when it's important to know where they are and how to use them. Here are some examples. I've already described how to open something called the Android SDK Manager from Eclipse. The SDK Manager is a tool that lets you download other Eclipse platforms and otherwise update your SDK.
But you can get to this SDK manager from the command
line as well, or from a file manager application. If
you go to the ADT bundle folder, and from there into the SDK folder. You'll
find three folders that have the word tools in them. There's
build tools, platform tools, and
simply tools. Most
of the important commands that developers use are in the tools subfolder. And
here's one example, a command simply called android.
This command can be used to create a new
Android project,
package an app for distribution, and execute other vital tasks. But
if you simply double-click the android command, and don't add any attributes to
it, it will open the Android SDK Manager too. So
you don't need Eclipse to get to this very important tool. And
here's another example. In
Eclipse, there's a perspective called DDMS. It
has a Devices view, a bunch of views that let you take a look
and see what's happening in a particular
device or emulator, and the logcat view.
But you can get to all these views from the
command line. There's
an older tool called DDMS but it's deprecated, it might
not be around in future versions of the Android SDK. Instead
you should use a command called monitor, and when you double-click
the monitor command you'll go the the Android Debug Monitor view. And
it has all of the same tools, devices, threads, heap, logcat, and so on. If
you already have
the DDMS perspective open, you might have trouble running this version from the
command line.
You should only run one at a time. Other
important tools that are in the tools
subfolder include draw 9-patch Which is used to modify
graphics so that they can adjust automatically
to different screen sizes and pixel densities. Lint,
which is used to look at your code, and
make sure that you're following correct syntax and adding
important attributes. SQLite 3, to manage local databases. And
more. But
there's one vital tool that's not in the tools folder.
Instead, it's in the platform tools folder,
and it's called ADB. ADB
stands for Android Debug Bridge. And
whenever you launch an app, on either an emulator or a physical device, the
ADB tool is doing the work in the background. So
for example, if I go to my Android perspective, go to a Java class, and then run
the app in the emulator or device, the ADB command is actually doing the work.
The ADB command has all sorts of things you
can do with it from the command
line, but when you're first getting started building
Android apps, you'll probably find yourself launching it
from you developer tool, in this case from Eclipse. So
that's a survey of the available tools that are included in the Android SDK. Again,
the ADB tool is in the platform tools folder. And
most of the others are in the tools folder. If
you're curious about some of the more advanced features of any of these
tools, take a look in the Android developer documentation for all sorts of tips
and tricks.


0 comments:
Post a Comment