hello
I am trying to build hybrid app with ionic and cordova
at first i run below commands and they run successfully
but after running the last command i get this error
ionic start firtApp
cd firtApp
ionic platform add android
note: it return me android-21 error, and i changed the android-21 to android-18, and it runs successfully
ionic build android
after running the above command i got this error
BUILD FAILED
D:\New folder\android-sdk-final\android-sdk-fully\sdk\tools\ant\build.xml:601: T
he following error occurred while executing this line:
D:\New folder\android-sdk-final\android-sdk-fully\sdk\tools\ant\build.xml:542: U
nable to resolve project target 'android-21'
Total time: 1 second
C:\Users\Mohammad\firstapp\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:\Users\Mohammad\f
irstapp\platforms\android\build.xml -Dout.dir=ant-build -Dgen.absolute.dir=ant-g
en"
ERROR building one of the platforms: Error: C:\Users\Mohammad\firstapp\platforms
\android\cordova\build.bat: Command failed with exit code 8
You may not have the required environment or OS to build this project
Error: C:\Users\Mohammad\firstapp\platforms\android\cordova\build.bat: Command f
ailed with exit code 8
at ChildProcess.whenDone (C:\Users\Mohammad\AppData\Roaming\npm\node_modules
\cordova\node_modules\cordova-lib\src\cordova\superspawn.js:131: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)
please help me with this error
i really like to bulid hybrid apps with my web knowledge
thanks.
You can try this
Go to this directory
C:\Users\Mohammad\.cordova\lib\npm_cache\cordova-android\3.6.4\package\framework
Edit project.properties file. Change target to 19.
# This file is automatically generated by Android Tools.
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
#
# This file must be checked in Version Control Systems.
#
# To customize properties used by the Ant build system use,
# "ant.properties", and override values to adapt the script to your
# project structure.
# Indicates whether an apk should be generated for each density.
split.density=false
# Project target.
target=android-19
apk-configurations=
renderscript.opt.level=O0
android.library=true
Restart your terminal.
You don't have SDK correctly installed on you computer. (Path or SDK update)
It's write on your error log : You may not have the required environment or OS to build this project
you just need to install ant
sudo apt-get install ant
then do the same as before,its work correctly
Related
I'm trying to build an android application using gomobile but the commands gomobile install and gomobile build fail with gomobile: EOF . Before this error I was getting this error:
# golang.org/x/mobile/gl
In file included from /root/go/src/golang.org/x/mobile/gl/gl.go:17:0:
work.h:6:23: fatal error: GLES2/gl2.h: No such file or directory
compilation terminated. but it was fixed with yum install make gcc mesa-libGLES-devel mesa-libEGL-devel.
The application is mostly a networking application. Here are the imports. Do only certain packages work with gomobile or all of them?
"golang.org/x/mobile/app"
"golang.org/x/net/websocket"
"os/exec"
"flag"
"fmt"
log "github.com/golang/glog"
"io/ioutil"
"net"
"net/http"
"net/url"
"strconv"
OS: Fedora 22.
More info: I'm able to build https://github.com/golang/mobile/blob/master/example/network/main.go so I can only assume the issue is specific to my application.
It failed because AndroidManifest.xml was empty.
Here is a PATH in environment :
C:\Users\user\AppData\Roaming\npm;D:\work\SDK\SoftPhonegap\ADT\sdk\platform-tools;D:\work\SDK\SoftPhonegap\ADT\sdk\tools;D:\work\SDK\SoftPhonegap\apache-ant-1.9.5\bin;C:\Program Files (x86)\Git\bin;C:\Program Files (x86)\Java\jdk1.7.0_51\bin;C:\Program Files\Java\jdk1.8.0_45\bin;D:\work\SDK\SoftPhonegap\ADT\sdk\build-tools
A. Error log of cordova build android
BUILD FAILED
D:\work\SDK\SoftPhonegap\ADT\sdk\tools\ant\build.xml:601: The following error oc
curred while executing this line:
D:\work\SDK\SoftPhonegap\ADT\sdk\tools\ant\build.xml:542: Unable to resolve proj
ect target 'android-21'
Total time: 0 seconds
D:\work\SDK\SoftPhonegap\ADT\hello\platforms\android\cordova\node_modules\q\q.js
:126
throw e;
^
Error code 1 for command: cmd with args: /s /c "ant debug -f D:\work\SDK\SoftPho
negap\ADT\hello\platforms\android\build.xml -Dout.dir=ant-build -Dgen.absolute.d
ir=ant-gen"
ERROR building one of the platforms: Error: D:\work\SDK\SoftPhonegap\ADT\hello\p
latforms\android\cordova\build.bat: Command failed with exit code 8
You may not have the required environment or OS to build this project
Error: D:\work\SDK\SoftPhonegap\ADT\hello\platforms\android\cordova\build.bat: C
ommand failed with exit code 8
at ChildProcess.whenDone (C:\Users\user\AppData\Roaming\npm\node_modules\cor
dova\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)
B Error log of Ant
C:\Users\user>ant
Unable to locate tools.jar. Expected to find it in C:\Program Files\Java\jre1.8.
0_45\lib\tools.jar
Buildfile: build.xml does not exist!
Build failed
C. when add platform android
D:\work\SDK\SoftPhonegap\ADT\hello>cordova platform add android
npm http GET https://registry.npmjs.org/cordova-android/3.7.2
npm http 304 https://registry.npmjs.org/cordova-android/3.7.2
Adding android project...
Creating Cordova project for the Android platform:
Path: platforms\android
Package: com.example.hello
Name: HelloWorld
Android target: android-21
Copying template files...
Project successfully created.
Installing "com.phonegap.plugins.PushPlugin" for android
Installing "com.salesforce" for android
Installing "org.apache.cordova.device" for android
Could not run SalesforceMobileSDK plugin android pre-install script
You are running node v0.10.25
You need to be running node 0.12 or above
You won't be able to successfully run: cordova build
Running SalesforceMobileSDK plugin android post-install script
The "android" utility does not exist at D:\work\SDK\SoftPhonegap\ADT\sdk\tools;D
:\work\SDK\SoftPhonegap\ADT\sdk\platform-tools\tools\android.bat. Make sure you
've properly installed the Android SDK.
I think you need to give platform_tools pah also, you should post your error log,
anyway here is how my PATH looks like
C:\Users\amitabhs\AppData\Roaming\npm;F:\Softs\adt-bundle-windows-x86_64-20140702\adt-bundle-windows-x86_64-20140702\adt-bundle-windows-x86_64-20140702\sdk\platform-tools;F:\Softs\adt-bundle-windows-x86_64-20140702\adt-bundle-windows-x86_64-20140702\adt-bundle-windows-x86_64-20140702\sdk\tools;F:\Softs\adt-bundle-windows-x86_64-20140702\adt-bundle-windows-x86_64-20140702\adt-bundle-windows-x86_64-20140702\sdk\platforms;C:\Program Files\Java\jdk1.8.0_45\bin;C:\Program Files\apache-ant-1.9.5\bin;
check if it helps
Compile your project in https://build.phonegap.com/
There you have no problems with OS and can compile for all OS.
I use then for IOS compilation.
Solution:
Uninstall node v0.10.25
install node 0.12 or above
remove platform android (cordova platform rm android)
add platform android (cordova platform add android)
build android (cordova build android)
Done
I have created a Cordova Application Project using the CLI tool and NetBeans IDE for Cordova Project. I have also mapped the following path variables.
ANDROID_HOME F:\AndroidProjects\adt-bundle-windows-x86-20131030\
ANT_HOME C:\apache-ant-1.9.4\
JAVA_HOME C:\Program Files\Java\jdk1.8.0_25\
PATH C:\Users\Administrator\AppData\Roaming\npm;F:\Android Projects\adt-bundle-windows-x86-20131030\sdk\platform-tools\;F:\AndroidProjects\adt-bundle-windows-x86-20131030\SDK\TOOLS\;C:\Program Files\Java\jdk1.8.0_25\bin;%JAVA_HOME%\bin;C:\Program Files (x86)\Git\;C:\Program Files (x86)\Git\bin;%ANT_HOME%/bin;
I am also able to run the Demo Cordova Application on AVD and Real device,using eclipse. But, while trying to build the project with additional changes the CLI is giving me with the following error message
[Error: ANDROID_HOME is set to a non-existant path: F:\Android
Projects\adt-bund le-windows-x86-20131030] Command finished with error
code 2: F:\CordovaProjects\CordovaAppOne\platforms\a
ndroid\cordova\build.bat Error:
F:\CordovaProjects\CordovaAppOne\platforms\android\cordova\build.bat:
Com mand failed with exit code 2
at ChildProcess.whenDone (C:\Users\Administrator\AppData\Roaming\npm\node_mo
dules\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)
What should I set in addition to the above to resolve the error. I am using Windows8-64Bit on administrator account. Only Android platform has been added to the application using the CLI.
Issue has been resolved. The issue was raised due to wrong pointing of ANDROID_HOME environment variable. It is required that the variable directly points to sdk folder itself instead of the Android Eclipse bundle.
I'm trying to set a phonegap project but I cannot seem to be able to add platforms to it. When I try to add android I get the following error message:
Error: ERROR : executing command 'ant', make sure you have ant installed and add
ed to your path.
at C:\Users\spacitron\.cordova\lib\android\cordova\3.4.0\bin\lib\check_reqs.js:4
7:27
at exithandler (child_process.js:643:7)
at ChildProcess.errorhandler (child_process.js:659:5)
at ChildProcess.EventEmitter.emit (events.js:95:17)
at Process.ChildProcess._handle.onexit (child_process.js:805:12)
Error: C:\Users\spacitron\.cordova\lib\android\cordova\3.4.0\bin\create.bat: Command
failed with exit code 8
at ChildProcess.whenDone (C:\Users\spacitron\AppData\Roaming\npm\node_modules\co
rdova\src\superspawn.js:126:23)
at ChildProcess.EventEmitter.emit (events.js:98:17)
at maybeClose (child_process.js:753:16)
at Process.ChildProcess._handle.onexit (child_process.js:820:5)
Which doesn't make much sense to me because when I run "and -version" I get the following:
Apache Ant<TM> version 1.9.4 compiled on April 29 2014
So what could I possibly be missing here?
As you error says that it can't find your ant.
You need to add path in your environment variables
PATH
;%JAVA_HOME%\bin;%ANT_HOME%\bin;%ANDROID_SDK%;%ANDROID_ADB%;
(You can also add absolute paths in about command)
ANT_HOME
C:\Program Files\Java\ant\
JAVA_HOME
C:\Program Files\Java\jdk1.7.0_25
ANDROID_SDK
C:\Android\sdk\tools
ANDROID_ADB
C:\Android\sdk\platform-tools
Run these four commands to check every thing is setup properly
adb
android
javac
ant
Creating project command
move to the phonegap android folder.Press Shift+Right Click and select "open Command window here"
create Path_to_Project Package_Name Project_Name
create C:\Users\YourUsername\Desktop com.talha.test HelloWorld
Check these links for more help.1,2.
I was having an error that is Camera not successful invoked on first try (click) so I tried this solution on stackoverflow Phonegap(3.0.0) Camera not successful on first try.
I followed the steps as mentioned in the answer removed android by cordova platform remove android then I run the second command cordova platform add android ;
Now when I use netbeans to run the cordova application on cordova android decvice this error occurs:
exec: ant debug -f "/var/www/mobile/platforms/android/build.xml"
[ 'ant debug -f "/var/www/mobile/platforms/android/build.xml"',
{ [Error: Command failed:
BUILD FAILED
/var/www/adt-bundle-linux-x86_64-20130917/sdk/tools/ant/build.xml:720: The following error occurred while executing this line:
/var/www/adt-bundle-linux-x86_64-20130917/sdk/tools/ant/build.xml:734: Compile failed; see the compiler error output for details.
Total time: 8 seconds
] killed: false, code: 1, signal: null },
'Buildfile: /var/www/mobile/platforms/android/build.xml\n\n-set-mode-check:\n\n-set-debug-files:\n\n-check-env:\n [checkenv] Android SDK Tools Revision 22.3.0\n [checkenv]
.
.
.**LONG TEXT which I removed from the post **
.
\nBUILD FAILED\n/var/www/adt-bundle-linux-x86_64-20130917/sdk/tools/ant/build.xml:720:
The following error occurred while executing this line:\n/var/www/adt-bundle-linux-x86_64- 20130917/sdk/tools/ant/build.xml:734:
Compile failed; see the compiler error output for details.\n\nTotal time: 8 seconds\n' ]
Error executing "ant debug -f "/var/www/mobile/platforms/android/build.xml"":
BUILD FAILED
/var/www/adt-bundle-linux-x86_64-20130917/sdk/tools/ant/build.xml:720: The following error occurred while executing this line:
/var/www/adt-bundle-linux-x86_64-20130917/sdk/tools/ant/build.xml:734: Compile failed; see the compiler error output for details.
Total time: 8 seconds
child_process.spawn(/var/www/mobile/platforms/android/cordova/build,[]) = 2
/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 "/var/www/mobile/platforms/android/build.xml"":
BUILD FAILED
/var/www/adt-bundle-linux-x86_64-20130917/sdk/tools/ant/build.xml:720: The following error occurred while executing this line:
/var/www/adt-bundle-linux-x86_64-20130917/sdk/tools/ant/build.xml:734: Compile failed; see the compiler error output for details.
Total time: 8 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 Socket.<anonymous> (child_process.js:948:11)
at Socket.EventEmitter.emit (events.js:95:17)
at Pipe.close (net.js:466:12)
/var/www/mobile/nbproject/build.xml:256: exec returned: 8
BUILD FAILED (total time: 4 minutes 36 seconds)
any idea about this problem?
I was having a similar issue. I ran ant debug -f "/path/to/project/build.xml" from a separate terminal. It displayed a more specific description of the error (which for me wast that there was a space in the project name). This answer also notes:
config.xml can't have a widget id with number as a first character
after a dot. For example: com.42myapp.test or com.myapp.42test won't
work as well as 42com.myapp.test. It will trigger an error from the
compiler.
I was facing similar issues when i started using the CLI to build apps using cordova and started checking the internet for solutions. While i was at it, i discovered the following things that may help you or anyone else facing the same problem can take some hints from this:
These are some very basic checks that you need to take
1. make sure you have all the required sdk's in place (ANT, Java, Android) and is available when you use these commands on the terminal/command $ ant $ java $ adt. if any of these commands are not found, then you need to get it installed or get the class paths fixed.
make sure your project path does not have spaces. i.e. do not have spaces or special characters in directory names. this issue seems to have been fixed on latest versions of cordova and phonegap, but either cases it is a good practice to follow as ant and java paths could be dependent on the folder names you make.
use -d or -v to get extra debug information on the build process to know where and what is causing the issue. $ cordova build android -d or $ cordova build android -v
Make sure you dont use "#" as the link attribute of author tag in the cordova config.xml on the root of the project. This expects the compiler to interpret a hexadecimal color and fails the build. (this was my problem)
Hope this helps.
er... Happy debugging??
Make sure your Ant is 1.8.0 or later version. Cordova 3.3 demands that.
In the past several days, I found that the conflicting files from Dropbox had a very long name. After renaming it, everything worked.