Generation android app with ionic? - android

I'm following this tutorial to get started with Ionic Framework. I'm stuck in this part:
ionic platform add ios
when i execute it, Terminal shows me this error:
noting that hen i run echo $ANDROID_HOME it shows me /opt/android-sdk, the same thing when i execute sudo android it shows me SDK manager.
I have re-installed Android SDK, NODE, Ionic etc using the script on this page but i always get the same result.
What should i do?
PS: i'm running Ubuntu 14.04

set your path manually in .bash_profile.
export PATH=${PATH}:<your_android_sdk_location>/platform-tools
export PATH=${PATH}:<your_android_sdk_location>/tools

Well, the solution was the following, after executing the shell script fire up the SDK Manager and install this Android 4.4.2 API19 then run ionic CLI commands without sudo and you're done.

Related

"No command 'ionic' found" and "workon: command not found"

I have a weird problem in my Ubuntu 14.04.
I was developing a mobile application using Ionic with an API using Django-Rest-Framework. After developing, I downloaded jdk and Android SDK so that I can build the mobile app into APK. I also downloaded the android dependencies or tools needed for building. After I downloaded it all, I go to my mobile app folder and type ionic platform add android to build it. But the terminal response with "No command 'ionic' found". Even typing ionic serve responses the same. I also tried to activate the virtual environment of the API using workon mobile but it responses with workon: command not found. Does anybody have an idea what might be wrong? Thanks
First Check ionic is install or not by using following command
ionic -v
It shows version if it nothing to show then install ionic by using following command
sudo npm install -g ionic
else update ionic by the following command on your terminal
sudo npm update -g
And also if you have not got the result then create symbolic link by using following command
sudo ln -s /usr/bin/nodejs /usr/bin/node
Hope this will help you !!
First install using this two line..
npm install -g cordova ionic
ioniv -v && cordova -v
and then use this line
$ ionic start myapp [template]
$ cd MyIonic2Project/
$ ionic serve

Building Ionic app on UBUNTU for Android fails with exit code 2: Failed to find 'ANDROID_HOME'

