Skip to content
Snippets Groups Projects
Select Git revision
  • master default protected
  • feature/migrate-cordova-13
  • feat/improve-network-scan
  • feat/force-migration-check
  • develop
  • feature/encrypted_comment
  • feature/android_api_19
  • gitlab_migration_1
  • rml8
  • v1.7.14
  • v1.7.13
  • v1.7.12
  • v1.7.11
  • v1.7.10
  • v1.7.9
  • v1.7.8
  • v1.7.7
  • v1.7.6
  • v1.7.5
  • v1.7.4
  • v1.7.3
  • v1.7.2
  • v1.7.1
  • v1.7.0
  • v1.7.0-rc2
  • v1.7.0-rc1
  • v1.6.12
  • v1.6.11
  • v1.6.10
29 results

build_android.md

Blame
  • Build Cesium for Android

    Cesium can be build as an Android App.

    Cesium use Ionic Framework v1.7.16 with some Apache Cordova plugins.

    Prerequisites

    Install the development environment

    Follow all the steps defined in the Development guide.

    After that you should be able to start the application using npm start, and to test it.

    Install JDK (Java Development Kit)

    You can choose to install

    • on Linux, install OpenJDK 8:

      • sudo apt-get install openjdk-8-jdk
    • or Oracle JDK 8 (all platforms supported):

      And choose the right version, depending on your platform.

    Install Android Studio

    Download Android Studio from the AndroidStudio-Downloads page

    • On MS Windows:

      • Download file without the Android SDK:
      • Then follow installation steps.
    • On Linux :

      • download the full archive, then uncompress it (e.g in /opt/android-sdk).

      • open a terminal, run the command:

      ./bin/studio.sh

    At the end of the installation or the first launch, Android Studio will indicate that you do not have an SDK and will propose to install it.

    Install the version that it proposes to you.

    Install Android NDK

    The NDK is used for code execution in C ++, need to build the NaCL cryptography library.

    • Download NDK from this page

      • Warning: Please use version r10d (not tested on newer versions).
    • Uncompress the archive (e.g on Linux, in a new directory /opt/android-ndk).

    • Launch Android-studio, then open the menu File > Project Structure...

    • A window like this should open:

    • Fill in the installation path of the NDK.

    Install Gradle

    Android configuration

    Android need some configuration, to be able to build Cesium.

    • First, create a properties file local.properties in the directory platforms/android:
    # Path to your Android SDK installation
    sdk.dir=/opt/android-sdk
    
    # Path to your Android NDK installation
    ndk.dir=/opt/android-ndk
    • In order to sign your Android builds:

      • Generate a new keystore file :
    keytool -genkey -v -keystore Cesium.keystore -alias Cesium -keyalg RSA -keysize 2048 -validity 10000`
    • Create a file release-signing.properties in the directory platforms/android:
    storeFile=/path/to/Cesium.keystore
    keyAlias=Cesium
    storePassword=YourStorePassword
    keyPassword=YourKeyPassword
    • Open Android Studio, then open the menu File > Settings.... Set Gradle Home to your fresh Gradle installation directory (e.g. /opt/gradle).

    Generate APK file

    • To build a signed APK file:
    ionic build android --release
    • To build an unsigned (debug) APK:
    ionic build android

    Generated APK files should be in the directory platforms/android/build/outputs/apk.

    Troubleshooting

    "Cannot run program (...)/aapt"

    If you get this error:

    Cannot run program "/opt/android-sdk/build-tools/21.1.2/aapt": error=2, No such file or folder

    Then install two additional compatibility libraries (workaround found in this post):

    sudo apt-get install lib32stdc++6 lib32z1