Start a ionic project in linux - android

I am new to ionic framework. I am trying to start a ionic project. I install cordova and when I'm going to add the android platform to the project using 'ionic platform android' it gives me this error.
an error occurred while listing android targets
I also set the path to android sdk and ant by adding following lines to my .bashrc file
export ANDROID_HOME="$HOME/android-bundle/sdk/tools"
export ANDROID_PLATFORM_TOOLS="$HOME/android-bundle/sdk/platform-tools"
export PATH="$ANDROID_HOME:$ANDROID_PLATFORM_TOOLS:$PATH"
export ANT_HOME="$HOME/ant"
export PATH="$PATH:$ANT_HOME/bin"
But still I get the above error. Any kind of help would be appreciated.

try this in you .bashrc file.
export ANT_HOME="/usr/bin/ant"
export PATH="$PATH:$ANT_HOME/bin"
export HOME="/home/username"
export ANDROID_HOME="$HOME/android-bundle/sdk/tools"
export ANDROID_PLATFORM_TOOLS="$HOME/android-bundle/sdk/platform-tools"
export PATH="$ANDROID_HOME:$ANDROID_PLATFORM_TOOLS:$PATH"

I always explicitly define the paths globally.
Mine looks a little like this - from the terminal I type:
export PATH=${PATH}:~/dev/adt-bundle-linux-x86_64-20140321/sdk/tools
export PATH=${PATH}:~/dev/adt-bundle-linux-x86_64-20140321/sdk/platform-tools
If this doesn't work, try updating the sdk

type in your linux terminal:
export PATH=$PATH:/usr/lib/android-sdk-linux
export PATH=$PATH:/usr/lib/android-sdk-linux/tools
export PATH=$PATH:/usr/lib/android-sdk-linux/platform-tools

Related

Android_Home is invalid according to appium-doctor

In my Macbook, I have set my android home as shown below in the .bash_profile. However, I get an error message saying the path is invalid when I run appium-doctor.
I've verified that I can navigate to the path in both terminal and finder.
export ANDROID_HOME=/Users/cbellard/Library/Android/sdk
export PATH=${PATH}:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools
export JAVA_HOME=/usr/bin/java
export M2_HOME=/usr/local/apache-maven/apache-maven-3.3.9
export M2=$M2_HOME/bin
export PATH=$M2:$PATH
export PATH=${JAVA_HOME}/bin:$PATH
export PATH=/usr/local/bin:$PATH
Here is the output from appium-doctor:
I fixed this by replacing the exports in .bash_profile with identical (to human eyes) ones. So, I'm guessing at some point as I was copy-pasting some program changed one or more of the characters to an identical one.

ANDROID_HOME is not set (Ubuntu 16.04)

I have followed all steps mentioned from here
I have set ANDROID_HOME and set PATH in bashrc file.
export ANDROID_HOME=/home/sanjay/Android/Sdk
export PATH=$PATH:/home/sanjay/Android/Sdk/tools
export PATH=$PATH:/home/sanjay/Android/Sdk/platform-tools
But still the error "environment variable is not set", "It should be set to SDK home directory" pops up every time I try to build an app.
Please help to resolve this issue..
Remove the spaces betwen the path and ANDROID_HOME in this line:
export ANDROID_HOME = /home/sanjay/Android/Sdk
such that it reads:
export ANDROID_HOME=/home/sanjay/Android/Sdk
It is not that difficult but you got to make your project make know weatabouts of your SDK.
Try following in your terminal
temporary option: In terminal root of your project
export ANDROID_HOME=[sdk location]
gradle build
===================================
adding path permanent:
Linux - ~/.bashrrc
export ANDROID_HOME=[sdd location]
export PATH=$ANDROID_HOME:$PATH

Ionic AngularJS build android on ubuntu

I created mobile application with Ionic. I want build application and I've a problem, I try build application on Vagrant but I get response error.
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
My .profile:
export ANDROID_HOME="/usr/local/android-sdk-linux/tools" export
ANDROID_PLATFORM_TOOLS="/usr/local/android-sdk-linux/platform-tools"
export PATH="$PATH:$ANDROID_HOME:$ANDROID_PLATFORM_TOOLS"
ANDROID_HOME=/opt/android-sdk-linux
ANDROID_PLATFORM_TOOLS=/opt/android-sdk-linux/platform-tools
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/u$
ANDROID_SDK=/opt/android-sdk-linux
How fix? Any ideas?
I think you may try this
export ANDROID_HOME=/installation-location/android-sdk-linux
export PATH=${PATH}:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools
Look to the source for more details