I am using Ubuntu 14.04 version and im trying to work with ionic.
The error comes when I try to:
$ ionic start todo blank
$ cd todo
$ sudo ionic platform add android
$ sudo ionic build android
And I get the following error:
[Error: Failed to find 'ANDROID_HOME' environment variable. Try setting setting it manually.
Failed to find 'android' command in your 'PATH'. Try update your 'PATH' to include path to valid SDK directory.]
ERROR building one of the platforms: Error: /home/kelvin/Desktop/todo/platforms/android/cordova/build: Command failed with exit code 2
You may not have the required environment or OS to build this project
Error: /home/kelvin/Desktop/todo/platforms/android/cordova/build: Command failed with exit code 2
I know there is alot of sites with a answer to this question, but none of them gave me a fix. Or maybe they did, but I didnt understand it. I tried on this site building-ionic-app, but that didnt work either.
I followed this tutorial by Nic Raboy, and its still not working.
Install Android, Cordova, and Ionic Framework in Ubuntu.
So let me explain what I did and maybe that is helpfull to fix my problem:
I started with this guide: Ionic Framework Guide
To install Cordova, make sure you have Node.js installed, then run
Install Node.js
$ sudo apt-get install -y nodejs
$ node -v
v5.0.0
Install Cordova
$ sudo npm install -g cordova
Follow the Cordova platform guides for Android and iOS to make sure you have everything needed for development on those platforms.
Follow the Cordova platform guides for Android
I followed this guilde:
Complete installing guide for android SDK / ADT Bund on Ubuntu
My computer is 64-bit and since im using 14.04.
Step 2: install libgl1-mesa-dev:i386 package.
$ sudo apt-get install libgl1-mesa-dev:i386
Step 3: Install openjdk-6-jdk or better, openjdk-7-jdk
$ sudo apt-get install openjdk-7-jdk
Step 4: Download the Android SDK or the ADT Bundle from here and unzip it to wherever you want.
Then I follow step 4 on techtach Complete Guide
$ wget http://dl.google.com/android/android-sdk_r20-linux.tgz
$ wget http://dl.google.com/android/adt/22.6.2/adt-bundle-linux-x86_64-20140321.zip
Then I unzipped the adt-bundle and copied the folders from SDK -> /home/kelvin/android-sdk-linux/
The folders are: build-tools,extras,platforms,platform-tools,system-images,tools.
Then I executed the following command to install latest android updates
$cd ~/android-sdk-linux/tools
$sudo ./android
And installed
Android SDK Tools (24.0.2)
Android SDK Platform-tools (20)
ANDROID SDK Build-tools (19.0.3)
SDK Platform
ARM EABI V7a System Image
Android Support Library
And then open bashrc
$gedit ~/.bashrc
And added the following lines.
export PATH=${PATH}:~/android-sdk-linux/tools
export PATH=${PATH}:~/android-sdk-linux/platform-tools
export ANDROID_HOME=~/android-sdk-linux/tools
Checking if it is right:
$ANDROID_HOME
bash: /home/kelvin/android-sdk-linux/tools: Is a directory
Create the project & Configure Platforms
$ ionic start todo blank
$ cd todo
$ sudo ionic platform add android
$ sudo ionic build android
And I get the following error:
[Error: Failed to find 'ANDROID_HOME' environment variable. Try setting setting it manually.
Failed to find 'android' command in your 'PATH'. Try update your 'PATH' to include path to valid SDK directory.]
ERROR building one of the platforms: Error: /home/kelvin/Desktop/todo/platforms/android/cordova/build: Command failed with exit code 2
You may not have the required environment or OS to build this project
Error: /home/kelvin/Desktop/todo/platforms/android/cordova/build: Command failed with exit code 2
And now im kinda lost. I found a forum where they have the same problem: ANDROID_HOME is not set... and one of the guys suggested.
I finally solved it. It was on my users path but not the root users path. I have to run these commands as a root user. I had to edit my root users .bash_profile file.
and one of the others tells how:
In Ubuntu, do all the commands also root
sudo su
gedit ~/.bash_profile
export ANDROID_HOME=/root/Android/Sdk
export PATH=${PATH}:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools
But a third guy said this is a bad idea, so I didnt do it.
I can run the following command:
$ionic serve
And it runs in the browser, but I cant run for android.
I just read your question and it seems you followed the correct way.I faced the same situation during installation process.
The proper set up an Ubuntu machine for Ionic Framework Android development has many steps.Now there are a ton of options to handle this task, but not many bare bones solutions. Most solutions on the internet explain how to use an IDE, or fail to elaborate a complete installation.
After a research,I have found a nice tutorial by Nic Raboy.I followed this tutorial and everything is fine now.
Install Android, Cordova, and Ionic Framework in Ubuntu

Cordova Plugins Installation MAC

I am using Cordova 3.3.0 and I want to install the camera and network plugins. In netbeans it is very simple to do so but I can't understand how this can be accomplished on MAC. Please note that I am very new to this.
I am trying to run the following command in the terminal:
cordova plugin add https://git-wip-us.apache.org/repos/asf/cordova-plugin-camera.git
An error is saying
-bash: cordova: command not found
Can anyone guide me what needs to be done?
Thanks
If Cordova is well installed on your Mac, you need to add "/usr/local/share/npm/bin" directory to your $PATH variable. Open your Terminal / Command line and type:
export PATH=$PATH:/usr/local/share/npm/bin
Else, before install Cordova typing :
npm install -g cordova

Titanium SDK will not recognize Titanium CLI, node, alloy, or npm on Ubuntu 12.04

