Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
building an ionic/cordova android app on ubuntu. actually using circle, but needed to test something out on a fresh box
# starting with a Ubuntu 14 box on AWS
# increase swap
# https://www.digitalocean.com/community/tutorials/how-to-add-swap-on-ubuntu-14-04
sudo fallocate -l 4G /swapfile
ls -lh /swapfile
sudo chmod 600 /swapfile
ls -lh /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile
sudo swapon -s
# install deps
sudo apt-get update
sudo apt-get install build-essential libssl-dev git lib32stdc++6 lib32z1 openjdk-7-jdk
# install nvm & node
# https://github.com/creationix/nvm
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.31.1/install.sh | bash
nvm install 5
source ~/.bashrc
# android
wget https://dl.google.com/android/android-sdk_r24.4.1-linux.tgz
tar xzvf android-sdk_r24.4.1-linux.tgz
rm android-sdk_r24.4.1-linux.tgz
# update bashrc
echo 'export ANDROID_HOME=/home/ubuntu/android-sdk-linux' >> ~/.bashrc
echo 'export PATH="/home/ubuntu/android-sdk-linux/tools:$PATH"' >> ~/.bashrc
source ~/.bashrc
# install android packages, google play packages
android update sdk --no-ui --all --filter "build-tools-23.0.3,platform-tool,android-23,extra-android-m2repository,extra-android-support,extra-google-google_play_services,extra-google-m2repository"
# install app
npm install -g cordova ionic
git clone REPO_URL
cd REPO_NAME
npm install
ionic state restore
ionic info
ionic platform list
ionic plugin list
echo 'cdvCompileSdkVersion=23' >> ./platforms/android/build-extras.gradle
echo 'cdvBuildToolsVersion="23.0.3"' >> ./platforms/android/build-extras.gradle
make build
ionic build android --release
@luis02lopez

This comment has been minimized.

Copy link

luis02lopez commented Feb 12, 2019

What if using ionic3 which need java8?

@SavioSantos0808

This comment has been minimized.

Copy link

SavioSantos0808 commented Jun 1, 2020

I managed to solve this problem using a Docker image. Here is a tutorial I did: https://github.com/SavioSantos0808/Tutoriais/blob/master/apk%20ionic%20simples%20com%20linux/tutotial-en.md

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.