mameau redbubble image
Get Shirty!Keep us online, Buy some kit.

Pygame Subset for Android (PGS4A) on Ubuntu Precise (12.04)

The Pygame Subset for Android (PGS4A) project aims to make it easy to port (and package) pygame titles on Android specific platforms. The current package 0.9.4 does not work out of the box on Ubuntu Precise 12.04. Thankfully like most things in linux; if it doesn’t work out of the box it just takes a little coercing. Some of the solutions I found while setting up PGS4A follow.

The official guide is available here, we will cover the Ubuntu-centric items in this guide.

 

The Java Development Kit

The Java Development Kit stated in the official guide is not available through the official Ubuntu repositories. Fortunately the webupd8 team have provided a ppa to install it. Add this PPA to your system, refresh and install. We installed version 7 (version 8 is also available).

$ sudo add-apt-repository ppa:webupd8team/java

$ sudo apt-get update

$ sudo apt-get install oracle-java7-installer

 

Python 2.7

Check your Python version, Python 2.7 was installed by default for us.

$ python –version

Python 2.7.3

 

Download and extract PGS4A

Proceed through the official setup (I won’t duplicate the details here)

$ ./android.py test

$ ./android.py installsdk

 

No Target Platform Installed during ‘installsdk’

The installsdk command displayed errors during its output while reporting it had completed successfully. You can check this by doing the following

$ ./android-sdk/tools/android list targets

Available Android targets:
----------
id: 1 or "android-8"
     Name: Android 2.2
     Type: Platform
     API level: 8
     Revision: 3
     Skins: WQVGA400, QVGA, HVGA, WVGA800 (default), WVGA854, WQVGA432
     ABIs : armeabi

If you do not see information returned from the list targets command you will need to install the target platform manually.

$ ./android-sdk/tools/android update sdk -u -t android-8

Run list targets again after the installation has finished to confirm correct installation.

 

ADB on 64bit systems

If you are on a 64bit system you will need to install the 32bit version of libncurses5 for adb to function correctly. If you are unsure or you see the error “android-sdk/platform-tools/adb: error while loading shared libraries: libncurses.so.5: cannot open shared object file: No such file or directory” during packaging/installation onto your device you will need to do this.

$ sudo apt-get install libncurses5:i386

 

Device Permissions Error during installation

You will need root access initially to correct this

$ ./android-sdk/platform-tools/adb devices

Create the file /etc/udev/rules.d/51-android.rules containing the information below, once recognised this will give access to the device through the plugdev group; one of the default groups for user accounts on Ubuntu.

SUBSYSTEM==”usb”, ATTR{idVendor}==”18d1″, MODE=”0666″, GROUP=”plugdev”

Update the idVendor string to match your device.

$ lsusb

Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub

Bus 002 Device 002: ID 80ee:0021 VirtualBox USB Tablet

Bus 001 Device 006: ID 18d1:0003 Google Inc.

The Google debug device VendorId in this instance is 18d1 (Ainol Aurora II, running cm10)

 

You should now be up and running, ready to develop for Android using pygame.

$ ./android.py build mygame release install

BUILD SUCCESSFUL
Total time: 15 seconds

 

Show Buttons
Hide Buttons