Titanium SDK will not recognize Titanium CLI, node, alloy, or npm on Ubuntu 12.04
I followed the installation instructions for the Titanium SDK here: http://docs.appcelerator.com/titanium/latest/#!/guide/Quick_Start
Each time I try to launch titanium, it prompts me for some Titanium Updates.
But of course, when I click the fancy update button, it tells me:
'Installing Titanium Updates...' has encountered a problem. Error
encountered during update.
Cannot install Node on platforms other than Windows or Mac.
NPM is not installed.
NPM is not installed.
NPM is not installed.
I disagree: I have definitely installed node, npm, and I manually installed alloy with
npm install -g alloy
Here are some other relevant results from my terminal:
ryan#Grisbuntu:~$ which node
/home/ryan/local/bin/node
ryan#Grisbuntu:~$ which titanium
/home/ryan/local/bin/titanium
ryan#Grisbuntu:~/local/bin$ titanium -v
3.1.2
ryan#Grisbuntu:~/local/bin$ node -v
v0.10.15
ryan#Grisbuntu:~/local/bin$ alloy -v
1.2.2
ryan#Grisbuntu:~/local/bin$ npm -v
1.3.5
I'd like to continue with a "Hello World" application (and beyond), but for example when I click "Run->Android Emulator", I get the following error:
'Launching Titanium Android Emulator - html5-hello' has encountered a
problem.
Unable to locate the CLI executable. Please restart Studio or use
Help > Check for Titanium Updates to install Titanium CLI.
I have discovered quite a few similar questions out there, but few answers... can anyone give me a clue as to how to fix this? I am new to Titanium/Eclipse: Is there a simple path setting that I am missing somewhere?
I think I fixed my own problem. Despite the fact that node and npm were previously installed on my system, and I was able to do things like "node -v" and "titanium -v" from a "normal" linux terminal, Titanium was not recognizing the existence of any of these programs. I tried various combinations of inserting an export statement into my bash profile, uninstalling and reinstalling node, (via apt-get and manually extracting the tarball, etc) and so on, but nothing seemed to work.
What I ended up doing was launching my Titanium project, and I ran "node -v". It gave me version 0.6.blah.blah. I am still confused why this is... but to solve it, using the terminal WITHIN titanium, I issued all the following commands:
(before I go on, if you're going to try this yourself, this answer might be incomplete or slightly inaccurate: i'm sorry that I didn't write it down exactly as i went... but this is close. The point to this solution is that I had to do it FROM WITHIN titanium).
sudo apt-get remove npm
sudo apt-get remove node
wget http://nodejs.org/dist/v0.10.18/node-v0.10.18.tar.gz
tar -zxf node-v0.10.18.tar.gz
cd node-v0.10.18
./configure && make && sudo make install
RESTART TITANIUM
then, again in a titanium terminal, run
npm install titanium
npm install alloy
Those last 2 commands are what really got me over the hump. My hello world application, and my android emulator, now successfully launch. Hope that helps someone. If anyone can explain to me why I had to do it this way, I'd like to understand it. Otherwise, thanks & good luck!

Titanium: command not found on Ubuntu

I tried to install Titanium IDE (version 3.1.2.201308091617) to make some mobile apps on my ubuntu 12.04. I follow the guide, install successfully Android SDK and mobile SDK (3.1.2 and 3.0.0). I started a template project and just want to run on Android emulator or on web browser when I got this error: "Unable to locate the CLI executable. Please restart Studio or use Help > Check for Titanium Updates to install Titanium CLI."
On the web I found that I am supposed to have a titanium executable on my shell, but I didn't have it (command not found).I run something like $ find . -name "titanium" in my home directory but it doesn't return something executable. I only found titanium.py in my mobilesdk dir: /home/flagos/.titanium/mobilesdk/linux/3.1.2.GA/titanium.py
I try to add this directory into my $PATH, it doesn't change anything. I also tried to symlink titanium to titanium.py and add it into my $PATH but it leads to another error...
How do you get titanium executable on Ubuntu ? Where is it supposed to be ?
Thanks,

Categories

Resources