问题
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:
- Ran
android update project
to force generation of theproguard-project.txt
file, as well as update thelocal.properties
andproject.properties
file. - Edited
C:\adt-bundle-windows-x86_64-20130522\sdk\tools\ant\build.xml
so that all mentions toproguard.txt
becomeproguard-project.txt
. - 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?
回答1:
Close Eclipse and then run ant clean
in your project folder.
回答2:
For me: I had
edited my config.xml wrongly
. Try undoing your edits or placing a generic config.xml then see if she builds.
回答3:
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}"
回答4:
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.
回答5:
You may also want to make sure your local.properties has the path to your sdk:
sdk.dir=/path/to/adt/sdk
回答6:
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/icon@ldpi.png" density="ldpi" />
<icon src="res/android/icon@mdpi.png" density="mdpi" />
<icon src="res/android/icon@hdpi.png" density="hdpi" />
<icon src="res/android/icon@xhdpi.png" density="xhdpi" />
</platform>
回答7:
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
.
来源:https://stackoverflow.com/questions/23753320/build-error-referencing-build-xml-and-proguard-file-null-returned-1