无法从命令行创建新的 android 项目

Can't create new android project from command line

我正在尝试从命令行创建一个新的 android 项目。我正在关注 http://developer.android.com/ 的教程。在教程中,首先他们要求我使用 ./android list targets 命令列出我系统上安装的所有可用平台。这给了我以下结果,

irfan@outerheavenY500Ubuntu:~/Android/Sdk/tools$ ./android list targets
Available Android targets:
----------
id: 1 or "android-21"
     Name: Android 5.0.1
     Type: Platform
     API level: 21
     Revision: 2
     Skins: HVGA, QVGA, WQVGA400, WQVGA432, WSVGA, WVGA800 (default), WVGA854, WXGA720, WXGA800, WXGA800-7in, AndroidWearRound, AndroidWearSquare, AndroidWearRound, AndroidWearSquare
 Tag/ABIs : android-wear/armeabi-v7a, android-wear/x86, default/armeabi-v7a, default/x86, default/x86_64
----------
id: 2 or "Google Inc.:Google APIs:21"
     Name: Google APIs
     Type: Add-On
     Vendor: Google Inc.
     Revision: 1
     Description: Android + Google APIs
     Based on Android 5.0.1 (API level 21)
     Libraries:
      * com.android.future.usb.accessory (usb.jar)
          API for USB Accessories
      * com.google.android.media.effects (effects.jar)
          Collection of video effects
      * com.google.android.maps (maps.jar)
          API for Google Maps
     Skins: HVGA, QVGA, WQVGA400, WQVGA432, WSVGA, WVGA800 (default), WVGA854, WXGA720, WXGA800, WXGA800-7in, AndroidWearRound, AndroidWearSquare, AndroidWearRound, AndroidWearSquare
 Tag/ABIs : google_apis/x86

然后我尝试执行以下命令来创建一个新项目,

./android create project --target 1 --name MyFirstApp2 \ --path /home/irfan/AndroidProjects/MyFirstApp2 --activity MyActivity \ --package com.example.myfirstapp2

但这给了我以下错误,Error: Argument 'com.example.myfirstapp2' is not recognized.

根据教程,我按照以下命令结构创建一个新项目,

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

如果我正确地遵循了结构,谁能指出我还做错了什么?

删除反斜杠。您还想 add the path ~/Android/Sdk/tools 到您的 $PATH。这样你就可以从任何目录调用 androidadb

cd
PATH=$PATH:~/Android/Sdk/tools
export PATH
android create project --target 1 --name MyFirstApp2 --path ./MyFirstApp2 --activity MyActivity --package com.example.myfirstapp2

从命令中删除 \ 个字符。这些是您不需要的新线路连接器。您的命令应如下所示:

./android create project --target 1 --name MyFirstApp2 --path /home/irfan/AndroidProjects/MyFirstApp2 --activity MyActivity --package com.example.myfirstapp2