Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Android Security Cookbook

You're reading from   Android Security Cookbook Practical recipes to delve into Android's security mechanisms by troubleshooting common vulnerabilities in applications and Android OS versions

Arrow left icon
Product type Paperback
Published in Dec 2013
Publisher Packt
ISBN-13 9781782167167
Length 350 pages
Edition 1st Edition
Languages
Arrow right icon
Toc

Table of Contents (11) Chapters Close

Preface 1. Android Development Tools FREE CHAPTER 2. Engaging with Application Security 3. Android Security Assessment Tools 4. Exploiting Applications 5. Protecting Applications 6. Reverse Engineering Applications 7. Secure Networking 8. Native Exploitation and Analysis 9. Encryption and Developing Device Administration Policies Index

Creating Android Virtual Devices (AVDs)

Some of you may prefer working with your AVDs from the command-line interface for some reason or other. Maybe you have some awesome scripts that you'd like to write to set up some awesome AVDs. This recipe details how to create AVDs and launches them straight from the command line.

How to do it…

Before you can create your own AVDs, you will need to specify some attributes for it; the most important one being the system image that will be used. To do so, execute the following steps:

  1. You can find a list of the system images available to you by using the following command:
    [path-to-sdk-install]/tools/android list targets
    

    Or use the following command from the Windows terminal:

    C:\[path-to-sdk-install]\tools\android list targets
    

    As an example, enter the following into the command prompt:

    C:\Users\kmakan\Documents\adt-bundle-windows-x86-20130219\sdk\tools\android list targets
    

    This command will list the system images available on your system. If you'd like more, you'll need to install them via the SDK manager. The pieces of information that you're looking for in this list are the target IDs because you'll need them to identify the system image, which you will need to specify in the next step.

  2. Create the AVD using the following command:
    [path-to-sdk-install]/tools/android create avd –n [name of your new AVD] –t [system image target id]
    

    You will need to decide on a name for the AVD you've just created, which you will specify using the –n switch. The system image ID you selected from the previous step must be specified using the –t switch. If everything goes well, you should have just created a brand new virtual machine.

  3. You can launch your brand new AVD using the following command:
    [path-to-sdk-install]/tools/emulator –avd [avd name]
    

    Here, [avd name] is the AVD name you decided on in the previous step. If all goes well, your new AVD should start right up.

There's more…

You probably want to know a little more about the commands. Regarding the emulator, it's capable of emulating a device with different configurations.

Emulating a memory card or an external storage

You can specify that your virtual device also emulates some external storage using the –c options when you create it, as shown in the following command:

android create –avd –n [avd name] –t [image id] –c [size][K|M]

For example, see the following command:

android create –avd –n virtdroid –t 1 –c 128

You will obviously need to supply the size of your new emulated memory card. You also need to specify the unit by specifying either K for kilobytes or M for megabytes.

The partition sizes

Another very useful thing that you may want to do is specify how much space you'd like to grant the internal storage partitions. You can do this by using the -partition-size switch, which you specify when you invoke the emulator as shown in the following command:

emulator –avd [name] –partition-size [size in MBs]

You will also need to supply a size for the partitions. By default, the unit of measurement is megabytes (MBs).

See also

There are many other options that you can make use of when it comes to the emulator. If you're interested in learning more, check out the documents provided in the following links:

You have been reading a chapter from
Android Security Cookbook
Published in: Dec 2013
Publisher: Packt
ISBN-13: 9781782167167
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image