Examples of using Hunter package manager to build and run Android application.

Overview

Examples of using Hunter package manager to build and run Android application.

Requirements

Android NDK

Go to download page and choose NDK for your platform. E.g. Mac OS X:

> wget http://dl.google.com/android/ndk/android-ndk-r10e-darwin-x86_64.bin
> chmod +x android-ndk-r10e-darwin-x86_64.bin
> ./android-ndk-r10e-darwin-x86_64.bin

Now save location of NDK directory so it can be found in toolchain:

> export ANDROID_NDK_r10e="`pwd`/android-ndk-r10e"

Verify correctness:

> ls "${ANDROID_NDK_r10e}/README.txt"
/.../android-ndk-r10e/README.txt

Note that there is no need to download Android SDK manually since it will be downloaded by Hunter.

Android CMake toolchain

Clone Polly collection of toolchains and add /bin/build.py script to PATH:

which build.py /.../polly/bin/build.py">
> git clone https://github.com/ruslo/polly
> export PATH="`pwd`/polly/bin":$PATH
> which build.py
/.../polly/bin/build.py

Android tools

Every example will print path to the android, emulator and adb tools:

Path to `android`: /.../Install/android-sdk/tools/android
Path to `emulator`: /.../Install/android-sdk/tools/emulator
Path to `adb`: /.../Install/android-sdk/platform-tools/adb

You need to use this tools to create/start emulator. If no real or virtual device started you will see this message while building example:

Added file /.../_builds/android-ndk-r10e-api-21-x86/apk/build.xml
Added file /.../_builds/android-ndk-r10e-api-21-x86/apk/proguard-project.txt
/.../Install/android-sdk/platform-tools/adb uninstall org.pixellight.test
- waiting for device -

Create device

Choose device name from the list. E.g Nexus 6:

> /.../Install/android-sdk/tools/android list device | grep 'Nexus 6'
id: 8 or "Nexus 6"
    Name: Nexus 6

Choose target and skin:

> /.../Install/android-sdk/tools/android list target
Available Android targets:
----------
id: 1 or "android-21"
     Name: Android 5.0.1
     Type: Platform
     API level: 21
     Revision: 2
     Skins: HVGA, QVGA, WQVGA400, WQVGA432, WSVGA, WVGA800 (default), WVGA854, WXGA720, WXGA800, WXGA800-7in
 Tag/ABIs : default/x86
...

Create virtual device:

> /.../Install/android-sdk/tools/android create avd --name "Nexus_6_API_21_WXGA720" --skin WXGA720 --target "android-21"

Now you can find it in list of available devices:

> /.../Install/android-sdk/tools/android list avd
Available Android Virtual Devices:
    Name: Nexus_6_API_21_WXGA720
    Path: /.../.android/avd/Nexus_6_API_21_WXGA720.avd
  Target: Android 5.0.1 (API level 21)
 Tag/ABI: default/x86
    Skin: wxga720

Let's run it:

> /.../Install/android-sdk/tools/emulator -avd Nexus_6_API_21_WXGA720

If you need sdcard for testing:

/.../Install/android-sdk/tools/emulator -sdcard "`pwd`/android-sdcard" -avd Nexus_6_API_21_WXGA720">
> /.../Install/android-sdk/tools/mksdcard 512M "`pwd`/android-sdcard"
> /.../Install/android-sdk/tools/emulator -sdcard "`pwd`/android-sdcard" -avd Nexus_6_API_21_WXGA720

Choosing toolchain

API version

Take a look at this wiki to pick the version you need. E.g. if your device using Android 4.4 you need API level <= 19, for instance android-ndk-r10e-api-16-*.

CPU architecture

Run next command to determine CPU architecture of emulator:

> /.../Install/android-sdk/platform-tools/adb -e shell getprop ro.product.cpu.abi
x86

And this one for device:

> /.../Install/android-sdk/platform-tools/adb -d shell getprop ro.product.cpu.abi
armeabi-v7a

Logging

You can use adb to monitor logging messages:

> /.../Install/android-sdk/platform-tools/adb shell logcat

Examples

Links

You might also like...
C++ package retrieval

cget Cmake package retrieval. This can be used to download and install cmake packages. The advantages of using cget are: Non-intrusive: There is no ne

A fast build system that encourages the creation of small, reusable modules over a variety of platforms and languages.
A fast build system that encourages the creation of small, reusable modules over a variety of platforms and languages.

