热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

AntJAR执行错误:JavaI/O异常—无法启动程序${aAPT},错误代码2,指定文件或目录不存在

在尝试为Unity编译一个简单的Java库时,运行`antjar`命令后遇到了JavaI/O异常。具体错误信息为“无法启动程序${aAPT},错误代码2”,这通常表示指定的文件或目录不存在。此问题可能是由于环境配置不正确或路径设置有误导致的。建议检查相关路径和环境变量,确保所有依赖项都已正确安装和配置。

I'm trying to compile a simple Java library for Unity, and after running ant jar, I get the following message:

我正在尝试为Unity编译一个简单的Java库,运行ant jar后,我收到以下消息:

/Applications/adt-bundle-mac-x86_64-20140702/sdk/tools/ant/build.xml:649: The following error occurred while executing this line:
/Applications/adt-bundle-mac-x86_64-20140702/sdk/tools/ant/build.xml:694: Execute failed: java.io.IOException: Cannot run program "/Users/****/UnityProjects/****/JavaTestPlugin/${aapt}": error=2, No such file or directory

This is strange, because I've compiled this class before successfully, and I have everything I would think I need. Namely Android Studio, and related packages (Tools, Android 4/5, etc). I noticed that aapt is not located in my adt-bundle/sdk/platform-tools directory, but it is in one of the build-tools directories. Even including the latter in my path did not help.

这很奇怪,因为我在成功之前编译了这个类,并且我拥有我认为需要的一切。即Android Studio和相关软件包(Tools,Android 4/5等)。我注意到aapt不在我的adt-bundle / sdk / platform-tools目录中,但是它位于一个build-tools目录中。即使在我的道路上包括后者也无济于事。

Anyway, I am running Mac OS 10.10.3, with the most up-to-date version of Android Studio. This class compiled before upgrading to Yosemite. I've seen suggestions on how to fix this issue, but all of those suggestions apply to Linux as opposed to Mac OS.

无论如何,我正在使用最新版本的Android Studio运行Mac OS 10.10.3。此类在升级到Yosemite之前编译。我已经看到了如何解决这个问题的建议,但所有这些建议都适用于Linux而不是Mac OS。

2 个解决方案

#1


51  

Have you updated the Android SDK tools to 24.3.2? This seems to have caused the issue. Add following 4 lines to android-sdk-path/tools/ant/build.xml starting line 484 and hopefully it should solve.

您是否已将Android SDK工具更新为24.3.2?这似乎引起了这个问题。将以下4行添加到android-sdk-path / tools / ant / build.xml起始行484,希望它应该解决。





#2


3  

This is fixed in the latest tools update ( https://code.google.com/p/android/issues/detail?id=176488 )

这已在最新的工具更新中修复(https://code.google.com/p/android/issues/detail?id=176488)


推荐阅读
author-avatar
uka9032934
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有