Managing Android Projects from Command Line

The android tool provides you with commands to create all three types of projects. An Android project contains all of the files and resources that are needed to build a project into an .apk file for installation.
  • An Android project contains all of the files and resources that are needed to build a project into an .apk file for installation.
  • You can also designate an Android project as a library project.
  • Test projects extend JUnit test functionality to include Android specific functionality. 

Creating an Android Project 

To create an Android project, you must use the android tool. When you create a new project with android , it will generate a project directory with some default application files, stub files, configuration files and a build file. 

To create a new Android project, open a command-line, navigate to the tools/ directory of your SDK and run: 

android create project \ 
--target <target_ID> \  
--name <your_project_name>
--path path/to/your/project \  
--activity <your_activity_name>
 --package <your_package_namespace> 

Updating an Android Project 
  
To update an existing Android project, open a command-line and navigate to the tools/ directory of your SDK. Now run: 

android update project 
--name <project_name> 
--target <target_ID>  
--path <path_to_your_project>

Setting Up a Library Project 
 
To create a new library project, navigate to the <sdk>/tools/ directory and
  use this command: 

android create lib-project --name <your_project_name> \ --target <target_ID> \ --path path/to/your/project \ --package <your_library_package_namespace>

Updating a Library Project 

If you want to update the build properties (build target, location) of the library project, use this command: 

android update lib-project \ --target <target_ID> \ --path path/to/your/project

No comments:

Post a Comment