Jump to navigation Jump to search
Android Studio

ENIGMA on Android is a WIP. This page is to help developers get it set up

Compiling Enigma for Android requires that you have Android Studio installed.You can download a version of it from [Android Developer Studio[1] homepage .Inside Android Studio you will need specific versions of the Android SDK and Android NDK. Newer versions may work but are untested and therefore will require source modification.

SDK platforms select


SDK Tools details

. After you have downloaded Android Studio, click on Configure and select SDK Manager. (Refer to graphic Android SDK Manager)

When it opens up, select Android 10 (API Level 29). Take note of the SDK path as this will be important later. (Refer to graphic SDK_platforms_select). Choose those that are selected. The SDK Developer Tools also need to be installed. (refer to the graphic SDL Tools details.) At the bottom right hand corner, select the Show Packages Details to expand the choices fully. Again select the ones shown in the graphic, as well.

Setup Android Emulator

Avd Manager select

It is also recommended you set up an Android Emulator in Android Studio's AVD manager as well.

Go back to Configure at the Android start screen and Select AVD Manager. Click on 'create a Virtual device' button to create a new one, disregarding the one pre-defined. In the 'Select Hardware' window, choose Nexus One from the Phone category. It is suitable enough for our testing purposes. Select 'Next' to save that device. Back at the Virtual Devices screen, click on the green triangle to run the device. With the emulator up and running, it is time to setup the msys side of things.

Setup emake and other settings

First, let's setup emake(our command-line build tool) to compile our test game.

Run mingw64.exe from your msys folder and create a terminal window. At the command prompt, make sure you are at the enigma-dev directory and type:

make emake

Some android specific external dependencies such as GLADE and SDL are kept in a separate repository. You will need to clone this repo on top of your existing enigma-dev folder like so: Within your enigma-dev directory, type at the prompt:

git clone --depth 1 android

(I've also only tested build games with emake (our command line build tool) so make sure you have it built as well.)

On Windows there are a few additional fixes you will need to apply. Android NDK doesn't seem to detect you are windows properly when running from msys terminal. To fix this we can edit C:[your android path]SDK\ndk\22.0.6917172\build\core\ lines 156-158 like so: [2]

Note that [your android path] depends on where you installed Android Studio on your PC. Refer to this graphic in the first box of [3]

Android requires specific versions of java and it's tools be in your %PATH% environmental variable. To accommodate this you need to edit C:/msys64/etc/profile. Let's say for example the

Android SDK path is 'C:\Users\green\AppData\Local\Android\Sdk'

.... and the

Java path is C:\Users\green\AppData\Local\Android\jre\bin

At the very end it should look like this:

export PATH=/c/Users/green/AppData/Local/Android/Sdk/jre/bin:/c/Users/green/AppData/Local

Please note the direction of '/' because in mysys you will need to use UNIX path conventions like shown above.

Note that if you have previously edited /etc/profile, to add another java to your path, you will need to remove that edit as well.

Building Games

Building games you can use either an Android emulator or a phone connected with debugging privileges.

To build an empty game you can run:

-x Android -p SDL -g OpenGLES2 -a None -e Alarms,Paths -o /tmp/test

Note that [your android path] will be a different path on your PC. You can find it in the first box of [4] but you will need to use UNIX path conventions like shown above.

If all goes well you will see an enigma app appear in the emulator or on the phone. Currently, It may display a white screen or just crash right away.