Ramesh
Ramesh

Reputation: 27

How to create eclipse android project from command prompt?

I want to create new eclipse android project with the help of adt using command prompt. I am not looking for normal process to create android project because i have created template android app in Eclipse.

Android Template such as login , settings are by default provided by eclipse. I have created my own template. for that's why i want to create from command prompt.

Upvotes: 1

Views: 1861

Answers (4)

Sahir Saiyed
Sahir Saiyed

Reputation: 530

Managing Projects from the Command Line

http://developer.android.com/tools/projects/projects-cmdline.html

for example

android create project --target --name --path path/to/your/project --activity --package

android create project --target 12 --name projectName --path E:/project --activity SplashActivity --package com.mycmd.client

Upvotes: 1

user1732284
user1732284

Reputation: 11

  1. Change directories into the Android SDK’s tools/ path.
  2. Execute:

    android list targets

    This prints a list of the available Android platforms that you’ve downloaded for your SDK. Find the platform against which you want to compile your app. Make a note of the target id. We recommend that you select the highest version possible. You can still build your app to support older versions, but setting the build target to the latest version allows you to optimize your app for the latest devices.

Using the command line

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

    android create project \ --target \ --name \ --path path/to/your/project \ --activity \ --package

    Where :

    target is the "build target" for your application. It corresponds to an Android platform library (including any add-ons, such as Google APIs) that you would like to build your project against. To see a list of available targets and their corresponding IDs, execute: android list targets.

    name is the name for your project. This is optional. If provided, this name will be used for your .apk filename when you build your application.

    path is the location of your project directory. If the directory does not exist, it will be created for you.

    activity is the name for your default Activity class. This class file will be created for you inside /src// . This will also be used for your .apk filename unless you provide a name.

    package is the package namespace for your project, following the same rules as for packages in the Java programming language.

    for instance our hello world project was created using :

    android create project \ --target 1 \ --name hello_world \ --path ./hello_world \ --activity helloworldActivity \ --package com.app.helloworld

    To update a project, run the following command :

    android update project --name --target --path

Upvotes: 0

Shruti
Shruti

Reputation: 5591

follow this link :

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>
  • target is the "build target" for your application. It corresponds to an Android platform library (including any add-ons, such as Google APIs) that you would like to build your project against. To see a list of available targets and their corresponding IDs, execute: android list targets.

  • name is the name for your project. This is optional. If provided, this name will be used for your .apk filename when you build your application. path is the location of your project directory. If the directory does not exist, it will be created for you.

  • activity is the name for your default Activity class. This class file will be created for you inside /src// . This will also be used for your .apk filename unless you provide a name.

  • package is the package namespace for your project, following the same rules as for packages in the Java programming language.

An example to create project is shown below :

android create project \
--target 1 \
--name MyAndroidApp \
--path ./MyAndroidAppProject \
--activity MyAndroidAppActivity \
--package com.example.myandroid

Upvotes: 0

sooraj.e
sooraj.e

Reputation: 776

try this

android create project --target <target-id> --name MyFirstApp \
--path <path-to-workspace>/MyFirstApp --activity MainActivity \
--package com.example.myfirstapp

source http://developer.android.com/training/basics/firstapp/creating-project.html#CommandLine

Upvotes: 3

Related Questions