Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jfoclpf/b08d9185a85ad49c1dffa6933baed25c to your computer and use it in GitHub Desktop.
Save jfoclpf/b08d9185a85ad49c1dffa6933baed25c to your computer and use it in GitHub Desktop.
TLDR for Apache Cordova light setup for Hello World (for Android)

Develop APPs simply with vanilla Javascript

The nice thing about Apache Cordova is that you can develop APPs for both Android and iOS simply using vanilla Javascript. You can then add whatever library with which you feel comfortable, like Bootstrap or jQuery, for example. You can also use ES6 if you prefer.

Apache Cordova is though a bit cumbersome to start with due to the software requirements. Furthermore if you never programmed for Android or iOS, you might feel a bit insecure with all this terminology.

Though instead of a long detailed explanation, I will just provide a short todo list on how you can have your first program to run as fast as possible. You’ll have to investigate further if you get stuck on a specific step, or feel free to leave a comment or question on the comment section below.

TLDR from official documentation

This is a TLDR from official documentation. I apply this for Android, but for iOS is very easily adaptable.

1. Install NodeJS.

For Debian/Ubuntu check instructions here.

Confirm this step went OK by running in console node -v; npm -v

2. Install Apache Cordova

Run sudo npm install -g cordova (for OS X and Linux) or npm install -g cordova (for Windows)

Confirm this step went OK by running in console cordova -v

For Debian/Ubuntu sudo apt install openjdk-8-jdk.

Be sure you're using the correct version, namely openjdk version "1.8.*", by running in console java -version

4. Install Gradle.

For Debian/Ubuntu sudo apt install gradle.

Confirm this step went OK by running in console gradle -v

The "light setup" is here, since you don't need the huge Android Studio.

For Debian/Ubuntu you can simply run sudo apt install android-sdk

Unzip the file and be sure to that all the unziped binaries are accesible via the PATH. For example in Linux add these lines to ~/.bashrc if you installed the Android command line tools into ~/Android/Sdk/

export ANDROID_SDK_ROOT=$HOME/Android/Sdk
PATH=$PATH:$ANDROID_SDK_ROOT/tools/bin
PATH=$PATH:$ANDROID_SDK_ROOT/platform-tools
PATH=$PATH:$ANDROID_SDK_ROOT/emulator/
PATH=$PATH:$ANDROID_SDK_ROOT/emulator/bin64

Confirm this step went OK by running in console

sdkmanager --version
avdmanager

Warnings in sdkmanager are acceptable

6. Install the necessary SDKs (in this example for Android API level 30, Android 11)

Check the ones you have already installed with

sdkmanager --list

To be sure, further install

sdkmanager --install 'cmdline-tools;latest' 'platform-tools' 'build-tools;30.0.3' 'platforms;android-30' 'cmake;3.18.1' 'extras;google;simulators' 'extras;google;webdriver' 'extras;google;auto' 

7. Install a Android Virtual Device (AVD), to use an emulator

sdkmanager --install 'emulator' 'system-images;android-30;default;x86_64'

Check if you have any AVD and then create one if necessary

avdmanager list avd
avdmanager create avd

8. Create your APP

cordova create hello com.example.hello HelloWorld
cd hello
cordova platform add android

Check requirements with cordova requirements

9. Lunch the APP

cordova emulate android

10. Install Visual Studio Code (optional) to see the code and programme

@jfoclpf
Copy link
Author

jfoclpf commented May 30, 2022

Fell free to ask questions in this comment section

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