Build error referencing build.xml and proguard file: "null returned: 1"
Asked Answered
M

7

9

While building my PhoneGap app (with the Facebook SDK plugin installed), I encountered this error:

BUILD FAILED C:\adt-bundle-windows-x86_64-20130522\sdk\tools\ant\build.xml:653: The following error occured while executing this line: C:\adt-bundle-windows-x86_64-20130522\sdk\tools\ant\build.xml:698: null returned: 1

Line 653 is:

<do-only-if-manifest-hasCode elseText="hasCode = false. Skipp aidl/renderscript/R.java">

Line 698 is:

proguardFile="${out.absolute.dir}/proguard.txt"

My solutions so far include the following:

  1. Ran android update project to force generation of the proguard-project.txt file, as well as update the local.properties and project.properties file.
  2. Edited C:\adt-bundle-windows-x86_64-20130522\sdk\tools\ant\build.xml so that all mentions to proguard.txt become proguard-project.txt.
  3. ran ant -logfile ./antLogFile.txt release. Here is the log file.

-set-mode-check:

-set-release-mode:

-release-obfuscation-check: [echo] proguard.config is C:\adt-bundle-windows-x86_64-20130522\sdk/tools/proguard/proguard-android.txt:proguard-project.txt [echo] Proguard.config is enabled

-pre-build:

-check-env: [checkenv] Android SDK Tools Revision 22.6.2 [checkenv] Installed at C:\adt-bundle-windows-x86_64-20130522\sdk

-setup: [echo] Project Name: HelloWorld [gettype] Project Type: Application

-build-setup: [getbuildtools] Using latest Build Tools: 19.0.3 [echo] Resolving Build Target for HelloWorld... [gettarget] Project Target: Android 2.3.3 [gettarget] API level: 10 [gettarget] WARNING: Attribute minSdkVersion in AndroidManifest.xml (14) is higher than the project target API level (10) [echo] ---------- [echo] Creating output directories if needed... [echo] ---------- [echo] Resolving Dependencies for HelloWorld... [dependency] Library dependencies: [dependency] [dependency] ------------------ [dependency] Ordered libraries: [dependency] [dependency] ------------------ [dependency] API<=15: Adding annotations.jar to the classpath. [echo] ---------- [echo] Building Libraries with 'release'...

nodeps:

-set-mode-check:

-set-release-mode:

-release-obfuscation-check: [echo] proguard.config is C:\adt-bundle-windows-x86_64-20130522\sdk/tools/proguard/proguard-android.txt:proguard-project.txt [echo] Proguard.config is enabled

-pre-build:

-check-env: [checkenv] Android SDK Tools Revision 22.6.2 [checkenv] Installed at C:\adt-bundle-windows-x86_64-20130522\sdk

-setup: [echo] Project Name: facebook [gettype] Project Type: Android Library

-build-setup: [getbuildtools] Using latest Build Tools: 19.0.3 [echo] Resolving Build Target for facebook... [gettarget] Project Target: Android 2.3.3 [gettarget] API level: 10 [echo] ---------- [echo] Creating output directories if needed... [mkdir] Created dir: C:\Users\brian.lee\Desktop\Eclipse Workspace\chumba_connect_trunk_new\facebook-android-sdk-3.14.1\facebook\bin\rsObj [mkdir] Created dir: C:\Users\brian.lee\Desktop\Eclipse Workspace\chumba_connect_trunk_new\facebook-android-sdk-3.14.1\facebook\bin\rsLibs [echo] ---------- [echo] Resolving Dependencies for facebook... [dependency] Library dependencies: [dependency] No Libraries [dependency] [dependency] ------------------ [dependency] API<=15: Adding annotations.jar to the classpath.

-code-gen: [mergemanifest] Found Deleted Target File [mergemanifest] Merging AndroidManifest files into one. [mergemanifest] Manifest merger disabled. Using project manifest only. [echo] Handling aidl files... [aidl] No AIDL files to compile. [echo] ---------- [echo] Handling RenderScript files... [echo] ---------- [echo] Handling Resources... [aapt] Generating resource IDs... [aapt] invalid resource directory name: C:\Users\brian.lee\Desktop\Eclipse Workspace\chumba_connect_trunk_new\facebook-android-sdk-3.14.1\facebook\bin\res/crunch

BUILD FAILED C:\adt-bundle-windows-x86_64-20130522\sdk\tools\ant\build.xml:601: The following error occurred while executing this line: C:\adt-bundle-windows-x86_64-20130522\sdk\tools\ant\build.xml:653: The following error occurred while executing this line: C:\adt-bundle-windows-x86_64-20130522\sdk\tools\ant\build.xml:698: null returned: 1

Total time: 2 seconds

All of my attempts yielded no progress. Why does this error occur? What must I do to build successfully?

Metamathematics answered 20/5, 2014 at 7:20 Comment(0)
M
31

Close Eclipse and then run ant clean in your project folder.

Metamathematics answered 21/5, 2014 at 5:12 Comment(2)
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"Dedie
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.Dedie
S
4

For me: I had

edited my config.xml wrongly

. Try undoing your edits or placing a generic config.xml then see if she builds.

Stocky answered 10/9, 2014 at 16:36 Comment(0)
C
2

Verify your JAVA_HOME variable is correctly set to some path like C:\Program Files\Java\jdk1.7.0_67\ and if the error still goes on, it may be solved going to the build.xml and setting true to the variable fork, or the passed variable ${need.javac.fork}, which sets fork´s value in:

fork="${need.javac.fork}"

Cypripedium answered 25/11, 2014 at 17:43 Comment(0)
D
2

For me, conflicting build targets were at fault. Needed to change project.properties in my library directory (which was appcompat) to 'target=android-21', instead of android-19 which I had before. If you encounter a similar error and the previous answer (ant clean) does not work, check all the build targets.

Dedie answered 13/12, 2014 at 18:33 Comment(0)
U
0

You may also want to make sure your local.properties has the path to your sdk: sdk.dir=/path/to/adt/sdk

Uncut answered 1/10, 2014 at 22:33 Comment(0)
E
0

In order to determine if the problem comes from your development environment or from a mistake in the project i recommend everybody to try to create a new project from the cordova CLI.

  • Open terminal
  • Type cordova create foo; cd foo;
  • Type cordova platform add android
  • Type cordova build

Does it works? So the problem is on your project configuration. This was my mistake: In order to add icons to the application I've create a folder called android inside `foo/plataforms/android/res/{android/icon*.png}

The correct way to add icons is to create the folder res in root of the project foo/{res/android/icon*.png}

And then, add this files into the configuration file as follows:

<platform name="android">
              <icon src="res/android/[email protected]" density="ldpi" />
              <icon src="res/android/[email protected]" density="mdpi" />
              <icon src="res/android/[email protected]" density="hdpi" />
              <icon src="res/android/[email protected]" density="xhdpi" />
     </platform>
Expand answered 14/1, 2015 at 10:15 Comment(0)
G
-1

I had the same issue, I solved it this way:

Go to the framework directory in the project, and type these commands to build the jar file (you will need to have ant installed to generate the jar file, but it should be on your system already):

android update project -p . -t android-23

ant jar

So just make sure what type of android you have because you may have tried android-19.

Gahl answered 17/2, 2016 at 21:20 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.