OPERATING SYSTEMSOS Linux

Install Android, Apache Cordova, and Ionic Framework in Ubuntu

Download and configure Android, Apache Cordova, Ionic Framework, and NPM using Ubuntu Linux. A complete guide for installing the necessary developer tools. This works for Ubuntu x64 and x86 architectures.

View a written version of this tutorial on my web blog: https://www.thepolyglotdeveloper.com/2014/09/install-android-cordova-ionic-framework-ubuntu/

Follow my blog or subscribe to my YouTube channel for other great programming tutorials.

source

ubuntu

34 thoughts on “Install Android, Apache Cordova, and Ionic Framework in Ubuntu

  • can you please update the script so it can support on Ubuntu 16.04 ? thank you

  • amazing. you really have a good grip on limux..super good i would say..good work

  • i get this error when i try ionic start ExampleProject blank

    ubuntu@ubuntu:~/Desktop/testapp$ ionic start ExampleProject blank
    Creating Ionic app in folder /home/ubuntu/Desktop/testapp/ExampleProject based on blank project
    Downloading: https://github.com/driftyco/ionic-app-base/archive/master.zip
    [=============================] 100% 0.0s
    events.js:85
    throw er; // Unhandled 'error' event
    ^
    Error: ENOSPC, write
    at Error (native)
    ubuntu@ubuntu:~/Desktop/testapp$

  • hello, please someone can help me? i know something like . is missing in this line but i really don't know where find it on my keyboard……..
    LINUX_ARCH="$(lscpu | grep 'Architecture' | awk -f: '{ print $2 }' | tr -d '')"

  • Dear Nic,
    I am expecting phonegap in 32 bit installation of Ubuntu 15.10. Please advise
    Thanks
    Anes

  • Hi!
    Please help me! I don't know how to install cordova on fedora! How can i do?

  • Thank you so much for this amazing script! o/

  • thank you so much !!!! run as expected. Give this video likes it deserved it.

  • Hey Nic, thanks for the guide.

    One problem, after creating the test app and adding android platform, i'm now trying to build and getting an error – the ANDROID_HOME path can not be found.

    I can see the android sdk when running echo $PATH.

    Any idea ?

  • damn ur amazing.. ur script saved me quite some time.

  • Thank you Nic, trying to follow the setup guides from all the individual components was a nightmare. Subscribed.

  • ***** Hey, i have just executed your script on my Guest VirtualBox machine (Ubuntu 14.04). It works, i can do 'ionic serve' and everything, but when i try to install a global plugin (like 'npm install -g gulp') it gives me an error, and if i do 'sudo npm….' it says 'npm' is not a recognizible command… Any ideas on this?

    If it helps:

    npm WARN locking Error: EACCES, open '/home/bruno/.npm/_locks/gulp-3d747487ed28835e.lock'
    npm WARN locking     at Error (native)
    npm WARN locking  /home/bruno/.npm/_locks/gulp-3d747487ed28835e.lock failed { [Error: EACCES, open '/home/bruno/.npm/_locks/gulp-3d747487ed28835e.lock']
    npm WARN locking   errno: -13,
    npm WARN locking   code: 'EACCES',
    npm WARN locking   path: '/home/bruno/.npm/_locks/gulp-3d747487ed28835e.lock' }
    npm ERR! Linux 3.16.0-37-generic
    npm ERR! argv "/opt/node/bin/node" "/opt/node/bin/npm" "install" "-g" "gulp"
    npm ERR! node v0.12.2
    npm ERR! npm  v2.7.4

    npm ERR! Attempt to unlock /opt/node/lib/node_modules/gulp, which hasn't been locked
    npm ERR! 
    npm ERR! If you need help, you may report this error at:
    npm ERR!     <https://github.com/npm/npm/issues>

    npm ERR! Please include the following file with any support request:
    npm ERR!     /home/bruno/npm-debug.log

  • Man, thanks so much for this. I managed to get Cordova & Ionic installed, however I completely corked up android sdk installation as well as jre & jdk. It was a nightmare for PATH etc. This just plain works and it's amazing !

  • hi thanks for this. if you have mac osx can have also do this in mac osx? thanks. 

  • Hi Nic,
    am trying do all step's which you are doing in this video and i download android SDK same as but when i enter the comman ionic start exampleproject blank and enter that time it's showing following ERROR

    Error: EACCES, mkdir '/home/umesh/tmp/npm-13555-iu3pQo68'
    Unable to add plugins. Perhaps your version of Cordova is too old. Try updating (npm install -g cordova), removing this project folder, and trying again. (CLI v1.3.18)

    so please help me…

  • for anyone having trouble with Android SDK Manager not fetching the addons-list and respository .xml's. Go to opt/android-sdk/tools and run android with sudo (sudo ./android) then go to Tools in SDK Manager and check "Force https:// sources to be fetched using http://&quot; and the package list should be fetched.If you run it without sudo the Tools menu is not there for some reason.

  • Im getting the following error please help:

    BUILD FAILED
    /opt/android-sdk/tools/ant/build.xml:962: The following error occurred while executing this line:
    /opt/android-sdk/tools/ant/build.xml:973: The following error occurred while executing this line:
    /opt/android-sdk/tools/ant/build.xml:312: com.android.sdklib.build.ApkCreationException: Unable to get debug signature key
        at com.android.sdklib.build.ApkBuilder.getDebugKey(ApkBuilder.java:279)
        at com.android.sdklib.build.ApkBuilder.<init>(ApkBuilder.java:392)
        at com.android.ant.ApkBuilderTask.execute(ApkBuilderTask.java:334)
        at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:292)
        at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
        at org.apache.tools.ant.Task.perform(Task.java:348)
        at org.apache.tools.ant.taskdefs.Sequential.execute(Sequential.java:68)
        at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:292)
        at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
        at org.apache.tools.ant.Task.perform(Task.java:348)
        at org.apache.tools.ant.taskdefs.MacroInstance.execute(MacroInstance.java:396)
        at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:292)
        at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
        at org.apache.tools.ant.Task.perform(Task.java:348)
        at org.apache.tools.ant.taskdefs.Sequential.execute(Sequential.java:68)
        at com.android.ant.IfElseTask.execute(IfElseTask.java:124)
        at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:292)
        at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
        at org.apache.tools.ant.Task.perform(Task.java:348)
        at org.apache.tools.ant.taskdefs.Sequential.execute(Sequential.java:68)
        at com.android.ant.IfElseTask.execute(IfElseTask.java:124)
        at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:292)
        at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
        at org.apache.tools.ant.Task.perform(Task.java:348)
        at org.apache.tools.ant.taskdefs.Sequential.execute(Sequential.java:68)
        at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:292)
        at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
        at org.apache.tools.ant.Task.perform(Task.java:348)
        at org.apache.tools.ant.taskdefs.MacroInstance.execute(MacroInstance.java:396)
        at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:292)
        at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
        at org.apache.tools.ant.Task.perform(Task.java:348)
        at org.apache.tools.ant.Target.execute(Target.java:435)
        at org.apache.tools.ant.Target.performTasks(Target.java:456)
        at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1393)
        at org.apache.tools.ant.Project.executeTarget(Project.java:1364)
        at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
        at org.apache.tools.ant.Project.executeTargets(Project.java:1248)
        at org.apache.tools.ant.Main.runBuild(Main.java:851)
        at org.apache.tools.ant.Main.startAnt(Main.java:235)
        at org.apache.tools.ant.launch.Launcher.run(Launcher.java:280)
        at org.apache.tools.ant.launch.Launcher.main(Launcher.java:109)

    Total time: 36 seconds

    /home/ubuntu/Documents/Projects/cu247online_mobile/platforms/android/cordova/node_modules/q/q.js:126
                        throw e;
                              ^
    Error code 1 for command: ant with args: debug,-f,/home/ubuntu/Documents/Projects/cu247online_mobile/platforms/android/build.xml,-Dout.dir=ant-build,-Dgen.absolute.dir=ant-gen
    Error: /home/ubuntu/Documents/Projects/cu247online_mobile/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.EventEmitter.emit (events.js:98:17)
        at maybeClose (child_process.js:743:16)
        at Process.ChildProcess._handle.onexit (child_process.js:810:5)

  • nodejs ain't installed afterwards
    sudo apt-get install nodejs

  • Hey Nic, thanks a lot for this awesome shell script. For me, everything went like the video except when I tried "ionic platform add android"; I got this error: "Could not find JAVA_HOME. Try setting the environment variable manually". What could be wrong? 

  • Looks good, would be great if you could create similar thing for windows machine.

Comments are closed.