Skip to content

Instantly share code, notes, and snippets.

@dakridas
Created February 24, 2018 19:15
Show Gist options
  • Save dakridas/b25c2f26433c4f748e28e9cdfef36b54 to your computer and use it in GitHub Desktop.
Save dakridas/b25c2f26433c4f748e28e9cdfef36b54 to your computer and use it in GitHub Desktop.
Deploying Qt applications on Android devices

Set android paths to environment variables

export ANDROID_ROOT=/home/da/crosscompile
export ANDROID_STUDIO=/home/da/crosscompile/android/studio
export ANDROID_SDK=/home/da/crosscompile/android/sdk
export ANDROID_NDK=/home/da/crosscompile/android/ndk
export ANDROID_JDK=/home/da/crosscompile/android/jdk

Android Studio

Install prerequests

sudo apt-get install libc6:i386 libncurses5:i386 libstdc++6:i386 lib32z1 libbz2-1.0:i386
sudo apt-get install libgcc1:i386 zlib1g:i386
sudo apt-get install libsdl1.2debian:i386

Download android studio from official site

wget https://dl.google.com/dl/android/studio/ide-zips/3.0.1.0/android-studio-ide-171.4443003-linux.zip

Unzip and move it to android studio path

unzip android-studio-ide-171.4443003-linux.zip -d $ANDROID_ROOT

Get in to studio directory and run it

cd $ANDROID_STUDIO/bin
./studio.sh

Go to Configure > SDK Manager > SDK Platforms

Change the Android SDK Location path to $ANDROID_SDK, in my case the path should change to /home/da/crosscompile/android/sdk

Choose the desired platforms and press Apply to install it.

Android NDK

Download the recommended version 10e from the official site

wget https://dl.google.com/android/repository/android-ndk-r10e-linux-x86_64.zip

Unzip and move it to android ndk path

unzip android-ndk-r10e-linux-x86_64.zip
sudo mv android-ndk-r10e $ANDROID_NDK

Java SE Development Kit

Download JDK 8 from the official site unzip and move it to android jdk path

tar -zxvf jdk-8u161-linux-x64.tar.gz
sudo mv jjdk1.8.0_161 $ANDROID_JDK

Qt

Donwload Qt 5.9.4

wget http://download.qt.io/official_releases/qt/5.9/5.9.4/qt-opensource-linux-x64-5.9.4.run
chmod +x ./qt-opensource-linux-x64-5.9.4.run
./qt-opensource-linux-x64-5.9.4.run

Qt Creator IDE

The Qt Creator IDE that came with the Qt 5 installation on your development host, must be configured to enable developing applications for Android. Launch Qt Creator and select Tools > Options > Devices > Android to add the Android NDK and SDK paths and the JDK path

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