README.android
author Sam Lantinga <slouken@libsdl.org>
Thu, 06 Jan 2011 16:11:21 -0800
changeset 4964 6c645018741e
parent 4954 144d9df7e611
child 4965 91d0085b7560
permissions -rw-r--r--
Build the SDL library as a shared object on Android, so it will work correctly with SDL_image and SDL_ttf.
paul@4727
     1
================================================================================
paul@4726
     2
Simple DirectMedia Layer for Android
paul@4727
     3
================================================================================
paul@4725
     4
slouken@4964
     5
Requirements: Android SDK and Android NDK r4 or later
slouken@4964
     6
http://developer.android.com/
paul@4725
     7
paul@4727
     8
================================================================================
paul@4727
     9
 How the port works
paul@4727
    10
================================================================================
paul@4727
    11
paul@4727
    12
- Android applications are Java-based, optionally with parts written in C
paul@4727
    13
- As SDL apps are C-based, we use a small Java shim that uses JNI to talk to 
paul@4727
    14
the SDL library
paul@4727
    15
- This means that your application C code must be placed inside an android 
paul@4727
    16
Java project, along with some C support code that communicates with Java
paul@4727
    17
- This eventually produces a standard Android .apk package
paul@4727
    18
paul@4727
    19
paul@4727
    20
================================================================================
paul@4727
    21
 Building an app
paul@4727
    22
================================================================================
paul@4727
    23
paul@4725
    24
Instructions:
slouken@4964
    25
1. Copy the android-project directory wherever you want your Android project to go
slouken@4964
    26
2. Move this SDL directory into the <project>/jni directory
slouken@4964
    27
3. Place your application source files in the <project>/jni/src directory
slouken@4964
    28
4. Edit <project>/jni/src/Android.mk to include your source files
paul@4727
    29
5. Run 'ndk-build' (a script provided by the NDK). This compiles the C source
paul@4725
    30
slouken@4964
    31
If you want to use the Eclipse IDE, skip to the Eclipse section below.
paul@4725
    32
slouken@4964
    33
6. Edit <project>/local.properties to point to the Android SDK directory
slouken@4964
    34
7. Run 'ant debug' in android/project. This compiles the .java and eventually 
slouken@4964
    35
creates a .apk with the native code embedded
slouken@4964
    36
8. 'ant install' will push the apk to the device or emulator (if connected)
slouken@4964
    37
slouken@4964
    38
slouken@4964
    39
================================================================================
slouken@4964
    40
 Using Eclipse
slouken@4964
    41
================================================================================
slouken@4964
    42
slouken@4964
    43
NEED CONTENT
slouken@4964
    44
slouken@4964
    45
slouken@4964
    46
================================================================================
slouken@4964
    47
 Loading files
slouken@4964
    48
================================================================================
slouken@4964
    49
slouken@4964
    50
NEED CONTENT
slouken@4964
    51
slouken@4964
    52
slouken@4964
    53
================================================================================
slouken@4964
    54
 Troubleshooting
slouken@4964
    55
================================================================================
slouken@4964
    56
slouken@4964
    57
NEED CONTENT
paul@4727
    58
paul@4727
    59
paul@4727
    60
================================================================================
paul@4727
    61
 Known issues
paul@4727
    62
================================================================================
paul@4727
    63
paul@4727
    64
- SDL audio (although it's mostly written, just not working properly yet)
paul@4727
    65
- TODO. I'm sure there's a bunch more stuff I haven't thought of