Skip to content

Building

Evgeny Sologubov edited this page Jun 5, 2016 · 10 revisions

Prerequisites

Before building a GTK-based application for Android, you should:

  1. download and install Android Studio/SDK;

  2. download and install Android NDK;

  3. pull the latest sources from this repo;

  4. run python clibs/getLibs.py. This command downloads all the necessary library sources from their original locations. (On Windows Python2.7 can be found inside NDK distribution: %NDK_ROOT%/prebuilt/windows-x86_64/bin/python2.7.exe.)

Building

Now you can build a test application sitting in "app" subdirectory. Replace it with your own code, or modify your Android.mk to look like:

LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)

LOCAL_MODULE    := <your module name>
LOCAL_SRC_FILES := <your sources> (see app/jni/main.c for example)

include <path to GTKAndroid snapshot>/clibs/gtk/build-gtk-shared-library.mk

To build this demo application run:

cd app
ndk-build NDK_DEBUG=1
../gradlew assembleDebug

Skip NDK_DEBUG=1 and assembleDebug for the release version.

Using the application

To install the application use the usual

adb install -r build/outputs/apk/app-debug.apk

If you do everything right, you should be able to see something like the following screenshot on your phone/tablet

screenshot

Clone this wiki locally