Buck Buck is a build tool. To see what Buck can do for you, check out the documentation at http://buck.build/. Installation Since Buck is used to buil

Tundra is a code build system that tries to be accurate and fast for incremental builds

Tundra, a build system Tundra is a high-performance code build system designed to give the best possible incremental build times even for very large s

Yet another post-build step and class to bring reflection to C++ enumerations.

enum_values Yet another post-build step and class to bring reflection to C++ enumerations! Fair warning: this project has not undergone much testing (

Improved build system generator for CPython C, C++, Cython and Fortran extensions

scikit-build Improved build system generator for CPython C/C++/Fortran/Cython extensions. Better support is available for additional compilers, build

CMake and other scripts to help build process of FlyEM software

The BuildEM System The buildem repo is a modular CMake-based system that leverages CMake's ExternalProject to simplify and automate a complex build pr

A simple CMake utility for building and deploying Qt based applications on Android without QtCreator

Qt Android CMake utility What it is When using Qt for Android development, QMake & QtCreator is the only sane option for compiling and deploying. But

CMake toolchain file and other scripts for the Android NDK

android-cmake CMake is great, and so is Android. This is a collection of CMake scripts that may be useful to the Android NDK community. It is based on

a small build system with a focus on speed

Ninja Ninja is a small build system with a focus on speed. https://ninja-build.org/ See the manual or doc/manual.asciidoc included in the distribution

Comments
  • Debugging android-cmake Qt examples with Hunter libraries

    Debugging android-cmake Qt examples with Hunter libraries

    Hi @headupinclouds (and Ruslan!)

    Do you have any advice on how to debug these Qt based examples?

    I'm trying to debug these examples on QtCreator so I can start a Qt-based app, but I find no way to do with CMake + QtCreator.

    The route that I'm taking is to integrate Qt's QMake with Hunter and would like to know what are your thoughts in this subject.

    Thanks!

    opened by pretyman 10
Owner
This software is abandoned
null
C package manager-ish

clib(1) Package manager for the C programming language. Installation Expects libcurl to be installed and linkable. With homebrew: $ brew install clib

clibs 4.5k Jan 6, 2023
C++ Package Manager

CPM Note CPM is not being actively maintained. I plan on keeping the website active but don't plan on making further modifications to the codebase. If

James 720 Dec 18, 2022
📦 CMake's missing package manager. A small CMake script for setup-free, cross-platform, reproducible dependency management.

Setup-free CMake dependency management CPM.cmake is a CMake script that adds dependency management capabilities to CMake. It's built as a thin wrapper

CPM.cmake 1.6k Jan 9, 2023
A toolchain file and examples using cmake for iOS development

ios-cmake A toolchain file and examples using cmake for iOS development. This is a fork of a similar project found on https://code.google.com/p/ios-cm

Bogdan Cristea 304 Nov 30, 2022
Useful CMake Examples

CMake Examples Table of Contents Introduction Requirements Installation on Ubuntu Docker Other Links Introduction CMake is a cross-platform open-sourc

Thom Troy 9.8k Jan 5, 2023
CMake: config mode of find_package command (examples)

Install Foo Install project Foo in Debug and Release variants (Makefile generator): > cmake -HFoo -B_builds/Foo-debug -DCMAKE_BUILD_TYPE=Debug -DCMAKE

null 367 Dec 14, 2022
NeoWorld is a resampler using the CMake build system

NeoWorld is a resampler using the CMake build system. It's designed for utsu, OpenUTAU, and UTAU.

null 5 Dec 23, 2022
Project to enable using CMake from a Maven build.

CMake-Maven-Project Introduction A Maven project for the CMake build system. It can be used by including it as a plugin within your Maven project's po

null 60 Nov 14, 2022
C++ Library Manager for Windows, Linux, and MacOS

Vcpkg: Overview 中文总览 Español 한국어 Français Vcpkg helps you manage C and C++ libraries on Windows, Linux and MacOS. This tool and ecosystem are constant

Microsoft 17.5k Jan 1, 2023
Enhanced CMake Project Manager plugin for Qt Creator

CMakeProjectManager2 Alternative CMake support for Qt Creator. Main differents from original CMakeProject plugin: Project file list readed from file s

Alexander Drozdov 71 Nov 20, 2022