Skip to content

Deploying Linux to Android

Radhi edited this page Aug 16, 2017 · 10 revisions

There are two ways to deploy from Linux to Android, using docker image or using Android SDK. Before you deploying your app, you might want to prepare keystore for signing your APK.

Using Docker Image

This method is more recommended because it's easier and doesn't require you to install additional packages on your system.

  1. Make sure you already installed docker on your system.

  2. Pull docker image for Android :

    docker pull therecipe/qt:android
    
  3. Deploy your app :

    qtdeploy -docker build android
    

Once the deployment finished, you can start your application by running the APK file that located in folder deploy/android/build at your project's root directory.

Using Android SDK

You might want to use this method if you are planning on using the latest version of Qt and Android SDK.

  1. Make sure you already installing this binding using Qt5 official installer.

  2. Download Android SDK (with or without Android Studio) then extract it to $HOME/android-sdk-linux/. You can also define custom location for Android SDK by modifying the value of ANDROID_SDK_DIR in environment variables.

  3. Install Android build tools and platforms by using SDK Manager that located in $HOME/android-sdk-linux/tools/android.

  4. Download Android NDK then extract it to $HOME. You can also define custom location for Android NDK by modifying the value of ANDROID_NDK_DIR in environment variables.

  5. Download Java Development Kit 8 then extract it to $HOME/jdk. You can also define custom location for JDK by modifying the value of JDK_DIR in environment variables.

  6. If you haven't done it before, run qtsetup :

    qtsetup full android
    
  7. Deploy your app :

    qtdeploy build android
    

Once the deployment finished, you can start your application by running the APK file that located in folder deploy/android/build at your project's root directory.

Signing the APK File

If you want to have your *.apk signed automatically, then you need to create an alias.txt, password.txt and an project_name.keystore inside the android folder at your project's root directory :

project_name
└── android
    ├── alias.txt
    ├── password.txt
    └── project_name.keystore

After that, you can use qtdeploy like usual and it will automatically sign your APK.

Clone this wiki locally