使用命令行创建Android工程报错:"Target id is not valid. Use 'android.bat list targets' to get the target ids"

时间:2022-02-14 17:59:57

D:\adt\sdk>cd tools



D:\adt\sdk\tools>

D:\adt\sdk\tools>android list targets

Available Android targets:

----------

id: 1 or "android-18"

     Name: Android 4.3

     Type: Platform

     API level: 18

     Revision: 1

     Skins: HVGA, QVGA, WQVGA400, WQVGA432, WSVGA, WVGA800 (default), WVGA854, W

XGA720, WXGA800, WXGA800-7in

     ABIs : armeabi-v7a

两次失败执行,ID不对,和上面的id相同

D:\adt\sdk\tools>android create project --target 19 --path  d:\anzhuo\MyFirstApp

\  --activity MainActivity --package com.example.myfirstapp

Error: Target id is not valid. Use 'android.bat list targets' to get the target

ids.



D:\adt\sdk\tools>android create project --target 18 --path  d:\anzhuo\MyFirstApp

\  --activity MainActivity --package com.example.myfirstapp

Error: Target id is not valid. Use 'android.bat list targets' to get the target

ids.



D:\adt\sdk\tools>android create project --target android-18 --path  d:\anzhuo\My

FirstApp\  --activity MainActivity --package com.example.myfirstapp

Created directory D:\anzhuo\MyFirstApp\src\com\example\myfirstapp

Added file d:\anzhuo\MyFirstApp\src\com\example\myfirstapp\MainActivity.java

Created directory D:\anzhuo\MyFirstApp\res

Created directory D:\anzhuo\MyFirstApp\bin

Created directory D:\anzhuo\MyFirstApp\libs

Created directory D:\anzhuo\MyFirstApp\res\values

Added file d:\anzhuo\MyFirstApp\res\values\strings.xml

Created directory D:\anzhuo\MyFirstApp\res\layout

Added file d:\anzhuo\MyFirstApp\res\layout\main.xml

Created directory D:\anzhuo\MyFirstApp\res\drawable-xhdpi

Created directory D:\anzhuo\MyFirstApp\res\drawable-hdpi

Created directory D:\anzhuo\MyFirstApp\res\drawable-mdpi

Created directory D:\anzhuo\MyFirstApp\res\drawable-ldpi

Added file d:\anzhuo\MyFirstApp\AndroidManifest.xml

Added file d:\anzhuo\MyFirstApp\build.xml

Added file d:\anzhuo\MyFirstApp\proguard-project.txt



D:\adt\sdk\tools>





查看目录,产生工程文件

使用命令行创建Android工程报错:"Target id is not valid. Use 'android.bat list targets' to get the target ids"