Skip to content

Instantly share code, notes, and snippets.

@danharper
Created June 16, 2016 15:46
Show Gist options
  • Star 9 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save danharper/45b2ba0bca628bdfd23c49cc121180b6 to your computer and use it in GitHub Desktop.
Save danharper/45b2ba0bca628bdfd23c49cc121180b6 to your computer and use it in GitHub Desktop.
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
Copy link

What if using ionic3 which need java8?

@savi8sant8s
Copy link

savi8sant8s commented Jun 1, 2020

I managed to solve this problem using a Docker image. Here is a tutorial I did:
https://dev.to/savi8sant8s/generating-an-ionic-apk-using-linux-without-complications-273g

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment