Results 1 to 3 of 3

Thread: Problem using SDL with native android

  1. #1
    Join Date
    Oct 2010

    Problem using SDL with native android

    I've been developing with android for sometime, and I think that it's a great platform. Recently, I also started using a library called allegro. I was looking for a port of allegro to android, but no one made something like that, at least not yet. However, there have been a couple of unofficial ports of SDL to android. So, I looked up a guide to using SDL for android, and I found one:

    I got the ARM tool chain from that site, and also recompiled SDL with the modifications. Before I started using SDL, I just wanted to check if it worked. I tried to do the part about "Hello, World". So I made a file called hello.c, with the following content:


    int main(int argc, char **argv)
    printf("Hello, world!\n");
    return 0;

    I compiled it with:

    arm-none-linux-gnueabi-gcc -static -o hello hello.c

    Then, I tried to use adb to send the file an emulator's file system:

    adb push hello /data/misc/hello

    Then, so that I could execute it:

    adb shell chmod 777 /data/misc/hello

    And then I tried to run it with:

    adb shell /data/misc/hello

    It gives me:

    [1] Segmentation fault /data/misc/hello

    What did I do wrong?

    I'm using Ubuntu 10.04.
    Last edited by sarabisan; October 30th, 2010 at 06:00 PM. Reason: Forgot to mention something

  2. #2
    Join Date
    Jun 2006

    Re: Problem using SDL with native android

    You might be happy to know that SDL 1.3 officially supports Android, and I put together a pre-release demo:

    From the README:
    This is a test of the SDL libraries on the Android platform.

    It currently has working versions of the SDL, SDL_image, SDL_mixer, and SDL_ttf libraries.

    Your sources go into jni/src, and you should edit jni/src/ to include them.

    It is currently set up to build the aliens demo, and you should run to push the data to the device, before you run it.

    You build with ndk-build, and install to the device with: ant install

    For a full README, see in the SDL source archive.

    -Sam Lantinga, Founder and President, Galaxy Gameworks LLC

  3. #3
    Join Date
    Nov 2009

    Re: Problem using SDL with native android

    Hi Sam,
    I was able to get the game running on the emulator but then it hangs when I try to use the Back key and eventually I get the ANR message. How can I fix this so that the Back key will go back to the previous activity?

    I'm seeing this in the log many lines:
    W/AudioTrack( 535): obtainBuffer timed out (is the CPU pegged?) 0x2a6c50 user=00000200, server=00000000

    looks like it is hung.

    Here is /data/anr/traces.txt:
    (mutexes: tll=0 tsl=0 tscl=0 ghl=0 hwl=0 hwll=0)
    "main" prio=5 tid=1 WAIT
    | group="main" sCount=1 dsCount=0 obj=0x4001f1a8 self=0xce48
    | sysTid=562 nice=0 sched=0/0 cgrp=default handle=-1345006528
    | schedstat=( 975302082 1348735975 250 )
    at java.lang.Object.wait(Native Method)
    - waiting on <0x4051eb50> (a java.lang.VMThread)
    at java.lang.Object.wait(
    at java.lang.Thread.join(
    at android.view.SurfaceView.reportSurfaceDestroyed(Su
    at android.view.SurfaceView.updateWindow(SurfaceView. java:481)
    at android.view.SurfaceView.onWindowVisibilityChanged (
    at android.view.View.dispatchWindowVisibilityChanged(
    at android.view.ViewGroup.dispatchWindowVisibilityCha nged(
    at android.view.ViewGroup.dispatchWindowVisibilityCha nged(
    at android.view.ViewGroup.dispatchWindowVisibilityCha nged(
    at android.view.ViewRoot.performTraversals(ViewRoot.j ava:782)
    at android.view.ViewRoot.handleMessage( 1859)
    at android.os.Handler.dispatchMessage( )
    at android.os.Looper.loop(
    at a:3647)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(
    at .java:597)
    at dalvik.system.NativeStart.main(Native Method)

    This is running is the Android 2.3.1 Dalvik emulator.

    It's hung at line 280 in
    Last edited by grenoml; May 8th, 2011 at 02:35 AM.

Tags for this Thread


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts