将 Android SDK 工具更新至修订版 14 后出现 Ant 问题

发布于 2024-12-11 06:37:12 字数 1742 浏览 0 评论 0原文

安装 Android SDK 工具修订版 14(执行 ant -version 时为 ant 版本 1.8.2)以在 Android 4.0(ICS) 上安装和测试我们的应用程序后,我注意到我们的自动构建脚本现在失败了。构建脚本正在执行 ant 命令来构建 apk,在修订更新后,它抱怨 build.xml 文件已过期,并执行 ant update project -p 来修复此问题。我们的项目有一个顶级项目和它引用的两个库项目,全部都是在 IntelliJ 中开发的。删除旧的 build.xml 文件后,我在每个项目文件夹中运行了更新项目命令。现在我收到以下消息:

<SDK_DIR>/tools/ant/build.xml:466: The following error occurred while executing this line:
<SDK_DIR>/tools/ant/build.xml:539: The following error occurred while executing this line:
<SDK_DIR>/tools/ant/build.xml:568: null returned: 1

我已在下面包含主项目和库项目 build.xml 文件的代码(每个文件相同):

<?xml version="1.0" encoding="UTF-8"?>
<project name="LaunchActivity" default="help">
    <loadproperties srcFile="local.properties" />
    <property file="ant.properties" />
    <loadproperties srcFile="project.properties" />
    <fail 
        message="sdk.dir is missing. Make sure to generate local.properties using 'android update project'"
        unless="sdk.dir"
/>
    <import file="${sdk.dir}/tools/ant/build.xml" />
</project>

使用新的 project.properties 文件(如下): AppMain(非库项目):

android.library.reference.1=../Common
android.library.reference.2=../facebook
# Project target.
target=Google Inc.:Google APIs:8

常见(库项目):

android.library=true
# Project target.
target=Google Inc.:Google APIs:8

facebook(库项目):

android.library=true
# Project target.
target=Google Inc.:Google APIs:8

寻找一种方法来找出错误消息中的行号和/或运行此问题的问题。我还有一个 build.properties 文件,我已将其包含在 AppMain build.xml 文件中,以指定用于创建签名 apk 的 key.store key.alias 值,我假设我可以在之后将其添加回 build.xml这个问题已经解决。

After installing Android SDK tools revision 14(ant version 1.8.2 when doing ant -version) to install and test our apps on Android 4.0(ICS), I've noticed that our automatic build script is now failing. The build script is executing an ant command to build the apk, which after the revision update complained about the build.xml file being out of date and to execute the ant update project -p to fix this. Our project has a top level project and two library projects it references, all developed in IntelliJ. I ran the update project command in each project folder after deleting out the old build.xml file. Now I'm getting the following message:

<SDK_DIR>/tools/ant/build.xml:466: The following error occurred while executing this line:
<SDK_DIR>/tools/ant/build.xml:539: The following error occurred while executing this line:
<SDK_DIR>/tools/ant/build.xml:568: null returned: 1

I've included the code for the main project and library projects build.xml file below(same for each):

<?xml version="1.0" encoding="UTF-8"?>
<project name="LaunchActivity" default="help">
    <loadproperties srcFile="local.properties" />
    <property file="ant.properties" />
    <loadproperties srcFile="project.properties" />
    <fail 
        message="sdk.dir is missing. Make sure to generate local.properties using 'android update project'"
        unless="sdk.dir"
/>
    <import file="${sdk.dir}/tools/ant/build.xml" />
</project>

With the new project.properties files(below):
AppMain(non-library project):

android.library.reference.1=../Common
android.library.reference.2=../facebook
# Project target.
target=Google Inc.:Google APIs:8

Common(library project):

android.library=true
# Project target.
target=Google Inc.:Google APIs:8

facebook(library project):

android.library=true
# Project target.
target=Google Inc.:Google APIs:8

Looking for a way to find out what's at the line number in the error message and/or the issue in getting this to run. I also have a build.properties file that I had included in the AppMain build.xml file to specify key.store key.alias values for creating a signed apk, which I'm assuming I can add back in to the build.xml after this issue is resolved.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

把昨日还给我 2024-12-18 06:37:12

我发布的错误非常模糊。因此,深入研究后,我发现有一种方法可以指定 Ant 日志文件。我这样做了,发现它在编译时崩溃了。事实证明,新编译器不喜欢生成 R 类中的一些资源名称相同。我重命名了那些有冲突的项目,并在解决了几个编译问题之后(显然在这个编译器版本中使用 R.id. 的 case 语句是禁忌),我能够让它工作。 Ant LogFile 绝对是调试这个问题的方法。以下是我在发出 ant release 命令时用来生成日志文件的内容:

ant -logfile //antLogFile.txt release -f ./AppMain/build.xml

The error I posted was pretty vague. So digging in a bit more, I discovered there was a way to specify an Ant logFile. I did this and found out that it was blowing up on compile. Turns out the new compiler didnt like that a few resource names in the generate R classes were the same. I renamed the ones that conflicted and after wading through a couple more compilation issues(case statements with R.id. was a no-no in this compiler version apparently) I was able to get this to work. The Ant LogFile was definitely the way to go to debug this issue. The following is what I used to generate a logFile while issuing the ant release command:

ant -logfile //antLogFile.txt release -f ./AppMain/build.xml

抚你发端 2024-12-18 06:37:12

就我而言,发生此错误只是因为我的资源之一的文件名中有大写字母。我重命名了资源及其引用,错误就消失了。

In my case this error occurred simply because one of my resources had a capital letter in the filename. I renamed the resource and references to it, and the error went away.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文