将 Android SDK 工具更新到修订版 14 后出现 Ant 问题 [英] Ant issue after updating Android SDK tools to revision 14

查看:36
本文介绍了将 Android SDK 工具更新到修订版 14 后出现 Ant 问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在安装 Android SDK 工具修订版 14(执行 ant -version 时为 ant 版本 1.8.2)以在 Android 4.0(ICS) 上安装和测试我们的应用程序后,我注意到我们的自动构建脚本现在失败了.构建脚本正在执行一个 ant 命令来构建 apk,在修订版更新后抱怨 build.xml 文件过时并执行 ant update project -p 来解决这个问题.我们的项目有一个顶级项目和两个它引用的库项目,都是在 IntelliJ 中开发的.删除旧的 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

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

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>

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

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

通用(库项目):

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

facebook(图书馆项目):

facebook(library project):

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

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

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.

推荐答案

我发布的错误非常模糊.再深入研究,我发现有一种方法可以指定 Ant 日志文件.我这样做了,发现它在编译时爆炸了.原来新的编译器不喜欢生成 R 类中的一些资源名称是相同的.我重命名了冲突的那些,并且在经历了更多的编译问题之后(在这个编译器版本中,带有 R.id. 的 case 语句显然是一个禁忌)我能够让它工作.Ant LogFile 绝对是调试这个问题的方法.以下是我在发出 ant release 命令时用来生成 logFile 的内容:

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

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

这篇关于将 Android SDK 工具更新到修订版 14 后出现 Ant 问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