Do you struggle to generate APK for your Ionic App?
I use to work for a company where we have a hybrid mobile app, we made it with Ionic Framework (version 2).
The problem was only one developer and one computer could generate the APK, this was a bottleneck especially when we were in a rush to complete the sprint and the QA Team needed several APK.
You know how is this, maybe the change requested by the QA team was only a change of text but we had to wait for that developer to be free to generate an APK.
It’s hard to setup your computer for this task
As you may experience, making an APK on your machine can be difficult, you need to install Android Studio or at least Android SDK Manager, spend some time downloading the 20GB SDKs, fighting with your almost completed MBP’s SSD because of videos from your last holiday.
Even if you can handle all that trouble, maybe your coworkers don’t, and you will become that guy who can generate the APK, they always will depend upon you or your computer.
Introducing automated APK generation with CircleCI and Docker
Here come continuous delivery practices to solve your problems. With the help of my friend CircleCI and the amazing Docker technology, you can pass the responsibility to them and forget about manually generating ionic mobile app APKs for the QA team. Now even you can run your automation testing suit.
With CircleCI you have:
No more buggy ionic mobile app APKs, run automation testing and then generate APK
Save ~10 minutes from every ionic mobile app APK generation.
Independence, no more sharing a file through airdrop, just use the download link from CircleCi dashboard.
It took me several attempts…
But here I have a the CircleCi
config.yml ready for you, so don’t have to fight with the Java, Gradle and Android Studio problems.
|- image: circleci/android:api-28-node|
|name: "Install gradle"|
|wget https://services.gradle.org/distributions/gradle-4.0.2-bin.zip -P /tmp|
|sudo unzip -d /opt/gradle /tmp/gradle-*.zip|
|echo 'export GRADLE_HOME=/opt/gradle/gradle-4.0.2' >> $BASH_ENV|
|echo 'export PATH=$PATH:/opt/gradle/gradle-4.0.2/bin' >> $BASH_ENV|
|name: "Install ionic and cordova"|
|sudo npm install -g ionic cordova yarn|
|name: "Install npm packages"|
|name: "Install Cordova plugins and add android platform"|
|ionic cordova platform add android --noresources|
|ionic config set -g telemetry true|
|name: "Generate apk"|
|ionic cordova build android --verbose|
|mkdir -p /tmp/apk|
|cp -r platforms/android/app/build/outputs/apk/debug/app-debug.apk /tmp/apk|
Now the job will generate an APK and save it to the CircleCI Artifacts location, at the time of writing you can save up to
The power of continuous integration and continuous delivery tools like CircleCI and Docker can help you save tons of time, therefore tons of money.
You can go further and optimize the CircleCI configuration to make use of the cache layer.
Even you can set up Google Drive (or Dropbox or an FTP) integration so the QA Team doesn’t have to enter to CircleCI to download the file.
In a future post, we will discuss how to use CircleCI to automate API Testing before your server goes to production, this will give you peace of mind, believe me.