Cordova returning following error on build
cordova build
Please find the attached log below
Total time: 2.77 secs
/home/user/Softwares/phonegap/hello/platforms/android/cordova/node_modules/q/q.js:126
throw e;
^
Error code 1 for command: /home/user/Softwares/phonegap/hello/platforms/android/gradlew with args: cdvBuildDebug,-b,/home/user/Softwares/phonegap/hello/platforms/android/build.gradle,-Dorg.gradle.daemon=true
ERROR building one of the platforms: Error: /home/user/Softwares/phonegap/hello/platforms/android/cordova/build: Command failed with exit code 8
You may not have the required environment or OS to build this project
Error: /home/user/Softwares/phonegap/hello/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:134:23)
at ChildProcess.EventEmitter.emit (events.js:98:17)
at maybeClose (child_process.js:743:16)
at Process.ChildProcess._handle.onexit (child_process.js:810:5)
user#user-Inspiron-1525:~/Softwares/phonegap/hello$ vi ~/.profile
user#user-Inspiron-1525:~/Softwares/phonegap/hello$ which android
/usr/local/android-sdk-linux/tools/android
user#user-Inspiron-1525:~/Softwares/phonegap/hello$ ls -ltr /usr/local/android-sdk-linux/tools/android
-rwxrwxrwx 1 144773 5000 3498 Jun 18 08:12 /usr/local/android-sdk-linux/tools/android
The environmental variables are below
export ANDROID_HOME="/usr/local/android-sdk-linux"
export ANDROID_PLATFORM_TOOLS="/usr/local/android-sdk-linux/platform-tools"
export PATH="$PATH:$ANDROID_HOME:$ANDROID_PLATFORM_TOOLS"
i could create a project using cordova. But, while doing cordova build am getting the error.
Please help to resolve the same ..
Related
After some updates to Android Studio and Apache Cordova my Apache Cordova project is not building.
I am new to Apache Cordova, OS X and Android Studio.
In Android Studio when I Rebuild Project I get the following error in the Gradle console.
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':compileDebugJavaWithJavac'.
> Compilation failed; see the compiler error output for details.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
In the terminal when I run the command cordova --version it prints out 4.0.0 and which javac prints out /usr/bin/javac but echo $JAVA_HOME prints nothing (an empty line).
UPDATE: I am setting the path of JAVA_HOME and ANDROID_HOME in the terminal even though I get the same errors as shown below and after closing the terminal the JAVA_HOME and ANDROID_HOME environment variables are lost, I set them as export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_51.jdk/Contents/Home and export ANDROID_HOME=/Users/apple/Library/Android/sdk
When I try to build the project from Cordova CLI also it is not working.
I get the following errors, where as if I create a new project after changing the distributionUrl in gradle-wrapper.properties and changing the buildToolsVersion from "19.0.0" to "19.1.0" the new project worked fine.
Please help.
cordova compile command
Sreekanth-2:19:02:16 Sreekanth$ cordova compile
Running command: "/Users/apple/Desktop/Sreekanth/Togetherly Daily Work/19:02:16/platforms/android/cordova/build"
Buildfile: /Users/apple/Desktop/Sreekanth/Togetherly Daily Work/19:02:16/platforms/android/build.xml
BUILD FAILED
/Users/apple/Desktop/Sreekanth/Togetherly Daily Work/19:/Users/apple/Desktop/Sreekanth/Togetherly Daily Work/19:02:16/platforms/android/build.xml:7: The following error occurred while executing this line:
java.io.FileNotFoundException: /Users/apple/Desktop/Sreekanth/Togetherly Daily Work/19:/usr/local/Cellar/ant/1.9.7/libexec/lib/ant.jar (No such file or directory)
at java.io.RandomAccessFile.open0(Native Method)
at java.io.RandomAccessFile.open(RandomAccessFile.java:316)
at java.io.RandomAccessFile.<init>(RandomAccessFile.java:243)
at org.apache.tools.zip.ZipFile.<init>(ZipFile.java:212)
at org.apache.tools.zip.ZipFile.<init>(ZipFile.java:177)
at org.apache.tools.ant.helper.ProjectHelper2.parse(ProjectHelper2.java:256)
at org.apache.tools.ant.helper.ProjectHelper2.parseUnknownElement(ProjectHelper2.java:131)
at org.apache.tools.ant.helper.ProjectHelper2.parseAntlibDescriptor(ProjectHelper2.java:111)
at org.apache.tools.ant.taskdefs.Antlib.createAntlib(Antlib.java:94)
at org.apache.tools.ant.taskdefs.Definer.loadAntlib(Definer.java:425)
at org.apache.tools.ant.taskdefs.Definer.execute(Definer.java:277)
at org.apache.tools.ant.ComponentHelper.checkNamespace(ComponentHelper.java:874)
at org.apache.tools.ant.ComponentHelper.getDefinition(ComponentHelper.java:307)
at org.apache.tools.ant.ComponentHelper.createComponent(ComponentHelper.java:284)
at org.apache.tools.ant.ComponentHelper.createComponent(ComponentHelper.java:263)
at org.apache.tools.ant.UnknownElement.makeObject(UnknownElement.java:430)
at org.apache.tools.ant.UnknownElement.maybeConfigure(UnknownElement.java:164)
at org.apache.tools.ant.Task.perform(Task.java:347)
at org.apache.tools.ant.Target.execute(Target.java:435)
at org.apache.tools.ant.helper.ProjectHelper2.parse(ProjectHelper2.java:180)
at org.apache.tools.ant.ProjectHelper.configureProject(ProjectHelper.java:93)
at org.apache.tools.ant.Main.runBuild(Main.java:829)
at org.apache.tools.ant.Main.startAnt(Main.java:236)
at org.apache.tools.ant.launch.Launcher.run(Launcher.java:285)
at org.apache.tools.ant.launch.Launcher.main(Launcher.java:112)
Total time: 0 seconds
/Users/apple/Desktop/Sreekanth/Togetherly Daily Work/19:02:16/platforms/android/cordova/node_modules/q/q.js:126
throw e;
^
Error code 1 for command: ant with args: debug,-f,/Users/apple/Desktop/Sreekanth/Togetherly Daily Work/19:02:16/platforms/android/build.xml,-Dout.dir=ant-build,-Dgen.absolute.dir=ant-gen
Error: /Users/apple/Desktop/Sreekanth/Togetherly Daily Work/19:02:16/platforms/android/cordova/build: Command failed with exit code 1
at ChildProcess.whenDone (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/cordova/superspawn.js:135:23)
at ChildProcess.emit (events.js:110:17)
at maybeClose (child_process.js:1015:16)
at Process.ChildProcess._handle.onexit (child_process.js:1087:5)
cordova build command
Sreekanth-2:19:02:16 Sreekanth$ cordova build
Running command: "/Users/apple/Desktop/Sreekanth/Togetherly Daily Work/19:02:16/platforms/android/cordova/build"
Buildfile: /Users/apple/Desktop/Sreekanth/Togetherly Daily Work/19:02:16/platforms/android/build.xml
BUILD FAILED
/Users/apple/Desktop/Sreekanth/Togetherly Daily Work/19:/Users/apple/Desktop/Sreekanth/Togetherly Daily Work/19:02:16/platforms/android/build.xml:7: The following error occurred while executing this line:
java.io.FileNotFoundException: /Users/apple/Desktop/Sreekanth/Togetherly Daily Work/19:/usr/local/Cellar/ant/1.9.7/libexec/lib/ant.jar (No such file or directory)
at java.io.RandomAccessFile.open0(Native Method)
at java.io.RandomAccessFile.open(RandomAccessFile.java:316)
at java.io.RandomAccessFile.<init>(RandomAccessFile.java:243)
at org.apache.tools.zip.ZipFile.<init>(ZipFile.java:212)
at org.apache.tools.zip.ZipFile.<init>(ZipFile.java:177)
at org.apache.tools.ant.helper.ProjectHelper2.parse(ProjectHelper2.java:256)
at org.apache.tools.ant.helper.ProjectHelper2.parseUnknownElement(ProjectHelper2.java:131)
at org.apache.tools.ant.helper.ProjectHelper2.parseAntlibDescriptor(ProjectHelper2.java:111)
at org.apache.tools.ant.taskdefs.Antlib.createAntlib(Antlib.java:94)
at org.apache.tools.ant.taskdefs.Definer.loadAntlib(Definer.java:425)
at org.apache.tools.ant.taskdefs.Definer.execute(Definer.java:277)
at org.apache.tools.ant.ComponentHelper.checkNamespace(ComponentHelper.java:874)
at org.apache.tools.ant.ComponentHelper.getDefinition(ComponentHelper.java:307)
at org.apache.tools.ant.ComponentHelper.createComponent(ComponentHelper.java:284)
at org.apache.tools.ant.ComponentHelper.createComponent(ComponentHelper.java:263)
at org.apache.tools.ant.UnknownElement.makeObject(UnknownElement.java:430)
at org.apache.tools.ant.UnknownElement.maybeConfigure(UnknownElement.java:164)
at org.apache.tools.ant.Task.perform(Task.java:347)
at org.apache.tools.ant.Target.execute(Target.java:435)
at org.apache.tools.ant.helper.ProjectHelper2.parse(ProjectHelper2.java:180)
at org.apache.tools.ant.ProjectHelper.configureProject(ProjectHelper.java:93)
at org.apache.tools.ant.Main.runBuild(Main.java:829)
at org.apache.tools.ant.Main.startAnt(Main.java:236)
at org.apache.tools.ant.launch.Launcher.run(Launcher.java:285)
at org.apache.tools.ant.launch.Launcher.main(Launcher.java:112)
Total time: 0 seconds
/Users/apple/Desktop/Sreekanth/Togetherly Daily Work/19:02:16/platforms/android/cordova/node_modules/q/q.js:126
throw e;
^
Error code 1 for command: ant with args: debug,-f,/Users/apple/Desktop/Sreekanth/Togetherly Daily Work/19:02:16/platforms/android/build.xml,-Dout.dir=ant-build,-Dgen.absolute.dir=ant-gen
Error: /Users/apple/Desktop/Sreekanth/Togetherly Daily Work/19:02:16/platforms/android/cordova/build: Command failed with exit code 1
at ChildProcess.whenDone (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/cordova/superspawn.js:135:23)
at ChildProcess.emit (events.js:110:17)
at maybeClose (child_process.js:1015:16)
at Process.ChildProcess._handle.onexit (child_process.js:1087:5)
Sreekanth-2:19:02:16 Sreekanth$
Go to Project.Properties
add the following lines
cordova.system.library.1=com.google.android.gms:play-services-auth:9.8.0
cordova.system.library.2=com.google.android.gms:play-services-identity:9.8.0
run the cordova commands again, You can able to build a release and debug builds
Type the following in your terminal
echo "export JAVA_HOME=/usr/libexec/java_home"
This will print the exact export for Java_home , copy that and paste it in terminal and press enter.
Then try echo $java_home.
I have been building my phonegap app in node.js without any problem. Suddenly when I tried to build now, it is showing some error and apk is not getting created.
Here is the error :
C:\testapp\platforms\android\cordova\node_modules\q\q.js:126
throw e;
^
Error code 1 for command: cmd with args: /s /c "ant debug -f C:\testapp\platform
s\android\build.xml -Dout.dir=ant-build -Dgen.absolute.dir=ant-gen"
ERROR building one of the platforms: Error: C:\testapp\platforms\android\cordova
\build.bat: Command failed with exit code 1
You may not have the required environment or OS to build this project
Error: C:\testapp\platforms\android\cordova\build.bat: Command failed with exit
code 1
at ChildProcess.whenDone (C:\Users\Vaishakh\AppData\Roaming\npm\node_modules
\cordova\node_modules\cordova-lib\src\cordova\superspawn.js:131:23)
at ChildProcess.emit (events.js:110:17)
at maybeClose (child_process.js:1008:16)
at Process.ChildProcess._handle.onexit (child_process.js:1080:5)
I haven't tweaked any system settings/properties. I haven't changed or uninstalled anything. This happened suddenly. I tried restarting but it didn't work.
I have tried to create the cordova latest application using command line interface. When I tried to build the application using CLI, the following error occurs:
-pre-compile:<
BUILD FAILED
C:\Users\user\Desktop\HelloAndroid\platforms\android\custom_rules.xml:5: Reference project.all.jars.path not found.
Total time: 2 seconds
Error code 1 for command: cmd with args: /s,/c,ant,debug,-f,C:\Users\user\Desktop\HelloAndroid\platforms\android\build.xml,-Dout.dir=ant-build,-Dgen.absolute.dir=ant-gen
Error: C:\Users\user\Desktop\HelloAndroid\platforms\android\cordova\build.bat: Command failed with exit code 2
at ChildProcess.whenDone (C:\Users\user\AppData\Roaming\npm\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)
C:\Users\user\Desktop\HelloAndroid>
I'm developing an apache cordova app. Suddenly I am not able to build the app successfully. I've been testing it for three days in iOs, so I can not remember what could be the cause of this error (iOS platform is compiling well). Please help, I'm lost here. Thanks in advance
BUILD FAILED
/Users/darkland/Development/sdk/tools/ant/build.xml:892: The following error occurred while executing this line:
/Users/darkland/Development/sdk/tools/ant/build.xml:894: The following error occurred while executing this line:
/Users/darkland/Development/sdk/tools/ant/build.xml:906: The following error occurred while executing this line:
/Users/darkland/Development/sdk/tools/ant/build.xml:284: null returned: 1
Error code 1 for command: ant with args: debug,-f,/Users/darkland/NetBeansProjects/Palmfest/platforms/android/build.xml,-Dout.dir=ant-build,-Dgen.absolute.dir=ant-gen
Error: /Users/darkland/NetBeansProjects/Palmfest/platforms/android/cordova/build: Command failed with exit code 2
at ChildProcess.whenDone (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/cordova/superspawn.js:131:23)
at ChildProcess.EventEmitter.emit (events.js:98:17)
at maybeClose (child_process.js:743:16)
at Process.ChildProcess._handle.onexit (child_process.js:810:5)
i'm building an android app with about 4Gig of local files ( most of them are songs ).
When i build my application for android using "cordova build android" command, i get the following error:
Compiling app on platform "android" via command
/Users/yveswebit/Desktop/APP/platforms/android/cordova/build
/usr/local/lib/node_modules/cordova/node_modules/q/q.js:126
throw e;
^
Error: An error occurred while building the android project.Error executing "ant debug -f "/Users/yveswebit/Desktop/APP/platforms/android/build.xml"":
BUILD FAILED
/Development/adt-bundle/sdk/tools/ant/build.xml:932: The following error occurred while executing this line:
/Development/adt-bundle/sdk/tools/ant/build.xml:950: null returned: 1
Total time: 23 seconds
at ChildProcess.<anonymous> (/usr/local/lib/node_modules/cordova/src/compile.js:65:22)
at ChildProcess.EventEmitter.emit (events.js:98:17)
at maybeClose (child_process.js:735:16)
at Process.ChildProcess._handle.onexit (child_process.js:802:5)
When i'm builing my application with less songs, the build is succesfully.
Thanks for help