-
Notifications
You must be signed in to change notification settings - Fork 8
Qt 5.1 on Android
(on 2.3.3+ apparently?)
get the android sdk tools
make sure that API levels 10, 11 and 16 are explicitly selected and installed
get the android ndk
# can clean a repo directory after configuring with
# git clean -dfx (this will permanently delete all files
# created during the config/build process!)
# always clean the directory after a bad config/build
#dont know if this is necessary
export JAVA_HOME=/usr/lib/jvm/java-7-openjdk
# configure qtbase
./configure \
-opensource \
-confirm-license \
-prefix /home/preet/Dev/env/android/qt-5.1-git-debug \
-debug \
-xplatform android-g++ \
-nomake tests \
-nomake examples \
-android-ndk /home/preet/Dev/env/sys/android-ndk-r8e \
-android-sdk /home/preet/Dev/env/sys/android-sdk-linux \
-android-ndk-host linux-x86_64 \
-android-toolchain-version <e.g. 4.7>
Once qtbase is built, add its bin directory to your path:
export PATH=/path/to/qt-for-android/bin:$PATH
Make sure the environment sees the right qmake:
which qmake // should show you the path to qmake from the above build
You can do a sanity check with:
qmake -query
To make sure everything is in order (see QMAKE_SPEC, QMAKE_XSPEC, QT_VERSION, etc)
i built the following modules (export path to newly built qt ^, then qmake && make && install individual modules)
qtimageformats qtjsbackend qtdeclarative (this is QtQuick 2) qtsensors qtmultimedia qttools (androiddeployqt) qtandroidextras (jni helpers)
then start up qtcreator
tools > options
android, specify NDK, SDK, Ant and OpenJDK paths -- you get a little warning that Qt versions for architectures are missing
now go to Build & Run and add the qt version we just built by finding the corresponding qmake in the Qt Versions tab. note that you shouldn't have to specify a compiler because the previous step with the Android sdk/ndk paths should have created kits with all the right paths already
make install issues some modules build and installs tools that shouldn't be built for android and cause install errors because of incorrect paths (ie could not mkdir /libs)
to figure out what targets are causing this, you can run something llike grep -rn "(INSTALL_ROOT)/libs/armeabi-v7a/" .
after running qmake -r in the module directory
then modify the pro files to disable building those components: !android|android_app:SUBDIRS += etc
device setup to deploy to a device you need to add the device vendors to udev rules
my /etc/udev/rules.d/51-android.rules looks like this:
#asus
SUBSYSTEM=="usb", ATTR{idVendor}=="0b05", MODE="0666"
#google
SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", MODE="0666"
#htc
SUBSYSTEM=="usb", ATTR{idVendor}=="0bb4", MODE="0666"
#lg
SUBSYSTEM=="usb", ATTR{idVendor}=="1004", MODE="0666"
#motorola
SUBSYSTEM=="usb", ATTR{idVendor}=="22b8", MODE="0666"
#samsung
SUBSYSTEM=="usb", ATTR{idVendor}=="04e8", MODE="0666"
#sony
SUBSYSTEM=="usb", ATTR{idVendor}=="054c", MODE="0666"
more info can be found at https://wiki.archlinux.org/index.php/android
http://source.android.com/source/initializing.html#configuring-usb-access