When I try to build my app, using Linux ElementaryOS (Ubuntu 12.04 (I think?)) I get thousands of errors saying:
rm: could not remove file (code EACCESS)
The results of the following show:
$ phonegap -v
3.5.0-0.20.4
$ cordova -v
3.5.0-0.2.4
$ ant -v
Apache Ant(TM) version 1.8.2 compiled on December 3 2011
Trying the default build file: build.xml
Buildfile: build.xml does not exist!
Build failed
Any suggestions? I've been battling through several errors for about a week now :(
Thanks in advance!
Update
Update I just changes the permissions of platforms/android too 777 (not a great solution I know). It's now giving me the following:
[Error: An error occurred while listing Android targets] { [Error: /var/www/ppl/app/platforms/android/cordova/build: Command failed with exit code 2] code: 2 } –
Okay, after much pain and anguish... I figured it out.
1). I installed ANT after I installed ionic/cordova/phonegap etc, the best order to install everything in is, java, ant, then cordova/phonegap/ionic.
2). I'm using 64-bit Ubuntu, if you are using the same then you need to install several android 32-bit libs.
3). I deleted the entire project (apart from my css, added js files and my html templates), created a new one using $ ionic start test-app then I ran $ ionic platform add android then ran $ ionic run android and it worked.
4). Make sure your paths are correct in ~/.bashrc mine look as followed:
export PATH=$PATH:/home/ewan/adt-bundle/tools
export PATH=$PATH:/home/ewan/adt-bundle/platform-tools
Here's a video that helped me, especially with the 32-bit libs. https://www.youtube.com/watch?v=zEQIwKK7YjY
Don't give up, it's worth it in the end. Best of luck!
Related
I am following the instructions here to build chromium project for android on ubuntu 14.04. I was able to successfully check out the code, now I'm trying to configure the build. I'm using GN to configure, so I run "gn args out/Default", however I get this error: gn.py: Could not find gn executable at: /home/moon/chromium/src/buildtools/linux64/gn
All I have in that above folder is sha1 files, I don't seem to have python files. However, I had not received any errors during checkout process. What am I doing wrong and how can I fix this?
Thanks a lot!
I had the same problem as you but I managed to build Chromium finally.
Most probably, you may not successfully install any necessary dependencies.
Since you are on Linux, run the following command under src:
$ ./build/install-build-deps.sh
After this you can rerun the command:
$ gn gen out/Default
After giving credit to Brett Wilson, run:
gclient runhooks
It worked for me.
cordova build android 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(TM) 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(TM) SE Runtime Environment (build 1.8.0_05-b13)
Java HotSpot(TM) 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?
I banged my head against the wall for hours and hours and ultimately came up with a simple solution. I went into the project directory and issued two commands:
cordova platform remove android
cordova platform add android
Recompiled with "cordova build android" and it worked like a charm.
I think cordova wanted to possibly update some files.
===== Update for Ionic ========
In case you are using ionic framework then these are the commands for your rescue:
ionic platform remove android
ionic platform add android
I have noticed that this normally happens when you break (Ctrl-C) the compilation process.
I noticed that your ANDROID_HOME variable might be incorrectly setup - as far as I can tell, it should be set to the root of your SDK folder (what you have ANDROID_SDK set to), try that (and make sure that you still have both $ANDROID_HOME/tools and $ANDROID_HOME/platform-tools on your path).
I run in the same problem and solved it by escaping non-letter characters in config.xml. Particulary for the name attribute:
<name>Temps d'espera</name>
I changed it to:
<name>Temps d\'espera</name>
And then it run perfectly. Hope it helps.
#mylord I had similar error and it was due to invalid debug certificate. On Linux Delete ~/.android
debug.keystore file.
The next time you build, the build tools will regenerate a new keystore and debug key.
This solved for me. I hope this helps.
I ran into this same problem while running 'phonegap serve', but the solution was very different. I noticed that operation would work when I restarted my computer. In case anyone else runs into this problem. Here is the solution on Ubuntu 15
echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p
which was taken from the stackoverflow thread Grunt watch error - Waiting...Fatal error: watch ENOSPC
In addition to the posters error, I had the error
at exports._errnoException (util.js:856:11)
at FSWatcher.start (fs.js:1313:19)
at Object.fs.watch (fs.js:1341:11)
further down.
I meet same error message, but my ANDROID_HOME setting is correct.
I find the error is caused by I opening a .apk file in the \platforms\android\ant-build folder. After I close 7zip that occupy the .apk file, ant build passed.
Before changing anything, make an empty cordova project and try to build it and you can figure out the problem is project specific or not.
After a lot of change i made, i figured out we shouldn't have two folders with same names : jquery and jQuery!
I had the same issue. It was caused by having an App with the same name (and the same reverse style domain name in my case) installed on the Android Device which originated from the Google Play store (it was our Beta release).
I've been pulling my hair out for the past two days trying to get cordova to detect and install the android platform for a project.
The specific error:
Error: ANDROID_HOME is not set and "android" command not in your PATH. You must fulfill at least one of these conditions.
Command finished with error code 8
I have scoured the net for solutions. Here is the .bashrc file:
export ANDROID_HOME=~/adt-bundle-linux-x86_64-20140702/sdk/platform-tools
export ANDROID_SDK_HOME=~/adt-bundle-linux-x86_64-20140702/sdk/platform-tools
export PATH=${PATH}:~/adt-bundle-linux-x86_64-20140702/sdk/tools
export PATH=${PATH}:~/adt-bundle-linux-x86_64-20140702/sdk/platform-tools
I get the error when running this command:
sudo cordova platform add android -d
Any help would be appreciated!
More Info:
If I run the "android" command, I get the SDK app startup, so I know that works. Ive also installed the latest builders, tools for the SDK.
After a lot of trial an error, it seems the issue was "sudo" all along. Sometimes it's the simplest things that we overlook.
There were also some unnecessary lines in my export commands. The following is all you need:
export ANDROID_HOME=~/adt-bundle-linux-x86_64-20140702/sdk
export PATH=${PATH}:~/adt-bundle-linux-x86_64-20140702/sdk/tools
export PATH=${PATH}:~/adt-bundle-linux-x86_64-20140702/sdk/platform-tools
If you get an error that ANDROID_HOME does not exist, change the location to use the absolute path. ie: /home/user_name/....
My project directory needed to be 777, as well.
Finally, make sure you run the following command:
sudo apt-get install lib32stdc++6
Looks like without it, I get build errors.
Hope this helps anyone else in the future. There definitely was not enough clear answers on the web, before.
I installed cordova e phonegap via npm install -g cordova and npm install -g phonegap respectively. Then i created a HelloWorld application via cordova create HelloWorld mynamespace.helloworld HelloWorld. It worked fine! Then i changed my working directory to HelloWorld and i tried to build the app for android via cordova platform add android -d but it didn't work. here is the output:
Installing cordova library for android...
Requesting {"uri":"https://git-wip-us.apache.org/repos/asf?p=cordova-android.git;a=snapshot;h=3.3.0;sf=tgz"}...
Downloading cordova library for android...
Downloaded, unzipped and extracted 541065 byte response.
Download complete
Installing cordova library for android...
Checking if platform "android" passes minimum requirements...
Creating android project...
Running bin/create for platform "android" with command: ""C:\Users\marcos.pacheco\.cordova\lib\android\cordova\3.3.0\bin\create" "C:\Dev\HelloWorld\platforms\android" "mynamespace.helloworld" "HelloWorld"" (output to follow)
C:\Users\marcos.pacheco\AppData\Roaming\npm\node_modules\cordova\node_modules\q\q.js:126
throw e;
^
Error: An error occured during creation of android sub-project.
at C:\Users\marcos.pacheco\AppData\Roaming\npm\node_modules\cordova\src\platform.js:244:30
at exithandler (child_process.js:633:7)
at ChildProcess.errorhandler (child_process.js:649:5)
at ChildProcess.EventEmitter.emit (events.js:95:17)
at Process.ChildProcess._handle.onexit (child_process.js:787:12)
I've googled and have found some issues with whitespaces but my project is in the C:\Dev\HelloWorld path and my android sdk is in the PATH so that when i type adb at the windows prompt i get the help information of the command as well Java and Ant. Furthermore, i have ANT_HOME, JAVA_HOME and ANDROID_HOME set. I also deleted the ** .cordova ** folder inside my %HOMEPATH% directory and entered the command again but the error is still there.
What might be wrong?
XCOPY needs to be defined and found on your path as it is used by the internal node.js scripts to move things around.
You probably already have xcopy.exe somewhere on your machine. You should be able to add %SystemRoot%\System32 to your PATH and it will work. Or you can open up a terminal and type where xcopy to see the actual path to your xcopy.exe.
I guess having XCOPY on the path is a requirement for setting up and installing Android, but it'd be nice if Cordova checked to make sure you have XCOPY somewhere...
I'm trying to compile ffmpeg for Android using this guy script (https://github.com/guardianproject/android-ffmpeg) because it looked like the simplest and the whole NDK is really not my area of expertise.
So let's see what I've done so far:
Downloaded and installed a fresh Ubuntu 12.04 LTS from: http://www.ubuntu.com/download/desktop in a VirtualBox. (had some little problems with video but a few updates later in the terminal ubuntu is up and running)
installed the Android SDk and downloded/unzipped the NDK into /Documents/ndk
I used those commands to install the compiler:
$ sudo apt-get update
$ sudo apt-get upgrade
$ sudo apt-get install build-essential
$ gcc -v
$ make -v
then sudo install git (or something like that to install git)
then git clone https://github.com/guardianproject/android-ffmpeg.git
then copied from the guys page building section
cd android-ffmpeg
git submodule init
git submodule update
NDK_BASE=/path/to/android-ndk ./configure_make_everything.sh
it mostly goes well until it says:
arm-linux-androideabi-gcc is unable to create an executable file C
compiler test failed
If you think configure made a mistake,.. blaah blahh blaah
I'm not sure what it means or where to go from here.
from this I did some chmod 777 on the folders to make sure stuff can be execute.
also from this I tried his script but without any luck.
help?
decompose what the script 'config_make_everything' is doing.. and run one step at a time...
https://github.com/guardianproject/android-ffmpeg/blob/master/configure_make_everything.sh
each step will create a file like 'config.log' where you can go to the tail and find more details about what went wrong finding the compiler.
When u start using the NDK, IMO, invest a bit of learn curve time going thru its ./doc directory and making sure that you have it integrated correctly. With NDK install, there are some samples. Build a few from CLI just to make sure that the ENV is correct and that the install is good, and that u have at least some idea of the build as a repeatable process. That will prove that you can do good 'cross compiles' with the build tools. Then you can return to guardian.ffmpeg stuff.
IMO - there is alot going on with an NDK build of this project and getting it all to build without understanding any of the underlying configuration / build stack would require lots of luck.