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