Phonegap/Cordova build android node_modules/q/q.js throw e;


#1

cordova build anroid gives me the following err

node_modules/q/q.js:126 throw e; (*error details)
This question has been asked before, but the typical answer regarding PATH and ANDROID_HOME hasn’t worked for me.

I’ve put this into code snippet to avoid SO submission problems

export HOME="/Users/rover"
export ANDROID_SDK="$HOME/Documents/Dev/Android/adt-bundle-mac-x86_64-20140702/sdk"
export ANDROID_HOME="$ANDROID_SDK/tools"
export ANDROID_PLATFORM_TOOLS="$ANDROID_SDK/platform-tools"
export PATH="$ANDROID_HOME:$ANDROID_PLATFORM_TOOLS:$ANDROID_SDK/build-tools:$PATH"
export ANT_HOME="/usr/local/bin/ant"
#export PATH="$PATH:$ANT_HOME/bin"
My environment variables:

$ set | grep “ANDROID|PATH”

ANDROID_HOME=/Users/rover/Documents/Dev/Android/adt-bundle-mac-x86_64-20140702/sdk/tools ANDROID_PLATFORM_TOOLS=/Users/rover/Documents/Dev/Android/adt-bundle-mac-x86_64-20140702/sdk/platform-tools ANDROID_SDK=/Users/rover/Documents/Dev/Android/adt-bundle-mac-x86_64-20140702/sdk PATH=/Users/rover/Documents/Dev/Android/adt-bundle-mac-x86_64-20140702/sdk/tools:/Users/rover/Documents/Dev/Android/adt-bundle-mac-x86_64-20140702/sdk/platform-tools:/Users/rover/Documents/Dev/Android/adt-bundle-mac-x86_64-20140702/sdk/build-tools:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin

$ which ant
/usr/local/bin/ant
$ ls /usr/local/bin/ant
/usr/local/bin/ant

$ cordova --version
4.0.0

$ ant -v
Apache Ant™ version 1.9.4
I’m on Mac OSX 10.10 (Yosemite) which might have a problem with Java 8. Can this be related?

$ java -version java version “1.8.0_05” Java™ SE Runtime Environment (build 1.8.0_05-b13) Java HotSpot™ 64-Bit Server VM (build 25.5-b02, mixed mode)

$ ant --execdebug
exec “/Library/Java/JavaVirtualMachines/jdk1.8.0_05.jdk/Contents/Home/jre/bin/java” -classpath “/usr/local/Cellar/ant/1.9.4/libexec/lib/ant-launcher.jar” -Dant.home="/usr/local/Cellar/ant/1.9.4/libexec" -Dant.library.dir="/usr/local/Cellar/ant/1.9.4/libexec/lib" org.apache.tools.ant.launch.Launcher -cp “”

(*error details)

BUILD FAILED
/Users/rover/Documents/Dev/Android/adt-bundle-mac-x86_64-20140702/sdk/tools/ant/build.xml:653: The following error occurred while executing this line:
/Users/rover/Documents/Dev/Android/adt-bundle-mac-x86_64-20140702/sdk/tools/ant/build.xml:698: null returned: 1

Total time: 1 second

/Library/WebServer/Documents/Booster/core_ionic_git/platforms/android/cordova/node_modules/q/q.js:126
throw e;
^
Error code 1 for command: ant with args: debug,-f,/Library/WebServer/Documents/Booster/core_ionic_git/platforms/android/build.xml,-Dout.dir=ant-build,-Dgen.absolute.dir=ant-gen
Error: /Library/WebServer/Documents/Booster/core_ionic_git/platforms/android/cordova/build: Command failed with exit code 8
at ChildProcess.whenDone (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/cordova/superspawn.js:135:23)
at ChildProcess.emit (events.js:98:17)
at maybeClose (child_process.js:756:16)
at Process.ChildProcess._handle.onexit (child_process.js:823:5)
Any ideas on fixing this?


#2

Try: sudo cordova build android


#3

Right! That works for a new project, but not if I’m using the wizcorp facebook plugin and FacebookLib

Any ideas on this:

debug:

-code-gen:
[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: /Library/WebServer/Documents/Booster/ionic_git/platforms/android/FacebookLib/bin/res crunch

BUILD FAILED
/Users/rover/Documents/Dev/Android/adt-bundle-mac-x86_64-20140702/sdk/tools/ant/build.xml:653: The following error occurred while executing this line:
/Users/rover/Documents/Dev/Android/adt-bundle-mac-x86_64-20140702/sdk/tools/ant/build.xml:698: null returned: 1

Total time: 6 seconds

/Library/WebServer/Documents/Booster/ionic_git/platforms/android/cordova/node_modules/q/q.js:126
throw e;
^
Error code 1 for command: ant with args: debug,-f,/Library/WebServer/Documents/Booster/ionic_git/platforms/android/build.xml,-Dout.dir=ant-build,-Dgen.absolute.dir=ant-gen
Error: /Library/WebServer/Documents/Booster/ionic_git/platforms/android/cordova/build: Command failed with exit code 8
at ChildProcess.whenDone (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/cordova/superspawn.js:135:23)
at ChildProcess.emit (events.js:98:17)
at maybeClose (child_process.js:756:16)
at Process.ChildProcess._handle.onexit (child_process.js:823:5)


#4

Ever got this to work?


#5

Yes, but not yet with facebook plugin. For non facebook plugin, here’s a solution: http://stackoverflow.com/questions/26783594/phonegap-cordova-build-android-node-modules-q-q-js-throw-e

And, as pcr said:

Try: sudo cordova build android