Android Common Commands

Source: Internet
Author: User

In the previous article, we focused on the common commands of the ADB, and let's take a look at other common commands

2 android2.1 View all installed Android versions and AVD devices on the Machine 2.1.1 View the AVD installed on the machine (AndroidVirtual device) devices

We can view all the AVD installed on the machine using the following command:

Android List AVD

Terminal Execution Results:

As we can see, a total of two avd have been created on my machine, one of which is 2.3.3 and the other is version 4.0.

2.1.2 View all installed Android versions on the machine

By following this command, we can view the Android version that is already installed on the machine:

Android list target

Terminal Execution Results:

is only a subset of them.

2.2 AVD Device Management 2.2.1 Create AVD device

First, we can query the Android version installed on our machine by the above command, then we can create the AVD device according to our needs and the installed version. The specific command format is as follows:

Android Create avd-n <AVD name >-T <android version >-B <cpu architecture >-P <AVD Device Save location >-s < select AVD Skin >

As an example:

Android Create Avd-n Test_avd-t 4

In this way we can create the simplest avd out of the Android list AVD we can view to this AVD:

2.2.2 Upgrade the AVD device to conform to the new SDK environment

Android update avd-n <AVD name >

As an example:

Android Update Avd-n TEST_AVD

2.2.3 Rename the AVD device or modify the path

Android Move AVD Options:  -P--path    : path to the AVD ' s new directory.  -N--name    : Name of the AVD to move or rename. [Required]  -R--rename  : New name of the AVD.

2.2.4 Deleting an AVD device

Android Delete avd-n <avd name >

2.3 Android Project Management 2.3.1 Create a new Android project

Android Create Project <options>options:-  n--name    : project name <project Name> When you go to build the project, This option will be used to make the filename of your apk < that is:name.apk>-  t--target  target query to. [Required]  -P--path    : The path that the project will establish. [Required]  -K--package: The package name of the project app. [Required]  -A--activity: The default activity name. [Required] 

For example, I want to create a Xiaoxuetu folder under the current path with the name Xiaoxuetu, with the package name Com.xiaoxuetu,activity mainactivity:

Android Create Project-n xiaoxuetu-t 4-p./xiaoxuetu-k com.xiaoxuetu-a mainactivity

The result of the terminal execution is:

From the results, we can see that after executing the command he generated a series of files for us, about the specific architecture of a project , which we will talk about later.

2.3.2 Update an Android project

What is the so-called update? This means that you can add a library to an existing Android project, fix the project name, set the project's target Android version, and update his subproject, such as a test project.

Android Update Project <options>options:  -L--library    : Directory of an Android library to add, relative to This is directory for project ' s.  -P--path       : The project ' s directory. [Required]  -N--name       : Project name.  -T--target     : Target ID to set for the project.  -S--subprojects:also updates any projects in sub-folders, such as test projects.

Let's start with a simple example and then introduce the-l and-s parameters:

Android update project-p./xiaoxuetu-n xiaoxuetu-t 4

Execution result of the terminal:

2.3.3 Creating a library project (Lib project)

The above attribute-L actually refers to the library project, and the Library Project (Lib project) itself is also a standard Android project. We can create a library project as we did before, or create it directly from the tools that are available from the Android tool itself:

Android Create Lib-project <options>options:  -N--name    : project name.  -T-target  : Target ID of the new project. [Required]  -K--package:android Package name for the library. [Required]  -P--path    : The new project ' s directory. [Required]

Let's give an example:

Android Create Lib-project-n xiaoxuetu_lib-t 4-k com.xiaoxuetu.lib-p./xiaoxuetu_lib

The result of the terminal execution is:

It seems that there is no difference between himself and the standard Android project, the difference is that there is a more attribute in the Project.Properties file:

Android.library=true

If you want to. Change the existing project to a library item, just add the above sentence in its project.properties file.

2.3.4 Updating library items

Update the library project, such as updating the Android version for the Library project:

Android update Lib-project <options>options:  -P--path    : The project ' s directory. [Required]  -T--target  : Target ID to set for the project.

How to use, with the previous 2.3.2 update an Android project , do not do too many instructions here

Introduction of 2.3.5 Library project

In fact, this has been explained in the previous Android project creation and update, using the-L (or--library) This parameter:

Android Update Project--target <target_ID>--path path/to/your/project--library path/to/library_projecta 

When the introduction succeeds, we will find that this line is more in the Project.Properties file:

Android.library.reference.1=path/to/library_projecta

If you are introducing multiple library projects, you will use. N to determine the priority of each library project:

Android.library.reference.1=path/to/library_projectaandroid.library.reference.2=path/to/library_ Projectbandroid.library.reference.3=path/to/library_projectc

Of course we can give LIBRARY_PROJECTC a higher priority:

Android.library.reference.2=path/to/library_projectaandroid.library.reference.3=path/to/library_ Projectbandroid.library.reference.1=path/to/library_projectc

Note:. N must be starting from 1.

2.3.6 Creating a Test project (Test-project)

Create a test project, can be used to test the Android app Activity,service and so on, the specific blog will be, again do not do a detailed explanation, if you want to understand now, you can refer to: http://developer.android.com/ Tools/testing/testing_android.html

Android Create Test-project <options>options:  -P--path    : The new project ' s directory. [Required]  -N--name    : Project name.  -M--main    app under test, relative to the test project directory. [Required]

Here is the main explanation of the next-m parameter, if there is such a project/source/projecta, we want to build a test project/source/projectatest for testing/source/projecta, then our m must be. /projecta, here is a simple example of a Xiaoxuetu project that was previously created in the same directory:

Android Create Test-project-p./xiaoxuetu_test-n xiaoxuetu_test-m. /xiaoxuetu

The execution results in the terminal are:

2.3.7 Update test project (Test-project)

Update the Android project to be tested for this test project:

Android update Test-project <options>options:  -M--main    app under test, relative to the test project Dir Ectory. [Required]  -P--path    : The project ' s directory. [Required]

The specific considerations and the implementation results are similar to the previous, here do not do long explanation.

Android Common Commands

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.