android-sdk/tools/ant/build.xml:698: null 返回: 1

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/25646856/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-20 09:36:49  来源:igfitidea点击:

android-sdk/tools/ant/build.xml:698: null returned: 1

androidantbuild

提问by jww

I'm trying to test a Android release build to make sure nothing unexpected occurs. While trying to build with ant from the command line:

我正在尝试测试 Android 发布版本以确保不会发生任何意外。在尝试从命令行使用 ant 构建时:

/usr/local/bin/ant release
...

BUILD FAILED
.../android-sdk/tools/ant/build.xml:653: The following error occurred while executing this line:
.../android-sdk/tools/ant/build.xml:698: null returned: 1

When I look at build.xml:698, the issue is with the Proguard file below.

当我查看时build.xml:698,问题出在下面的 Proguard 文件中。

<aapt executable="${aapt}"
    command="package"
    verbose="${verbose}"
    manifest="${out.manifest.abs.file}"
    originalManifestPackage="${project.app.package}"
    androidjar="${project.target.android.jar}"
    rfolder="${gen.absolute.dir}"
    nonConstantId="${android.library}"
    libraryResFolderPathRefid="project.library.res.folder.path"
    libraryPackagesRefid="project.library.packages"
    libraryRFileRefid="project.library.bin.r.file.path"
    ignoreAssets="${aapt.ignore.assets}"
    binFolder="${out.absolute.dir}"
    proguardFile="${out.absolute.dir}/proguard.txt">
    <res path="${out.res.absolute.dir}" />
    <res path="${resource.absolute.dir}" />
</aapt>

My project had a proguard-project.txt. After renaming to proguard.txt, the problem persists.

我的项目有一个proguard-project.txt. 改名后proguard.txt问题依旧。

I'm happy to omit the Proguard step since I don't use it.

我很高兴省略 Proguard 步骤,因为我不使用它。

How do I resolve this issue?

我该如何解决这个问题?



In case it matters:

如果重要:

$ /usr/local/bin/ant -v
Apache Ant(TM) version 1.9.4 compiled on April 29 2014

I needed to upgrade ant due to an error, but I don't recall what the error was. I seem to recall it had something to do with Java 7 or Java 8.

由于错误,我需要升级 ant,但我不记得错误是什么。我似乎记得它与 Java 7 或 Java 8 有关。

回答by Tzafrir

Had the same error. found the fix at https://stackoverflow.com/a/23774435. close eclipse. and run 'ant clean'

有同样的错误。在https://stackoverflow.com/a/23774435找到修复。关闭日食。并运行“蚂蚁清理”

回答by Nagabhushan Baddi

change project.properties in appcompat directory to 'target=android-21', or Close Eclipse and then run ant clean in your project folder , if the first doesnt work

将 appcompat 目录中的 project.properties 更改为“target=android-21”,或者关闭 Eclipse 然后在您的项目文件夹中运行 ant clean 如果第一个不起作用

回答by Yakob Ubaidi

Just happened to me and what I did to solved this is by removing the platform and re-adding it again.

刚刚发生在我身上,我为解决这个问题所做的是删除平台并重新添加它。

cordova platform rm android

then

然后

cordova platform add android

回答by suprandr

I know that this problem can be caused by many things, however in my case I couldn't build because of a malformed config.xml. I forgot to add the gap: namespace which was used to build with build.phonegap.com

我知道这个问题可能是由很多原因引起的,但是在我的情况下,由于 config.xml 格式错误,我无法构建。我忘了添加 gap: 用于使用 build.phonegap.com 构建的命名空间

<widget id="appid" version="0.0.1" xmlns="http://www.w3.org/ns/widgets" xmlns:gap="http://phonegap.com/ns/1.0" xmlns:cdv="http://cordova.apache.org/ns/1.0">

回答by vabic

I got the same error. The problem is in the 64-bit library. Try to install:

我得到了同样的错误。问题出在 64 位库中。尝试安装:

sudo apt-get install lib32z1

回答by Doric Soft

Fixed it by removing some png files that I had in res folder.

通过删除我在 res 文件夹中的一些 png 文件来修复它。