Setting Android Home on Ubuntu. Is this redundant?

# Android SDK
PATH=$PATH:/home/sudhir/Documents/Android/sdk:/home/sudhir/Documents/Android/sdk/tools
export PATH
# For SDK version r_08 and higher, also add this for adb:
PATH=$PATH:/home/sudhir/Documents/Android/sdk/platform-tools
export PATH
# Android Home
export ANDROID_HOME=/home/sudhir/Documents/Android/sdk
export PATH=$PATH:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools
bash gurus,
Is this redundant? Should bottom two lines be enough?
these two lines are sufficient.
# Android Home
export ANDROID_HOME=/home/sudhir/Documents/Android/sdk
export PATH=$PATH:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools

How to cross-compile gperftools for android using crystax-NDK & autotools?

My final goal is to be able to profile native code (C++) in android environments using gperftools.
My environment/Tools:
ubuntu 14.04
crystax-ndk-10.2.1
gcc-4.8.4
gperftools-2.4
(1)
I followed through this to make a standalone toolchain for later use:
Cross compiling for arm using crystax NDK
command:
./build/tools/make-standalone-toolchain.sh --system=linux-x86_64 --toolchain=arm-linux-androideabi-4.8 --platform=android-8 --install-dir=$HOME/my-android-toolchain
(2)
Thankfully, I found a script that will simplify the ./configure work:
https://gist.github.com/nddrylliog/4688209
and just modified it a bit (put in gperftools-2.4 folder):
#!/bin/sh
export DEV_PREFIX=$HOME
export ANDROID_NDK=${DEV_PREFIX}/crystax-ndk-10.2.1/
export CROSS_COMPILE=arm-linux-androideabi
export ANDROID_PREFIX=$HOME/my-android-toolchain
export SYSROOT=${ANDROID_NDK}/platforms/android-8/arch-arm
export CROSS_PATH=${ANDROID_PREFIX}/bin/${CROSS_COMPILE}
export CPP=${CROSS_PATH}-cpp
export AR=${CROSS_PATH}-ar
export AS=${CROSS_PATH}-as
export NM=${CROSS_PATH}-nm
export CC=${CROSS_PATH}-gcc
export CXX=${CROSS_PATH}-g++
export LD=${CROSS_PATH}-ld
export RANLIB=${CROSS_PATH}-ranlib
# export PREFIX=${DEV_PREFIX}/android/prefix
export PKG_CONFIG_PATH=${PREFIX}/lib/pkgconfig
export CFLAGS="${CFLAGS} --sysroot=${SYSROOT} -I${SYSROOT}/usr/include -I${ANDROID_PREFIX}/include -I${DEV_PREFIX}/android/bionic"
export CPPFLAGS="${CFLAGS}"
export LDFLAGS="${LDFLAGS} -L${SYSROOT}/usr/lib -L${ANDROID_PREFIX}/lib"
./configure --host=${CROSS_COMPILE} --with-sysroot=${SYSROOT} "$#"
(3)
And then I actually do the ./configure and make install:
I put this script in gperftools-2.4 folder and run it:
cd gperftools-2.4
./android_configure.sh --enable-frame-pointers --prefix=$(pwd)
sudo make && make install
cd ..
Result:
The above gives me this error:
src/static_vars.cc: In function 'void tcmalloc::SetupAtForkLocksHandler()':
src/static_vars.cc:119:39: error: 'pthread_atfork' was not declared in this scope
CentralCacheUnlockAll); // child calls after fork
I would appreciate if anyone could leave me some advice on this.
Extra:
I know there is a android-ndk-profiler but since I use CMake for the cross-compilation and I'm not quite sure how to mess with the Android.mk so at the moment I will try to use gperftools which works fine in linux build.
This is because pthread_atfork appeared in Android libc (Bionic) only from Android 5.0. In CrystaX NDK, not all API are replaced by libcrystax, in particular, all pthread_xxx API reside in libc. So the only way as of now to do what you want is either use android-21 as minimal platform, or modify gperftools sources, avoiding usage of pthread_atfork.
BTW, we're working on moving all pthread_xxx API into libcrystax, so I expect all such API will be available soon even for earlier Android versions.

Categories

Resources