Felipe Barbosa
Felipe Barbosa

Reputation: 39

Create android project via cmd

I cannot create a android project via cmd.

The following error is shown:

flag -- is not valid

I tried to execute the following code

According to android training website

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

Upvotes: 1

Views: 80

Answers (1)

Jon Hobson
Jon Hobson

Reputation: 166

Sounds like you've added a space somewhere you shouldn't or had trouble substituting the stuff in <> with actual values, or maybe been confused by the newlines.

Here is a command with just one line that I just ran on OSX that successfully created a project in ~/MyFirstApp.

android create project --target "android-17" --name MyFirstApp --path ~/MyFirstApp --activity MainActivity --package com.example.myfirstapp

This should work for you, assuming you have the android-17 SDK installed. If you have another SDK installed, then you'll have to change the number to represent the SDK you have installed. (run android list targets to see which ones you have)

Upvotes: 2

Related Questions