13

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:

/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.

<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.

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

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.

jww
  • 97,681
  • 90
  • 411
  • 885

7 Answers7

15

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

Community
  • 1
  • 1
Tzafrir
  • 639
  • 8
  • 15
  • 1
    Doesn't help me... Exactly the same error, but only if I insert appcompat library project from the latest Google update. If I use the older appcompat, builds fine. Tried exiting IntelliJ Idea (as I'm not using Eclipse) and running manually ant clean - nothing... Happens with Ant 1.8.2 and 1.9.4. exactly the same error: ".../android-sdk/tools/ant/build.xml:698: null returned: 1" – gregko Dec 13 '14 at 17:56
  • 2
    Fixed. Conflicting build targets were at fault. Needed to change project.properties in appcompat directory to 'target=android-21', instead of android-19 which I had before. – gregko Dec 13 '14 at 18:31
  • 1
    Thanks, but I'm using `ant` from the command line; and not from within Eclipse. – jww May 26 '15 at 07:55
4

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

Nagabhushan Baddi
  • 1,164
  • 10
  • 18
  • Thanks, but I'm using `ant` from the command line; and not from within Eclipse. – jww May 26 '15 at 07:55
3

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
Yakob Ubaidi
  • 1,846
  • 2
  • 20
  • 23
1

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

<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">
superandrew
  • 1,741
  • 19
  • 35
0

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

sudo apt-get install lib32z1
Michał Perłakowski
  • 88,409
  • 26
  • 156
  • 177
vabic
  • 1
0

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

0

If the you are trying to install the Flutter SDK, and you encounter:

error installing flutter null returned 1

just restarting the machine worked for me.

Elletlar
  • 3,136
  • 7
  • 32
  • 38