ant 编译问题解决方案

     在配置ant环境时,除了把ant路径写进环境变量,还需要关联sdk版本,才能正在编译成功。

   android update project -p .

   执行上述命令时,没关联sdk版本,会出现以下错误:

Error: The project either has no target set or the target is invalid.
Please provide a --target to the 'android update' command.
   

    这个时候可执行  android list targets   来查看当前系统中的android模拟器

     

ljb@ljb-OptiPlex-3010:~/source/lib/K7Utils/K7Utils$ android list targets
Available Android targets:
----------
id: 1 or "android-17"
     Name: Android 4.2.2
     Type: Platform
     API level: 17
     Revision: 2
     Skins: WVGA854, WSVGA, WXGA800-7in, WVGA800 (default), WQVGA432, HVGA, QVGA, WQVGA400, WXGA720, WXGA800
 Tag/ABIs : no ABIs.
----------
id: 2 or "android-20"
     Name: Android 4.4W
     Type: Platform
     API level: 20
     Revision: 1
     Skins: WVGA854, WSVGA, WXGA800-7in, WVGA800 (default), WQVGA432, HVGA, QVGA, WQVGA400, WXGA720, WXGA800
 Tag/ABIs : no ABIs.
ljb@ljb-OptiPlex-3010:~/source/lib/K7Utils/K7Utils$ 

     然后再执行命令,关联android 版本即可编译成功:


ljb@ljb-OptiPlex-3010:~/source/lib/K7Utils/K7Utils$ android update project -p . -t android-17 -s
Updated project.properties
Updated local.properties
Added file ./proguard-project.txt
ljb@ljb-OptiPlex-3010:~/source/lib/K7Utils/K7Utils$ 


你可能感兴趣的:(android)