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$ 


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值